作者 lyh

hx

@@ -234,16 +234,8 @@ class NewsLogic extends BaseLogic @@ -234,16 +234,8 @@ class NewsLogic extends BaseLogic
234 if ($decodedData === false) { 234 if ($decodedData === false) {
235 continue; // 如果解码失败,则跳过 235 continue; // 如果解码失败,则跳过
236 } 236 }
237 - // 设置文件名  
238 -// $outputFile = 'images/' . uniqid() . '.' . $imageType;  
239 -// $filePath = __DIR__ . '/' . $outputFile;  
240 - // 保存图片到服务器  
241 -// if (file_put_contents($filePath, $decodedData)) {  
242 -// // 生成图片URL  
243 -// $imageUrl = 'http://your-domain.com/' . $outputFile;  
244 -// // 替换原字符串中的Base64流为图片链接  
245 -// $outputString = str_replace($base64String, $imageUrl, $outputString);  
246 -// } 237 + $imageUrl = $this->manager_uploads($decodedData);
  238 + $outputString = str_replace($base64String, $imageUrl, $outputString);
247 } 239 }
248 } 240 }
249 return $outputString; 241 return $outputString;
@@ -260,7 +252,7 @@ class NewsLogic extends BaseLogic @@ -260,7 +252,7 @@ class NewsLogic extends BaseLogic
260 $path = $this->uploads['path_b'].'/'.($this->user['project_id'] ?? 1618).'/image_news/'.date('Y-m'); 252 $path = $this->uploads['path_b'].'/'.($this->user['project_id'] ?? 1618).'/image_news/'.date('Y-m');
261 $cosService = new CosService(); 253 $cosService = new CosService();
262 $fileName = md5(uniqid() . '_' . time() . '.' . ($this->user['project_id'] ?? 1618).rand(1,10000)).'png'; 254 $fileName = md5(uniqid() . '_' . time() . '.' . ($this->user['project_id'] ?? 1618).rand(1,10000)).'png';
263 - return $cosService->uploadFile($files,$path,$fileName); 255 + return getImageUrl($cosService->uploadFile($files,$path,$fileName));
264 } 256 }
265 /** 257 /**
266 * @remark :获取分类(字符串) 258 * @remark :获取分类(字符串)