|
...
|
...
|
@@ -10,6 +10,7 @@ use App\Jobs\CopyProjectJob; |
|
|
|
use App\Jobs\SyncImageFileJob;
|
|
|
|
use App\Models\File\ErrorFile;
|
|
|
|
use App\Models\File\Image as ImageModel;
|
|
|
|
use App\Models\File\WatermarkImage;
|
|
|
|
use App\Models\Project\Project;
|
|
|
|
use App\Services\AmazonS3Service;
|
|
|
|
use App\Services\CosService;
|
|
...
|
...
|
@@ -525,16 +526,21 @@ class ImageController extends Controller |
|
|
|
*/
|
|
|
|
public function coverOriginalImage(){
|
|
|
|
$this->request->validate([
|
|
|
|
'old_url'=>['required'],
|
|
|
|
'url'=>['required'],
|
|
|
|
'saveUrl'=>['required'],
|
|
|
|
],[
|
|
|
|
'old_url.required'=>'原图的相对路径',
|
|
|
|
'url.required'=>'请填写预览的链接',
|
|
|
|
'saveUrl.required'=>'保存的路径',
|
|
|
|
]);
|
|
|
|
$cos = new CosService();
|
|
|
|
$url = $cos->coverOriginalImage($this->param['url'],$this->param['saveUrl']);
|
|
|
|
$this->saveWatermarkImage($this->param['saveUrl'],$this->param['old_url']);
|
|
|
|
if($this->param['saveUrl'] == $this->param['old_url']){
|
|
|
|
$upYun = new UpyunService();
|
|
|
|
$upYun->purgePush($url);
|
|
|
|
}
|
|
|
|
$this->response('success',Code::SUCCESS,['url'=>$url]);
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -583,4 +589,21 @@ class ImageController extends Controller |
|
|
|
$data = $cos->getPosition();
|
|
|
|
$this->response('success',Code::SUCCESS,$data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :保存水印图片记录
|
|
|
|
* @name :saveWatermarkImage
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/8/21 14:34
|
|
|
|
*/
|
|
|
|
public function saveWatermarkImage($path,$old_path){
|
|
|
|
$watermarkImageModel = new WatermarkImage();
|
|
|
|
$data = [
|
|
|
|
'path' => $path,
|
|
|
|
'old_path'=>$old_path,
|
|
|
|
'project_id' =>$this->cache['project_id'] ?? 0
|
|
|
|
];
|
|
|
|
return $watermarkImageModel->addReturnId($data);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|