|
...
|
...
|
@@ -52,6 +52,7 @@ class CropImage extends Command |
|
|
|
* @time :2025/5/8 9:21
|
|
|
|
*/
|
|
|
|
public function _keywordAction($project_id){
|
|
|
|
$resData = [];
|
|
|
|
//聚合页裁剪
|
|
|
|
$data = $this->getKeywordImage($project_id);
|
|
|
|
$cosService = new CosService();
|
|
...
|
...
|
@@ -70,11 +71,15 @@ class CropImage extends Command |
|
|
|
if(empty($result)){
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$resData[] = $result['path'];
|
|
|
|
$this->saveMysql($project_id,$result['size'],$result['type'],$result['path'],$result['mime']);
|
|
|
|
}else{
|
|
|
|
$resData[] = $image;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $data;
|
|
|
|
$this->saveAggregationSetting($project_id,$resData);
|
|
|
|
return $resData;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -104,9 +109,38 @@ class CropImage extends Command |
|
|
|
return true;
|
|
|
|
}
|
|
|
|
$this->saveMysql($project_id,$result['size'],$result['type'],$result['path'],$result['mime']);
|
|
|
|
$webSettingImageModel = new WebSettingImage();
|
|
|
|
$webSettingImageModel->edit(['image'=>$result['path']],['project_id' => $project_id, 'type' => 4]);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :保存数据
|
|
|
|
* @name :saveAggregationSetting
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/5/8 16:24
|
|
|
|
*/
|
|
|
|
public function saveAggregationSetting($project_id,$data){
|
|
|
|
if(empty($data)){
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
//存全路径
|
|
|
|
foreach ($data as $key => $val){
|
|
|
|
$val = getImageUrl($val);
|
|
|
|
$data[$key] = $val;
|
|
|
|
}
|
|
|
|
$webSettingImageModel = new WebSettingImage();
|
|
|
|
$info = $webSettingImageModel->read(['project_id'=>$project_id]);
|
|
|
|
if($info === false){
|
|
|
|
$webSettingImageModel->addReturnId(['project_id'=>$project_id,'top_banner'=>json_encode($data,true)]);
|
|
|
|
}else{
|
|
|
|
$webSettingImageModel->edit(['top_banner'=>json_encode($data,true)],['id'=>$info['id']]);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取aiBlog图片
|
|
|
|
* @name :getAiBlogImage
|
|
...
|
...
|
@@ -192,7 +226,9 @@ class CropImage extends Command |
|
|
|
* @time :2025/5/8 14:59
|
|
|
|
*/
|
|
|
|
public function saveMysql($project_id,$size,$image_type,$path,$mime = ''){
|
|
|
|
$hash = hash_file('sha256', $path);
|
|
|
|
$imageModel = new Image();
|
|
|
|
$info = $imageModel->read(['hash'=>$hash,'project_id'=>$project_id]);
|
|
|
|
$data = [
|
|
|
|
'path' => $path,
|
|
|
|
'size' => $size,
|
|
...
|
...
|
@@ -204,7 +240,11 @@ class CropImage extends Command |
|
|
|
'name'=>basename($path),
|
|
|
|
'en_name'=>basename($path)
|
|
|
|
];
|
|
|
|
if($info === false){
|
|
|
|
$imageModel->addReturnId($data);
|
|
|
|
}else{
|
|
|
|
$imageModel->edit($data,['id'=>$info['id']]);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|