正在显示
4 个修改的文件
包含
30 行增加
和
9 行删除
| @@ -38,9 +38,8 @@ class CustomModuleContentController extends BaseController | @@ -38,9 +38,8 @@ class CustomModuleContentController extends BaseController | ||
| 38 | $data = $this->getAllCategoryName(); | 38 | $data = $this->getAllCategoryName(); |
| 39 | foreach ($lists['list'] as $k=>$v){ | 39 | foreach ($lists['list'] as $k=>$v){ |
| 40 | $v['url'] = $this->getUrl($v); | 40 | $v['url'] = $this->getUrl($v); |
| 41 | + $v = $this->getHandleImageFile($v); | ||
| 41 | $v['category_name'] = $this->categoryName($v['category_id'],$data); | 42 | $v['category_name'] = $this->categoryName($v['category_id'],$data); |
| 42 | - $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']); | ||
| 43 | - $v['video_link'] = getFileUrl($v['video'],$this->user['storage_type'],$this->user['project_location']); | ||
| 44 | $v['operator_name'] = (new User())->getName($v['operator_id']); | 43 | $v['operator_name'] = (new User())->getName($v['operator_id']); |
| 45 | $lists['list'][$k] = $v; | 44 | $lists['list'][$k] = $v; |
| 46 | } | 45 | } |
| @@ -49,6 +48,24 @@ class CustomModuleContentController extends BaseController | @@ -49,6 +48,24 @@ class CustomModuleContentController extends BaseController | ||
| 49 | } | 48 | } |
| 50 | 49 | ||
| 51 | /** | 50 | /** |
| 51 | + * @remark :获取时处理视频,图片,文件 | ||
| 52 | + * @name :getHandleImageFile | ||
| 53 | + * @author :lyh | ||
| 54 | + * @method :post | ||
| 55 | + * @time :2024/1/31 15:48 | ||
| 56 | + */ | ||
| 57 | + public function getHandleImageFile($v){ | ||
| 58 | + if(!empty($v['image'])){ | ||
| 59 | + $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'] ?? 0,$this->user['project_location']); | ||
| 60 | + } | ||
| 61 | + if(!empty($v['video'])){ | ||
| 62 | + $v['video']['url'] = getFileUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']); | ||
| 63 | + $v['video']['video_image'] = getImageUrl($v['video']['video_image'],$this->user['storage_type'] ?? 0,$this->user['project_location']); | ||
| 64 | + } | ||
| 65 | + return $this->success($v); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + /** | ||
| 52 | * @remark :获取连接 | 69 | * @remark :获取连接 |
| 53 | * @name :getUrl | 70 | * @name :getUrl |
| 54 | * @author :lyh | 71 | * @author :lyh |
| @@ -142,6 +159,7 @@ class CustomModuleContentController extends BaseController | @@ -142,6 +159,7 @@ class CustomModuleContentController extends BaseController | ||
| 142 | 'id.required' => 'ID不能为空', | 159 | 'id.required' => 'ID不能为空', |
| 143 | ]); | 160 | ]); |
| 144 | $info = $logic->getContentInfo(); | 161 | $info = $logic->getContentInfo(); |
| 162 | + $info = $this->getHandleImageFile($info); | ||
| 145 | $this->response('success',Code::SUCCESS,$info); | 163 | $this->response('success',Code::SUCCESS,$info); |
| 146 | } | 164 | } |
| 147 | 165 |
| @@ -94,11 +94,12 @@ class ProductController extends BaseController | @@ -94,11 +94,12 @@ class ProductController extends BaseController | ||
| 94 | $v['icon'][$icon_k] = $icon_v; | 94 | $v['icon'][$icon_k] = $icon_v; |
| 95 | } | 95 | } |
| 96 | } | 96 | } |
| 97 | - if(!empty($v['video']) && !empty($v['video']['url'])){ | ||
| 98 | - $v['video']['url'] = getImageUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']); | 97 | + if(!empty($v['video'])){ |
| 98 | + $v['video']['url'] = getFileUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']); | ||
| 99 | + $v['video']['video_image'] = getImageUrl($v['video']['video_image'],$this->user['storage_type'] ?? 0,$this->user['project_location']); | ||
| 99 | } | 100 | } |
| 100 | if(!empty($v['files']) && !empty($v['files']['url'])){ | 101 | if(!empty($v['files']) && !empty($v['files']['url'])){ |
| 101 | - $v['files']['url'] = getImageUrl($v['files']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']); | 102 | + $v['files']['url'] = getFileUrl($v['files']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']); |
| 102 | } | 103 | } |
| 103 | return $this->success($v); | 104 | return $this->success($v); |
| 104 | } | 105 | } |
| @@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Http\Logic\Bside\CustomModule; | 10 | namespace App\Http\Logic\Bside\CustomModule; |
| 11 | 11 | ||
| 12 | +use App\Helper\Arr; | ||
| 12 | use App\Http\Logic\Bside\BaseLogic; | 13 | use App\Http\Logic\Bside\BaseLogic; |
| 13 | use App\Models\CustomModule\CustomModuleCategory; | 14 | use App\Models\CustomModule\CustomModuleCategory; |
| 14 | use App\Models\CustomModule\CustomModuleContent; | 15 | use App\Models\CustomModule\CustomModuleContent; |
| @@ -39,8 +40,6 @@ class CustomModuleContentLogic extends BaseLogic | @@ -39,8 +40,6 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 39 | if($info === false){ | 40 | if($info === false){ |
| 40 | $this->fail('当前数据不存在或已被删除'); | 41 | $this->fail('当前数据不存在或已被删除'); |
| 41 | } | 42 | } |
| 42 | - $info['image'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']); | ||
| 43 | - $info['video'] = getFileUrl($info['video'],$this->user['storage_type'],$this->user['project_location']); | ||
| 44 | $info['extend'] = $this->getExtendInfo($info['module_id'],$info['id']); | 43 | $info['extend'] = $this->getExtendInfo($info['module_id'],$info['id']); |
| 45 | return $this->success($info); | 44 | return $this->success($info); |
| 46 | } | 45 | } |
| @@ -218,8 +217,10 @@ class CustomModuleContentLogic extends BaseLogic | @@ -218,8 +217,10 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 218 | if(isset($param['image']) && !empty($param['image'])){ | 217 | if(isset($param['image']) && !empty($param['image'])){ |
| 219 | $param['image'] = str_replace_url($param['image']); | 218 | $param['image'] = str_replace_url($param['image']); |
| 220 | } | 219 | } |
| 221 | - if(isset($param['video']) && !empty($param['video'])){ | ||
| 222 | - $param['video'] = str_replace_url($param['video']); | 220 | + if(isset($param['video'])){ |
| 221 | + $param['video']['url'] = str_replace_url($param['video']['url']); | ||
| 222 | + $param['video']['video_image'] = str_replace_url($param['video']['video_image']); | ||
| 223 | + $param['video'] = Arr::a2s($param['video'] ?? []); | ||
| 223 | } | 224 | } |
| 224 | return $this->success($param); | 225 | return $this->success($param); |
| 225 | } | 226 | } |
| @@ -287,6 +287,7 @@ class ProductLogic extends BaseLogic | @@ -287,6 +287,7 @@ class ProductLogic extends BaseLogic | ||
| 287 | } | 287 | } |
| 288 | if(isset($param['video'])){ | 288 | if(isset($param['video'])){ |
| 289 | $param['video']['url'] = str_replace_url($param['video']['url']); | 289 | $param['video']['url'] = str_replace_url($param['video']['url']); |
| 290 | + $param['video']['video_image'] = str_replace_url($param['video']['video_image']); | ||
| 290 | $param['video'] = Arr::a2s($param['video'] ?? []); | 291 | $param['video'] = Arr::a2s($param['video'] ?? []); |
| 291 | } | 292 | } |
| 292 | if(isset($param['keyword_id']) && !empty($param['keyword_id'])){ | 293 | if(isset($param['keyword_id']) && !empty($param['keyword_id'])){ |
-
请 注册 或 登录 后发表评论