作者 lyh

gx

... ... @@ -38,9 +38,8 @@ class CustomModuleContentController extends BaseController
$data = $this->getAllCategoryName();
foreach ($lists['list'] as $k=>$v){
$v['url'] = $this->getUrl($v);
$v = $this->getHandleImageFile($v);
$v['category_name'] = $this->categoryName($v['category_id'],$data);
$v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']);
$v['video_link'] = getFileUrl($v['video'],$this->user['storage_type'],$this->user['project_location']);
$v['operator_name'] = (new User())->getName($v['operator_id']);
$lists['list'][$k] = $v;
}
... ... @@ -49,6 +48,24 @@ class CustomModuleContentController extends BaseController
}
/**
* @remark :获取时处理视频,图片,文件
* @name :getHandleImageFile
* @author :lyh
* @method :post
* @time :2024/1/31 15:48
*/
public function getHandleImageFile($v){
if(!empty($v['image'])){
$v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
}
if(!empty($v['video'])){
$v['video']['url'] = getFileUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
$v['video']['video_image'] = getImageUrl($v['video']['video_image'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
}
return $this->success($v);
}
/**
* @remark :获取连接
* @name :getUrl
* @author :lyh
... ... @@ -142,6 +159,7 @@ class CustomModuleContentController extends BaseController
'id.required' => 'ID不能为空',
]);
$info = $logic->getContentInfo();
$info = $this->getHandleImageFile($info);
$this->response('success',Code::SUCCESS,$info);
}
... ...
... ... @@ -94,11 +94,12 @@ class ProductController extends BaseController
$v['icon'][$icon_k] = $icon_v;
}
}
if(!empty($v['video']) && !empty($v['video']['url'])){
$v['video']['url'] = getImageUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
if(!empty($v['video'])){
$v['video']['url'] = getFileUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
$v['video']['video_image'] = getImageUrl($v['video']['video_image'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
}
if(!empty($v['files']) && !empty($v['files']['url'])){
$v['files']['url'] = getImageUrl($v['files']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
$v['files']['url'] = getFileUrl($v['files']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
}
return $this->success($v);
}
... ...
... ... @@ -9,6 +9,7 @@
namespace App\Http\Logic\Bside\CustomModule;
use App\Helper\Arr;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\CustomModule\CustomModuleCategory;
use App\Models\CustomModule\CustomModuleContent;
... ... @@ -39,8 +40,6 @@ class CustomModuleContentLogic extends BaseLogic
if($info === false){
$this->fail('当前数据不存在或已被删除');
}
$info['image'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']);
$info['video'] = getFileUrl($info['video'],$this->user['storage_type'],$this->user['project_location']);
$info['extend'] = $this->getExtendInfo($info['module_id'],$info['id']);
return $this->success($info);
}
... ... @@ -218,8 +217,10 @@ class CustomModuleContentLogic extends BaseLogic
if(isset($param['image']) && !empty($param['image'])){
$param['image'] = str_replace_url($param['image']);
}
if(isset($param['video']) && !empty($param['video'])){
$param['video'] = str_replace_url($param['video']);
if(isset($param['video'])){
$param['video']['url'] = str_replace_url($param['video']['url']);
$param['video']['video_image'] = str_replace_url($param['video']['video_image']);
$param['video'] = Arr::a2s($param['video'] ?? []);
}
return $this->success($param);
}
... ...
... ... @@ -287,6 +287,7 @@ class ProductLogic extends BaseLogic
}
if(isset($param['video'])){
$param['video']['url'] = str_replace_url($param['video']['url']);
$param['video']['video_image'] = str_replace_url($param['video']['video_image']);
$param['video'] = Arr::a2s($param['video'] ?? []);
}
if(isset($param['keyword_id']) && !empty($param['keyword_id'])){
... ...