Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into bate
正在显示
11 个修改的文件
包含
60 行增加
和
85 行删除
| @@ -456,11 +456,11 @@ if (!function_exists('getImageUrl')) { | @@ -456,11 +456,11 @@ if (!function_exists('getImageUrl')) { | ||
| 456 | * @method :post | 456 | * @method :post |
| 457 | * @time :2023/7/20 16:46 | 457 | * @time :2023/7/20 16:46 |
| 458 | */ | 458 | */ |
| 459 | - function getImageUrl($path,$location = 1){ | 459 | + function getImageUrl($path,$location = 1,$storage_type = 0){ |
| 460 | if(is_array($path)){ | 460 | if(is_array($path)){ |
| 461 | $url =[]; | 461 | $url =[]; |
| 462 | foreach ($path as $v){ | 462 | foreach ($path as $v){ |
| 463 | - $url[] = getImageUrl($v); | 463 | + $url[] = getImageUrl($v,$location,$storage_type); |
| 464 | } | 464 | } |
| 465 | }else{ | 465 | }else{ |
| 466 | if(empty($path)){ | 466 | if(empty($path)){ |
| @@ -473,7 +473,7 @@ if (!function_exists('getImageUrl')) { | @@ -473,7 +473,7 @@ if (!function_exists('getImageUrl')) { | ||
| 473 | return 'https:'.$path; | 473 | return 'https:'.$path; |
| 474 | } | 474 | } |
| 475 | if($location == 1){ | 475 | if($location == 1){ |
| 476 | - $cos = config('filesystems.disks.cos'); | 476 | + $cos = ($storage_type == 0) ? config('filesystems.disks.cos') : config('filesystems.disks.cos1'); |
| 477 | $cosCdn = $cos['cdn']; | 477 | $cosCdn = $cos['cdn']; |
| 478 | $url = $cosCdn.$path; | 478 | $url = $cosCdn.$path; |
| 479 | }else{ | 479 | }else{ |
| @@ -483,6 +483,7 @@ if (!function_exists('getImageUrl')) { | @@ -483,6 +483,7 @@ if (!function_exists('getImageUrl')) { | ||
| 483 | return $url; | 483 | return $url; |
| 484 | } | 484 | } |
| 485 | } | 485 | } |
| 486 | + | ||
| 486 | if (!function_exists('getFileUrl')) { | 487 | if (!function_exists('getFileUrl')) { |
| 487 | /** | 488 | /** |
| 488 | * @remark :获取文件链接 | 489 | * @remark :获取文件链接 |
| @@ -491,11 +492,11 @@ if (!function_exists('getFileUrl')) { | @@ -491,11 +492,11 @@ if (!function_exists('getFileUrl')) { | ||
| 491 | * @method :post | 492 | * @method :post |
| 492 | * @time :2023/7/20 16:46 | 493 | * @time :2023/7/20 16:46 |
| 493 | */ | 494 | */ |
| 494 | - function getFileUrl($path,$location = 1){ | 495 | + function getFileUrl($path,$location = 1,$storage_type = 0){ |
| 495 | if(is_array($path)){ | 496 | if(is_array($path)){ |
| 496 | $url =[]; | 497 | $url =[]; |
| 497 | foreach ($path as $v){ | 498 | foreach ($path as $v){ |
| 498 | - $url[] = getFileUrl($v); | 499 | + $url[] = getFileUrl($v,$location,$storage_type); |
| 499 | } | 500 | } |
| 500 | }else{ | 501 | }else{ |
| 501 | if(empty($path)){ | 502 | if(empty($path)){ |
| @@ -508,7 +509,7 @@ if (!function_exists('getFileUrl')) { | @@ -508,7 +509,7 @@ if (!function_exists('getFileUrl')) { | ||
| 508 | return 'https:'.$path; | 509 | return 'https:'.$path; |
| 509 | } | 510 | } |
| 510 | if($location == 1){ | 511 | if($location == 1){ |
| 511 | - $cos = config('filesystems.disks.cos'); | 512 | + $cos = ($storage_type == 0) ? config('filesystems.disks.cos') : config('filesystems.disks.cos1'); |
| 512 | $cosCdn = $cos['cdn']; | 513 | $cosCdn = $cos['cdn']; |
| 513 | $url = $cosCdn.$path; | 514 | $url = $cosCdn.$path; |
| 514 | }else{ | 515 | }else{ |
| @@ -38,7 +38,7 @@ class BlogController extends BaseController | @@ -38,7 +38,7 @@ class BlogController extends BaseController | ||
| 38 | foreach ($lists['list'] as $k => $v){ | 38 | foreach ($lists['list'] as $k => $v){ |
| 39 | $v['category_name'] = $this->categoryName($v['category_id'],$data); | 39 | $v['category_name'] = $this->categoryName($v['category_id'],$data); |
| 40 | $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG,$v['id']); | 40 | $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG,$v['id']); |
| 41 | - $v['image_link'] = getImageUrl($v['image']); | 41 | + $v['image_link'] = getImageUrl($v['image'],$this->user['project_location'],$this->user['storage_type']); |
| 42 | $v['operator_name'] = $user->getName($v['operator_id']); | 42 | $v['operator_name'] = $user->getName($v['operator_id']); |
| 43 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_BLOG,BTemplate::IS_DETAIL,$template_id,$v['id']); | 43 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_BLOG,BTemplate::IS_DETAIL,$template_id,$v['id']); |
| 44 | $lists['list'][$k] = $v; | 44 | $lists['list'][$k] = $v; |
| @@ -186,10 +186,8 @@ class BlogController extends BaseController | @@ -186,10 +186,8 @@ class BlogController extends BaseController | ||
| 186 | 'id.required' => 'ID不能为空' | 186 | 'id.required' => 'ID不能为空' |
| 187 | ]); | 187 | ]); |
| 188 | $info = $blogLogic->blogInfo(); | 188 | $info = $blogLogic->blogInfo(); |
| 189 | - | ||
| 190 | $template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_DETAIL); | 189 | $template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_DETAIL); |
| 191 | $info['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_BLOG,BTemplate::IS_DETAIL,$template_id, $info['id']); | 190 | $info['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_BLOG,BTemplate::IS_DETAIL,$template_id, $info['id']); |
| 192 | - | ||
| 193 | $this->response('success',Code::SUCCESS,$info); | 191 | $this->response('success',Code::SUCCESS,$info); |
| 194 | } | 192 | } |
| 195 | 193 |
| @@ -41,7 +41,7 @@ class NewsController extends BaseController | @@ -41,7 +41,7 @@ class NewsController extends BaseController | ||
| 41 | foreach ($lists['list'] as $k => $v){ | 41 | foreach ($lists['list'] as $k => $v){ |
| 42 | $v['category_name'] = $this->categoryName($v['category_id'],$data); | 42 | $v['category_name'] = $this->categoryName($v['category_id'],$data); |
| 43 | $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS,$v['id']); | 43 | $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS,$v['id']); |
| 44 | - $v['image_link'] = getImageUrl($v['image']); | 44 | + $v['image_link'] = getImageUrl($v['image'],$this->user['project_location'],$this->user['storage_type']); |
| 45 | $v['operator_name'] = $user->getName($v['operator_id']); | 45 | $v['operator_name'] = $user->getName($v['operator_id']); |
| 46 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_NEWS,BTemplate::IS_DETAIL,$template_id,$v['id']); | 46 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_NEWS,BTemplate::IS_DETAIL,$template_id,$v['id']); |
| 47 | $lists['list'][$k] = $v; | 47 | $lists['list'][$k] = $v; |
| @@ -175,10 +175,8 @@ class NewsController extends BaseController | @@ -175,10 +175,8 @@ class NewsController extends BaseController | ||
| 175 | 'id.required' => 'ID不能为空', | 175 | 'id.required' => 'ID不能为空', |
| 176 | ]); | 176 | ]); |
| 177 | $info = $newsLogic->newsInfo(); | 177 | $info = $newsLogic->newsInfo(); |
| 178 | - | ||
| 179 | $template_id = $this->getTemplateId(BTemplate::SOURCE_NEWS,BTemplate::IS_DETAIL);//获取模版id | 178 | $template_id = $this->getTemplateId(BTemplate::SOURCE_NEWS,BTemplate::IS_DETAIL);//获取模版id |
| 180 | $info['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_NEWS,BTemplate::IS_DETAIL,$template_id, $info['id']); | 179 | $info['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_NEWS,BTemplate::IS_DETAIL,$template_id, $info['id']); |
| 181 | - | ||
| 182 | $this->response('success',Code::SUCCESS,$info); | 180 | $this->response('success',Code::SUCCESS,$info); |
| 183 | } | 181 | } |
| 184 | 182 |
| @@ -41,7 +41,7 @@ class CategoryController extends BaseController | @@ -41,7 +41,7 @@ class CategoryController extends BaseController | ||
| 41 | foreach ($list as $k =>$v){ | 41 | foreach ($list as $k =>$v){ |
| 42 | $v['url'] = $this->user['domain'] . $v['route'].'/'; | 42 | $v['url'] = $this->user['domain'] . $v['route'].'/'; |
| 43 | $v['product_num'] = Category::getProductNum($v['id']); | 43 | $v['product_num'] = Category::getProductNum($v['id']); |
| 44 | - $v['image_link'] = getImageUrl($v['image']); | 44 | + $v['image_link'] = getImageUrl($v['image'],$this->user['project_location'],$this->user['storage_type']); |
| 45 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']); | 45 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']); |
| 46 | $list[$k] = $v; | 46 | $list[$k] = $v; |
| 47 | } | 47 | } |
| @@ -56,11 +56,12 @@ class ProductController extends BaseController | @@ -56,11 +56,12 @@ class ProductController extends BaseController | ||
| 56 | $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id | 56 | $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id |
| 57 | $userModel = new User(); | 57 | $userModel = new User(); |
| 58 | foreach ($lists['list'] as $k=>$v){ | 58 | foreach ($lists['list'] as $k=>$v){ |
| 59 | + $v['url'] = $this->user['domain'].$v['route'].'/'; | ||
| 59 | $v['category_id_text'] = $this->categoryName($v['category_id'],$cate_data); | 60 | $v['category_id_text'] = $this->categoryName($v['category_id'],$cate_data); |
| 60 | $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data); | 61 | $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data); |
| 61 | $v['created_uid_text'] = $userModel->getName($v['created_uid']); | 62 | $v['created_uid_text'] = $userModel->getName($v['created_uid']); |
| 62 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']); | 63 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']); |
| 63 | - $v['url'] = $this->user['domain'].$v['route'].'/'; | 64 | + $v = $this->getHandleFileImage($v); |
| 64 | $lists['list'][$k] = $v; | 65 | $lists['list'][$k] = $v; |
| 65 | } | 66 | } |
| 66 | } | 67 | } |
| @@ -68,7 +69,40 @@ class ProductController extends BaseController | @@ -68,7 +69,40 @@ class ProductController extends BaseController | ||
| 68 | } | 69 | } |
| 69 | 70 | ||
| 70 | /** | 71 | /** |
| 71 | - * @remark :处理列表返回参数 | 72 | + * @remark :获取时处理图片和文件 |
| 73 | + * @name :getHandleFileImage | ||
| 74 | + * @author :lyh | ||
| 75 | + * @method :post | ||
| 76 | + * @time :2024/1/23 17:43 | ||
| 77 | + */ | ||
| 78 | + public function getHandleFileImage($v){ | ||
| 79 | + //ToDo::处理图片及文件 | ||
| 80 | + if(!empty($v['thumb']) && !empty($v['thumb']['url'])){ | ||
| 81 | + $v['thumb']['url'] = getImageUrl($v['thumb']['url'],$this->user['project_location'],$this->user['storage_type']); | ||
| 82 | + } | ||
| 83 | + if(!empty($v['gallery'])){ | ||
| 84 | + foreach ($v['gallery'] as $gallery_k => $gallery_v){ | ||
| 85 | + $gallery_v['url'] = getImageUrl($gallery_v['url'],$this->user['project_location'],$this->user['storage_type']); | ||
| 86 | + $v['gallery'][$gallery_k] = $gallery_v; | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + if(!empty($v['icon'])){ | ||
| 90 | + foreach ($v['icon'] as $icon_k => $icon_v){ | ||
| 91 | + $icon_v = getImageUrl($icon_v,$this->user['project_location'],$this->user['storage_type']); | ||
| 92 | + $v['icon'][$icon_k] = $icon_v; | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | + if(!empty($v['video']) && !empty($v['video']['url'])){ | ||
| 96 | + $v['video']['url'] = getImageUrl($v['video']['url'],$this->user['project_location'],$this->user['storage_type']); | ||
| 97 | + } | ||
| 98 | + if(!empty($v['files']) && !empty($v['files']['url'])){ | ||
| 99 | + $v['files']['url'] = getImageUrl($v['files']['url'],$this->user['project_location'],$this->user['storage_type']); | ||
| 100 | + } | ||
| 101 | + return $this->success($v); | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + /** | ||
| 105 | + * @remark :搜索参数处理 | ||
| 72 | * @name :handleReturnParam | 106 | * @name :handleReturnParam |
| 73 | * @author :lyh | 107 | * @author :lyh |
| 74 | * @method :post | 108 | * @method :post |
| @@ -243,6 +277,8 @@ class ProductController extends BaseController | @@ -243,6 +277,8 @@ class ProductController extends BaseController | ||
| 243 | }else{ | 277 | }else{ |
| 244 | $v['status_text'] = ''; | 278 | $v['status_text'] = ''; |
| 245 | } | 279 | } |
| 280 | + //ToDo::处理图片及文件 | ||
| 281 | + $v = $this->getHandleFileImage($v); | ||
| 246 | $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL); | 282 | $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL); |
| 247 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id'] ?? 0); | 283 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id'] ?? 0); |
| 248 | $v['url'] = $this->user['domain'].$v['route']; | 284 | $v['url'] = $this->user['domain'].$v['route']; |
| @@ -251,6 +287,7 @@ class ProductController extends BaseController | @@ -251,6 +287,7 @@ class ProductController extends BaseController | ||
| 251 | return $v; | 287 | return $v; |
| 252 | } | 288 | } |
| 253 | 289 | ||
| 290 | + | ||
| 254 | /** | 291 | /** |
| 255 | * @remark :获取扩展字段详情 | 292 | * @remark :获取扩展字段详情 |
| 256 | * @name :getExtendInfo | 293 | * @name :getExtendInfo |
| @@ -293,7 +330,7 @@ class ProductController extends BaseController | @@ -293,7 +330,7 @@ class ProductController extends BaseController | ||
| 293 | $arr = json_decode($info['values']); | 330 | $arr = json_decode($info['values']); |
| 294 | foreach ($arr as $k1=>$v1){ | 331 | foreach ($arr as $k1=>$v1){ |
| 295 | $v1 = (array)$v1; | 332 | $v1 = (array)$v1; |
| 296 | - $v1['url'] = getImageUrl($v1['url']); | 333 | + $v1['url'] = getImageUrl($v1['url'],$this->user['project_location'],$this->user['storage_type']); |
| 297 | $arr[$k1] = $v1; | 334 | $arr[$k1] = $v1; |
| 298 | } | 335 | } |
| 299 | $v['values'] = $arr; | 336 | $v['values'] = $arr; |
| @@ -302,9 +339,9 @@ class ProductController extends BaseController | @@ -302,9 +339,9 @@ class ProductController extends BaseController | ||
| 302 | foreach ($arr1 as $k1=>$v1){ | 339 | foreach ($arr1 as $k1=>$v1){ |
| 303 | $v1 = (array)$v1; | 340 | $v1 = (array)$v1; |
| 304 | if(isset($v1['url'])){ | 341 | if(isset($v1['url'])){ |
| 305 | - $v1['url'] = getFileUrl($v1['url']); | 342 | + $v1['url'] = getFileUrl($v1['url'],$this->user['project_location'],$this->user['storage_type']); |
| 306 | }else{ | 343 | }else{ |
| 307 | - $v1 = getFileUrl($v1); | 344 | + $v1 = getFileUrl($v1,$this->user['project_location'],$this->user['storage_type']); |
| 308 | } | 345 | } |
| 309 | $arr1[$k1] = $v1; | 346 | $arr1[$k1] = $v1; |
| 310 | } | 347 | } |
| @@ -22,7 +22,7 @@ class BTemplateController extends BaseController | @@ -22,7 +22,7 @@ class BTemplateController extends BaseController | ||
| 22 | $lists = $BTemplateLogic->publicTemplateLists($this->map,$this->page,$this->row,$this->order); | 22 | $lists = $BTemplateLogic->publicTemplateLists($this->map,$this->page,$this->row,$this->order); |
| 23 | if(!empty($lists) && !empty($lists['list'])){ | 23 | if(!empty($lists) && !empty($lists['list'])){ |
| 24 | foreach ($lists['list'] as $k => &$v){ | 24 | foreach ($lists['list'] as $k => &$v){ |
| 25 | - $v['image_link'] = getImageUrl($v['image']); | 25 | + $v['image_link'] = getImageUrl($v['image'],$this->user['project_location'],$this->user['storage_type']); |
| 26 | $lists['list'][$k] = $v; | 26 | $lists['list'][$k] = $v; |
| 27 | } | 27 | } |
| 28 | } | 28 | } |
| @@ -335,7 +335,7 @@ class FileController | @@ -335,7 +335,7 @@ class FileController | ||
| 335 | $fileModel = new File(); | 335 | $fileModel = new File(); |
| 336 | $lists = $fileModel->list($this->map,'id',['id','hash','type','path','created_at','name']); | 336 | $lists = $fileModel->list($this->map,'id',['id','hash','type','path','created_at','name']); |
| 337 | foreach ($lists as $k => $v){ | 337 | foreach ($lists as $k => $v){ |
| 338 | - $v['file_link'] = getFileUrl($v['path']); | 338 | + $v['file_link'] = getFileUrl($v['path'],$this->cache['project_location'] ?? 1,$this->cache['storage_type'] ?? 0); |
| 339 | $lists[$k] = $v; | 339 | $lists[$k] = $v; |
| 340 | } | 340 | } |
| 341 | $this->response('success',Code::SUCCESS,$lists); | 341 | $this->response('success',Code::SUCCESS,$lists); |
| @@ -351,7 +351,7 @@ class FileController | @@ -351,7 +351,7 @@ class FileController | ||
| 351 | public function responseData($path, $name){ | 351 | public function responseData($path, $name){ |
| 352 | $data = [ | 352 | $data = [ |
| 353 | 'file'=>$path, | 353 | 'file'=>$path, |
| 354 | - 'file_link'=>getFileUrl($path,$this->upload_location), | 354 | + 'file_link'=>getFileUrl($path,$this->cache['project_location'] ?? 1,$this->cache['storage_type'] ?? 0), |
| 355 | 'name'=>$name, | 355 | 'name'=>$name, |
| 356 | 'file_download'=>url('a/download_files?path='.$path) | 356 | 'file_download'=>url('a/download_files?path='.$path) |
| 357 | ]; | 357 | ]; |
| @@ -359,7 +359,7 @@ class ImageController extends Controller | @@ -359,7 +359,7 @@ class ImageController extends Controller | ||
| 359 | $lists = $imageModel->lists($this->map,$this->page,$this->row); | 359 | $lists = $imageModel->lists($this->map,$this->page,$this->row); |
| 360 | if(!empty($lists) && !empty($lists['list'])){ | 360 | if(!empty($lists) && !empty($lists['list'])){ |
| 361 | foreach ($lists['list'] as $k => $v){ | 361 | foreach ($lists['list'] as $k => $v){ |
| 362 | - $v['image_link'] = getImageUrl($v['path']); | 362 | + $v['image_link'] = getImageUrl($v['path'],$this->cache['project_location'] ?? 1,$this->cache['storage_type'] ?? 0); |
| 363 | $lists['list'][$k] = $v; | 363 | $lists['list'][$k] = $v; |
| 364 | } | 364 | } |
| 365 | } | 365 | } |
| @@ -425,7 +425,7 @@ class ImageController extends Controller | @@ -425,7 +425,7 @@ class ImageController extends Controller | ||
| 425 | public function responseData($path = '', $name = ''){ | 425 | public function responseData($path = '', $name = ''){ |
| 426 | $data = [ | 426 | $data = [ |
| 427 | 'image'=>$path, | 427 | 'image'=>$path, |
| 428 | - 'image_link'=>getImageUrl($path), | 428 | + 'image_link'=>getImageUrl($path,$this->cache['project_location'] ?? 1,$this->cache['storage_type'] ?? 0), |
| 429 | 'name'=>$name, | 429 | 'name'=>$name, |
| 430 | 'image_download'=>url('a/download_images?path='.$path) | 430 | 'image_download'=>url('a/download_images?path='.$path) |
| 431 | ]; | 431 | ]; |
| @@ -101,7 +101,7 @@ class BlogLogic extends BaseLogic | @@ -101,7 +101,7 @@ class BlogLogic extends BaseLogic | ||
| 101 | //获取标签名称 | 101 | //获取标签名称 |
| 102 | $blogLabelLogic = new BlogLabelLogic(); | 102 | $blogLabelLogic = new BlogLabelLogic(); |
| 103 | $info['label_name'] = $blogLabelLogic->getLabelName($info['label_id']); | 103 | $info['label_name'] = $blogLabelLogic->getLabelName($info['label_id']); |
| 104 | - $info['image_link'] = getImageUrl($info['image']); | 104 | + $info['image_link'] = getImageUrl($info['image'],$this->user['project_location'],$this->user['storage_type']); |
| 105 | return $this->success($info); | 105 | return $this->success($info); |
| 106 | } | 106 | } |
| 107 | 107 |
| @@ -147,7 +147,7 @@ class NewsLogic extends BaseLogic | @@ -147,7 +147,7 @@ class NewsLogic extends BaseLogic | ||
| 147 | $this->fail('error'); | 147 | $this->fail('error'); |
| 148 | } | 148 | } |
| 149 | $info['category_id'] = explode(',',trim($info['category_id'],',')); | 149 | $info['category_id'] = explode(',',trim($info['category_id'],',')); |
| 150 | - $info['image_link'] = getImageUrl($info['image']); | 150 | + $info['image_link'] = getImageUrl($info['image'],$this->user['project_location'],$this->user['storage_type']); |
| 151 | return $this->success($info); | 151 | return $this->success($info); |
| 152 | } | 152 | } |
| 153 | 153 |
| @@ -102,51 +102,9 @@ class Product extends Base | @@ -102,51 +102,9 @@ class Product extends Base | ||
| 102 | 3=>'热销产品' | 102 | 3=>'热销产品' |
| 103 | ]; | 103 | ]; |
| 104 | 104 | ||
| 105 | - | ||
| 106 | - /** | ||
| 107 | - * 产品列表 | ||
| 108 | - * @param $map | ||
| 109 | - * @param $page | ||
| 110 | - * @param $row | ||
| 111 | - * @param string $order | ||
| 112 | - * @param string[] $fields | ||
| 113 | - * @param string $sort | ||
| 114 | - * @return array | ||
| 115 | - * @author zbj | ||
| 116 | - * @date 2023/10/17 | ||
| 117 | - */ | ||
| 118 | - public function product_lists($map, $page, $row, $order = 'id', $fields = ['*'], $sort = 'desc'): array | ||
| 119 | - { | ||
| 120 | - $category_id = $map['category_id'] ?? 0; | ||
| 121 | - $query = $this->where(function ($query) use ($category_id) { | ||
| 122 | - if ($category_id) { | ||
| 123 | - $category_ids = Category::getChildIdsArr($category_id); | ||
| 124 | - $query->whereIn('id', function ($subQuery) use ($category_ids) { | ||
| 125 | - $subQuery->select('product_id') | ||
| 126 | - ->from('gl_product_category_related') | ||
| 127 | - ->whereIn('cate_id', $category_ids) | ||
| 128 | - ->groupBy('product_id'); | ||
| 129 | - }); | ||
| 130 | - } | ||
| 131 | - }); | ||
| 132 | - unset($map['category_id']); | ||
| 133 | - $query = $this->formatQuery($map, $query); | ||
| 134 | - $query = $this->sortOrder($query,$order,$sort); | ||
| 135 | - $lists = $query->select($fields)->paginate($row, ['*'], 'page', $page); | ||
| 136 | - if (empty($lists)) { | ||
| 137 | - return []; | ||
| 138 | - } | ||
| 139 | - $lists = $lists->toArray(); | ||
| 140 | - return $lists; | ||
| 141 | - } | ||
| 142 | - | ||
| 143 | - | ||
| 144 | public function getThumbAttribute($value){ | 105 | public function getThumbAttribute($value){ |
| 145 | if(!empty($value)){ | 106 | if(!empty($value)){ |
| 146 | - $value = json_decode($value,true); | ||
| 147 | - if(!empty($value['url'])){ | ||
| 148 | - $value['url'] = getImageUrl($value['url']); | ||
| 149 | - } | 107 | + $value = Arr::s2a($value); |
| 150 | } | 108 | } |
| 151 | return $value; | 109 | return $value; |
| 152 | } | 110 | } |
| @@ -155,12 +113,6 @@ class Product extends Base | @@ -155,12 +113,6 @@ class Product extends Base | ||
| 155 | public function getGalleryAttribute($value){ | 113 | public function getGalleryAttribute($value){ |
| 156 | if(!empty($value)){ | 114 | if(!empty($value)){ |
| 157 | $value = Arr::s2a($value); | 115 | $value = Arr::s2a($value); |
| 158 | - foreach ($value as $k => $v){ | ||
| 159 | - if(!empty($v['url'])){ | ||
| 160 | - $v['url'] = getImageUrl($v['url']); | ||
| 161 | - } | ||
| 162 | - $value[$k] = $v; | ||
| 163 | - } | ||
| 164 | } | 116 | } |
| 165 | return $value; | 117 | return $value; |
| 166 | } | 118 | } |
| @@ -175,9 +127,6 @@ class Product extends Base | @@ -175,9 +127,6 @@ class Product extends Base | ||
| 175 | public function getFilesAttribute($value){ | 127 | public function getFilesAttribute($value){ |
| 176 | if(!empty($value)){ | 128 | if(!empty($value)){ |
| 177 | $value = Arr::s2a($value); | 129 | $value = Arr::s2a($value); |
| 178 | - if(!empty($value['url'])){ | ||
| 179 | - $value['url'] = getImageUrl($value['url']); | ||
| 180 | - } | ||
| 181 | } | 130 | } |
| 182 | return $value; | 131 | return $value; |
| 183 | } | 132 | } |
| @@ -192,10 +141,6 @@ class Product extends Base | @@ -192,10 +141,6 @@ class Product extends Base | ||
| 192 | public function getVideoAttribute($value){ | 141 | public function getVideoAttribute($value){ |
| 193 | if(!empty($value)){ | 142 | if(!empty($value)){ |
| 194 | $value = Arr::s2a($value); | 143 | $value = Arr::s2a($value); |
| 195 | - $value = Arr::s2a($value); | ||
| 196 | - if(!empty($value['url'])){ | ||
| 197 | - $value['url'] = getImageUrl($value['url']); | ||
| 198 | - } | ||
| 199 | } | 144 | } |
| 200 | return $value; | 145 | return $value; |
| 201 | } | 146 | } |
| @@ -210,10 +155,6 @@ class Product extends Base | @@ -210,10 +155,6 @@ class Product extends Base | ||
| 210 | public function getIconAttribute($value){ | 155 | public function getIconAttribute($value){ |
| 211 | if(!empty($value)){ | 156 | if(!empty($value)){ |
| 212 | $value = Arr::s2a($value); | 157 | $value = Arr::s2a($value); |
| 213 | - foreach ($value as $k => $v){ | ||
| 214 | - $v = getImageUrl($v); | ||
| 215 | - $value[$k] = $v; | ||
| 216 | - } | ||
| 217 | } | 158 | } |
| 218 | return $value; | 159 | return $value; |
| 219 | } | 160 | } |
-
请 注册 或 登录 后发表评论