作者 Your Name
... ... @@ -103,7 +103,7 @@ class DeleteCustomCategory extends Command
return false;
}
foreach ($customList['list'] as $v){
$category_id_arr = Arr::setToArr(trim($v['category_id'],','));
$category_id_arr = $v['category_id'];
if(empty($category_id_arr)){
continue;
}
... ...
... ... @@ -610,7 +610,6 @@ if (!function_exists('getFileUrl')) {
return $cdn2.$path;
}
if($location == 0){
//v6-file.globalso.com
$cos = config('filesystems.disks.cos');
$cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1'];
return $cosCdn.$path;
... ...
... ... @@ -134,7 +134,7 @@ class FileController
$amazonS3Service->uploadFiles($files,$this->path,$fileName);
}
$this->saveMysql($fileModel,$files->getSize(),$files->getClientOriginalExtension(),$fileName,$hash,$this->upload_location,$files->getMimeType(),$name);
$this->synchronizationFile($fileName,($this->upload_location == 0) ? 1 : 0);
$this->synchronizationFile($fileName,$this->upload_location);
$this->response('资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name));
}
... ... @@ -303,7 +303,7 @@ class FileController
$mime = $file->getMimeType();
$this->saveMysql($fileModel,$size,$file_type,$fileName,$hash,$this->upload_location,$mime,$name);
$data[] = $this->responseData($this->path.'/'.$fileName, $name);
$this->synchronizationFile($fileName,($this->upload_location == 0) ? 1 : 0);
$this->synchronizationFile($fileName,$this->upload_location);
}
$this->response('资源',Code::SUCCESS,$data);
}
... ...
... ... @@ -215,7 +215,7 @@ class ImageController extends Controller
$amazonS3Service->uploadFiles($files,$this->path,$fileName);
}
$this->saveMysql($imageModel,$files->getSize(),$image_type,$fileName,$hash,$this->upload_location,$files->getMimeType(), $name);
$this->synchronizationImage($fileName,($this->upload_location == 0) ? 1 : 0);
$this->synchronizationImage($fileName,$this->upload_location);
return $this->response('图片资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name));
}
... ... @@ -347,7 +347,7 @@ class ImageController extends Controller
}
//批量存储
$this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name);
$this->synchronizationImage($fileName,($this->upload_location == 0) ? 1 : 0);
$this->synchronizationImage($fileName,$this->upload_location);
$data[] = $this->responseData($this->path.'/'.$fileName,$name);
}
$this->response('图片资源',Code::SUCCESS,$data);
... ...
... ... @@ -359,6 +359,11 @@ class TranslateLogic extends BaseLogic
$data = ['source'=>4,'source_id'=>$routeInfo['source_id'],'is_list'=>1,'is_custom'=>0];
}
}
if($routeInfo['source'] == RouteMap::SOURCE_PRODUCT_KEYWORD){
if($routeInfo['source_id']){
$data = ['source'=>8,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0];
}
}
if($routeInfo['source'] == RouteMap::SOURCE_MODULE){
if($routeInfo['source_id']){
$data = ['source'=>7,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>1];
... ...
... ... @@ -38,8 +38,9 @@ class SyncImageFileJob implements ShouldQueue
*/
public function handle()
{
$file_path = getImageUrl($this->param['path'].'/'.$this->param['name'], 0,$this->param['location']);
$file_path = $this->getUrl($this->param['path'].'/'.$this->param['name'], 0,$this->param['location']);
$cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->param['path'].'" https://v6-file.globalso.com/upload.php';
echo date('Y-m-d H:i:s') . ' | ' . $cmd . PHP_EOL;
$code = shell_exec($cmd);
if(200 != (int)$code){
$errorFileModel = new ErrorFile();
... ... @@ -47,4 +48,40 @@ class SyncImageFileJob implements ShouldQueue
}
return true;
}
/**
* @remark :获取图片文件链接
* @name :getUrl
* @author :lyh
* @method :post
* @time :2024/5/22 11:53
*/
public function getUrl($path,$storage_type,$location){
if(is_array($path)){
$url =[];
foreach ($path as $v){
$url[] = $this->getUrl($v,$storage_type,$location);
}
}else{
if(empty($path)){
return '';
}
if((strpos($path,'https://')!== false) || (strpos($path,'http://') !== false)){
return $path;
}
if(substr($path,0,2) == '//'){
return 'https:'.$path;
}
if($location == 0){
$cos = config('filesystems.disks.cos');
$cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1'];
$url = $cosCdn.$path;
}else{
$s3 = config('filesystems.disks.s3');
$cdn = $s3['cdn'];
$url = $cdn.$path;
}
}
return $url;
}
}
... ...