合并分支 'develop' 到 'master'
Develop 查看合并请求 !381
正在显示
32 个修改的文件
包含
247 行增加
和
128 行删除
| @@ -471,11 +471,6 @@ if (!function_exists('getImageUrl')) { | @@ -471,11 +471,6 @@ if (!function_exists('getImageUrl')) { | ||
| 471 | if(substr($path,0,2) == '//'){ | 471 | if(substr($path,0,2) == '//'){ |
| 472 | return 'https:'.$path; | 472 | return 'https:'.$path; |
| 473 | } | 473 | } |
| 474 | -// $imageModel = new Image(); | ||
| 475 | -// $imageInfo = $imageModel->read(['path'=>$path],['is_cos']); | ||
| 476 | -// if($imageInfo === false){ | ||
| 477 | -// return ''; | ||
| 478 | -// } | ||
| 479 | if($location == 0){ | 474 | if($location == 0){ |
| 480 | $cos = config('filesystems.disks.cos'); | 475 | $cos = config('filesystems.disks.cos'); |
| 481 | $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1']; | 476 | $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1']; |
| @@ -514,11 +509,6 @@ if (!function_exists('getFileUrl')) { | @@ -514,11 +509,6 @@ if (!function_exists('getFileUrl')) { | ||
| 514 | if(substr($path,0,2) == '//'){ | 509 | if(substr($path,0,2) == '//'){ |
| 515 | return 'https:'.$path; | 510 | return 'https:'.$path; |
| 516 | } | 511 | } |
| 517 | -// $fileModel = new FileModel(); | ||
| 518 | -// $fileInfo = $fileModel->read(['path'=>$path],['is_cos']); | ||
| 519 | -// if($fileInfo === false){ | ||
| 520 | -// return ''; | ||
| 521 | -// } | ||
| 522 | if($location == 0){ | 512 | if($location == 0){ |
| 523 | $cos = config('filesystems.disks.cos'); | 513 | $cos = config('filesystems.disks.cos'); |
| 524 | $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1']; | 514 | $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1']; |
| @@ -217,7 +217,10 @@ class OptimizeController extends BaseController | @@ -217,7 +217,10 @@ class OptimizeController extends BaseController | ||
| 217 | $query = $query->whereBetween('gl_project_deploy_optimize.updated_at', $this->map['online_updated_at']); | 217 | $query = $query->whereBetween('gl_project_deploy_optimize.updated_at', $this->map['online_updated_at']); |
| 218 | } | 218 | } |
| 219 | if(isset($this->map['special'])){ | 219 | if(isset($this->map['special'])){ |
| 220 | - $query = $query->where('gl_project_deploy_optimize.special','like','%'.$this->map['special'].'%'); | 220 | + $query = $query->whereRaw("FIND_IN_SET(?, gl_project_deploy_optimize.special) > 0", [$this->map['special']]); |
| 221 | + } | ||
| 222 | + if(isset($this->map['is_remain_today'])){ | ||
| 223 | + $query = $query->where('gl_project.is_remain_today',$this->map['is_remain_today']); | ||
| 221 | } | 224 | } |
| 222 | if(isset($this->map['manager_mid']) && !empty($this->map['manager_mid'])){ | 225 | if(isset($this->map['manager_mid']) && !empty($this->map['manager_mid'])){ |
| 223 | $query = $query->where('gl_project_deploy_build.manager_mid','like','%'.$this->map['manager_mid'].'%'); | 226 | $query = $query->where('gl_project_deploy_build.manager_mid','like','%'.$this->map['manager_mid'].'%'); |
| @@ -26,7 +26,7 @@ class ATemplateController extends BaseController | @@ -26,7 +26,7 @@ class ATemplateController extends BaseController | ||
| 26 | */ | 26 | */ |
| 27 | public function lists(ATemplateLogic $aTemplateLogic){ | 27 | public function lists(ATemplateLogic $aTemplateLogic){ |
| 28 | $filed = ['id','name','image','url','status','sort','deleted_status','test_model','created_at','project_id']; | 28 | $filed = ['id','name','image','url','status','sort','deleted_status','test_model','created_at','project_id']; |
| 29 | - $this->map['project_id'] = 0; | 29 | + $this->map['test_model'] = 0; |
| 30 | $lists = $aTemplateLogic->aTemplateList($this->map,$this->page,$this->row,$this->order,$filed); | 30 | $lists = $aTemplateLogic->aTemplateList($this->map,$this->page,$this->row,$this->order,$filed); |
| 31 | if(!empty($lists) && !empty($lists['list'])){ | 31 | if(!empty($lists) && !empty($lists['list'])){ |
| 32 | foreach ($lists['list'] as $k => $v){ | 32 | foreach ($lists['list'] as $k => $v){ |
| @@ -25,8 +25,10 @@ class ATemplateModuleController extends BaseController | @@ -25,8 +25,10 @@ class ATemplateModuleController extends BaseController | ||
| 25 | * @time :2023/6/28 16:54 | 25 | * @time :2023/6/28 16:54 |
| 26 | */ | 26 | */ |
| 27 | public function lists(ATemplateModuleLogic $ATemplateModuleLogic){ | 27 | public function lists(ATemplateModuleLogic $ATemplateModuleLogic){ |
| 28 | - if(!isset($this->map['test_model'])){ | ||
| 29 | - $this->map['test_model'] = 0; | 28 | + if(isset($this->map['type']) && ($this->map['type'] == 99)){ |
| 29 | + $this->map['type'] = 99; | ||
| 30 | + }else{ | ||
| 31 | + $this->map['project_id'] = 0; | ||
| 30 | } | 32 | } |
| 31 | $lists = $ATemplateModuleLogic->aTemplateModuleLists($this->map,$this->page,$this->row,$this->order); | 33 | $lists = $ATemplateModuleLogic->aTemplateModuleLists($this->map,$this->page,$this->row,$this->order); |
| 32 | $this->response('success',Code::SUCCESS,$lists); | 34 | $this->response('success',Code::SUCCESS,$lists); |
| @@ -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'],$this->user['storage_type']); | 41 | + $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']); |
| 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; |
| @@ -37,7 +37,7 @@ class CustomModuleContentController extends BaseController | @@ -37,7 +37,7 @@ class CustomModuleContentController extends BaseController | ||
| 37 | $data = $this->getAllCategoryName(); | 37 | $data = $this->getAllCategoryName(); |
| 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['image_link'] = getImageUrl($v['image'],$this->user['storage_type']); | 40 | + $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']); |
| 41 | $v['operator_name'] = (new User())->getName($v['operator_id']); | 41 | $v['operator_name'] = (new User())->getName($v['operator_id']); |
| 42 | $lists['list'][$k] = $v; | 42 | $lists['list'][$k] = $v; |
| 43 | } | 43 | } |
| @@ -35,6 +35,7 @@ class NavController extends BaseController | @@ -35,6 +35,7 @@ class NavController extends BaseController | ||
| 35 | if(!empty($lists)){ | 35 | if(!empty($lists)){ |
| 36 | foreach ($lists as $v){ | 36 | foreach ($lists as $v){ |
| 37 | $v = (array)$v; | 37 | $v = (array)$v; |
| 38 | + $v = $this->handleReturnInfo($v); | ||
| 38 | if ($v['pid'] == 0) { | 39 | if ($v['pid'] == 0) { |
| 39 | $v['sub'] = _get_child($v['id'], $lists); | 40 | $v['sub'] = _get_child($v['id'], $lists); |
| 40 | $data[] = $v; | 41 | $data[] = $v; |
| @@ -52,6 +53,23 @@ class NavController extends BaseController | @@ -52,6 +53,23 @@ class NavController extends BaseController | ||
| 52 | } | 53 | } |
| 53 | 54 | ||
| 54 | /** | 55 | /** |
| 56 | + * @remark :单独处理图片文件 | ||
| 57 | + * @name :HandleReturnInfo | ||
| 58 | + * @author :lyh | ||
| 59 | + * @method :post | ||
| 60 | + * @time :2024/1/26 9:44 | ||
| 61 | + */ | ||
| 62 | + public function handleReturnInfo($param){ | ||
| 63 | + if(isset($param['image']) && !empty($param['image'])){ | ||
| 64 | + $param['image'] = getImageUrl($param['image'],$this->user['storage_type'],$this->user['project_location']); | ||
| 65 | + } | ||
| 66 | + if(isset($param['remark_image']) && !empty($param['remark_image'])){ | ||
| 67 | + $param['remark_image'] = getImageUrl($param['image'],$this->user['storage_type'],$this->user['project_location']); | ||
| 68 | + } | ||
| 69 | + return $this->success($param); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + /** | ||
| 55 | * @remark :根据固定的数组排序 | 73 | * @remark :根据固定的数组排序 |
| 56 | * @name :findDetailsInList | 74 | * @name :findDetailsInList |
| 57 | * @author :lyh | 75 | * @author :lyh |
| @@ -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'],$this->user['storage_type']); | 44 | + $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']); |
| 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; |
| @@ -299,4 +299,21 @@ class NewsController extends BaseController | @@ -299,4 +299,21 @@ class NewsController extends BaseController | ||
| 299 | $logic->batchSetCategory(); | 299 | $logic->batchSetCategory(); |
| 300 | $this->response('success'); | 300 | $this->response('success'); |
| 301 | } | 301 | } |
| 302 | + | ||
| 303 | + /** | ||
| 304 | + * @remark :Ai发布新闻 | ||
| 305 | + * @name :sendAiNews | ||
| 306 | + * @author :lyh | ||
| 307 | + * @method :post | ||
| 308 | + * @time :2024/1/26 15:33 | ||
| 309 | + */ | ||
| 310 | + public function sendAiNews(){ | ||
| 311 | + $this->request->validate([ | ||
| 312 | + 'keyword'=>'required', | ||
| 313 | + ],[ | ||
| 314 | + 'keyword.required' => 'keyword不能为空', | ||
| 315 | + ]); | ||
| 316 | + $data = http_get('http://gnews.globalso.com/gnews_news.php?keyword='.$this->param['keyword']); | ||
| 317 | + $this->response('success',Code::SUCCESS,$data); | ||
| 318 | + } | ||
| 302 | } | 319 | } |
| @@ -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'],$this->user['storage_type']); | 44 | + $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']); |
| 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 | } |
| @@ -43,6 +43,7 @@ class KeywordController extends BaseController | @@ -43,6 +43,7 @@ class KeywordController extends BaseController | ||
| 43 | }else{ | 43 | }else{ |
| 44 | $v['tdk'] = 0; | 44 | $v['tdk'] = 0; |
| 45 | } | 45 | } |
| 46 | + $v = $this->handleReturnInfo($v); | ||
| 46 | $v['url'] = $this->user['domain'] . $v['route'].'/'; | 47 | $v['url'] = $this->user['domain'] . $v['route'].'/'; |
| 47 | } | 48 | } |
| 48 | } | 49 | } |
| @@ -50,6 +51,23 @@ class KeywordController extends BaseController | @@ -50,6 +51,23 @@ class KeywordController extends BaseController | ||
| 50 | } | 51 | } |
| 51 | 52 | ||
| 52 | /** | 53 | /** |
| 54 | + * @remark :单独处理图片文件 | ||
| 55 | + * @name :HandleReturnInfo | ||
| 56 | + * @author :lyh | ||
| 57 | + * @method :post | ||
| 58 | + * @time :2024/1/26 9:44 | ||
| 59 | + */ | ||
| 60 | + public function handleReturnInfo($param){ | ||
| 61 | + if(isset($param['keyword_top_banner']) && !empty($param['keyword_top_banner'])){ | ||
| 62 | + $param['keyword_top_banner'] = getImageUrl($param['keyword_top_banner'],$this->user['storage_type'],$this->user['project_location']); | ||
| 63 | + } | ||
| 64 | + if(isset($param['keyword_foot_banner']) && !empty($param['keyword_foot_banner'])){ | ||
| 65 | + $param['keyword_foot_banner'] = getImageUrl($param['keyword_foot_banner'],$this->user['storage_type'],$this->user['project_location']); | ||
| 66 | + } | ||
| 67 | + return $this->success($param); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + /** | ||
| 53 | * @remark :搜索 | 71 | * @remark :搜索 |
| 54 | * @name :searchParam | 72 | * @name :searchParam |
| 55 | * @author :lyh | 73 | * @author :lyh |
| @@ -82,6 +100,9 @@ class KeywordController extends BaseController | @@ -82,6 +100,9 @@ class KeywordController extends BaseController | ||
| 82 | 'id.required' => 'ID不能为空' | 100 | 'id.required' => 'ID不能为空' |
| 83 | ]); | 101 | ]); |
| 84 | $data = $logic->getKeywordInfo(); | 102 | $data = $logic->getKeywordInfo(); |
| 103 | + if($data !== false){ | ||
| 104 | + $data = $this->handleReturnInfo($data); | ||
| 105 | + } | ||
| 85 | $this->response('success',Code::SUCCESS,$data); | 106 | $this->response('success',Code::SUCCESS,$data); |
| 86 | } | 107 | } |
| 87 | 108 |
| @@ -78,25 +78,25 @@ class ProductController extends BaseController | @@ -78,25 +78,25 @@ class ProductController extends BaseController | ||
| 78 | public function getHandleFileImage($v){ | 78 | public function getHandleFileImage($v){ |
| 79 | //ToDo::处理图片及文件 | 79 | //ToDo::处理图片及文件 |
| 80 | if(!empty($v['thumb']) && !empty($v['thumb']['url'])){ | 80 | if(!empty($v['thumb']) && !empty($v['thumb']['url'])){ |
| 81 | - $v['thumb']['url'] = getImageUrl($v['thumb']['url'],$this->user['storage_type'] ?? 0); | 81 | + $v['thumb']['url'] = getImageUrl($v['thumb']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']); |
| 82 | } | 82 | } |
| 83 | if(!empty($v['gallery'])){ | 83 | if(!empty($v['gallery'])){ |
| 84 | foreach ($v['gallery'] as $gallery_k => $gallery_v){ | 84 | foreach ($v['gallery'] as $gallery_k => $gallery_v){ |
| 85 | - $gallery_v['url'] = getImageUrl($gallery_v['url'],$this->user['storage_type'] ?? 0); | 85 | + $gallery_v['url'] = getImageUrl($gallery_v['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']); |
| 86 | $v['gallery'][$gallery_k] = $gallery_v; | 86 | $v['gallery'][$gallery_k] = $gallery_v; |
| 87 | } | 87 | } |
| 88 | } | 88 | } |
| 89 | if(!empty($v['icon'])){ | 89 | if(!empty($v['icon'])){ |
| 90 | foreach ($v['icon'] as $icon_k => $icon_v){ | 90 | foreach ($v['icon'] as $icon_k => $icon_v){ |
| 91 | - $icon_v = getImageUrl($icon_v,$this->user['storage_type'] ?? 0); | 91 | + $icon_v = getImageUrl($icon_v,$this->user['storage_type'] ?? 0,$this->user['project_location']); |
| 92 | $v['icon'][$icon_k] = $icon_v; | 92 | $v['icon'][$icon_k] = $icon_v; |
| 93 | } | 93 | } |
| 94 | } | 94 | } |
| 95 | if(!empty($v['video']) && !empty($v['video']['url'])){ | 95 | if(!empty($v['video']) && !empty($v['video']['url'])){ |
| 96 | - $v['video']['url'] = getImageUrl($v['video']['url'],$this->user['storage_type'] ?? 0); | 96 | + $v['video']['url'] = getImageUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']); |
| 97 | } | 97 | } |
| 98 | if(!empty($v['files']) && !empty($v['files']['url'])){ | 98 | if(!empty($v['files']) && !empty($v['files']['url'])){ |
| 99 | - $v['files']['url'] = getImageUrl($v['files']['url'],$this->user['storage_type'] ?? 0); | 99 | + $v['files']['url'] = getImageUrl($v['files']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']); |
| 100 | } | 100 | } |
| 101 | return $this->success($v); | 101 | return $this->success($v); |
| 102 | } | 102 | } |
| @@ -330,7 +330,7 @@ class ProductController extends BaseController | @@ -330,7 +330,7 @@ class ProductController extends BaseController | ||
| 330 | $arr = json_decode($info['values']); | 330 | $arr = json_decode($info['values']); |
| 331 | foreach ($arr as $k1=>$v1){ | 331 | foreach ($arr as $k1=>$v1){ |
| 332 | $v1 = (array)$v1; | 332 | $v1 = (array)$v1; |
| 333 | - $v1['url'] = getImageUrl($v1['url'],$this->user['storage_type']); | 333 | + $v1['url'] = getImageUrl($v1['url'],$this->user['storage_type'],$this->user['project_location']); |
| 334 | $arr[$k1] = $v1; | 334 | $arr[$k1] = $v1; |
| 335 | } | 335 | } |
| 336 | $v['values'] = $arr; | 336 | $v['values'] = $arr; |
| @@ -339,9 +339,9 @@ class ProductController extends BaseController | @@ -339,9 +339,9 @@ class ProductController extends BaseController | ||
| 339 | foreach ($arr1 as $k1=>$v1){ | 339 | foreach ($arr1 as $k1=>$v1){ |
| 340 | $v1 = (array)$v1; | 340 | $v1 = (array)$v1; |
| 341 | if(isset($v1['url'])){ | 341 | if(isset($v1['url'])){ |
| 342 | - $v1['url'] = getFileUrl($v1['url'],$this->user['storage_type']); | 342 | + $v1['url'] = getFileUrl($v1['url'],$this->user['storage_type'],$this->user['project_location']); |
| 343 | }else{ | 343 | }else{ |
| 344 | - $v1 = getFileUrl($v1,$this->user['storage_type']); | 344 | + $v1 = getFileUrl($v1,$this->user['storage_type'],$this->user['project_location']); |
| 345 | } | 345 | } |
| 346 | $arr1[$k1] = $v1; | 346 | $arr1[$k1] = $v1; |
| 347 | } | 347 | } |
| @@ -25,7 +25,7 @@ class WebSettingImageController extends BaseController | @@ -25,7 +25,7 @@ class WebSettingImageController extends BaseController | ||
| 25 | public function lists(WebSettingImage $webSettingImage){ | 25 | public function lists(WebSettingImage $webSettingImage){ |
| 26 | $list = $webSettingImage->list([],'id',['id','image','type']); | 26 | $list = $webSettingImage->list([],'id',['id','image','type']); |
| 27 | foreach ($list as $k=>$v){ | 27 | foreach ($list as $k=>$v){ |
| 28 | - $v['image'] = getImageUrl($v['image'],$this->user['storage_type']); | 28 | + $v['image'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']); |
| 29 | $list[$k] = $v; | 29 | $list[$k] = $v; |
| 30 | } | 30 | } |
| 31 | $this->response('success',Code::SUCCESS,$list); | 31 | $this->response('success',Code::SUCCESS,$list); |
| @@ -22,7 +22,7 @@ class WebSettingServiceController extends BaseController | @@ -22,7 +22,7 @@ class WebSettingServiceController extends BaseController | ||
| 22 | $lists = $webSettingServiceLogic->setting_service_list(); | 22 | $lists = $webSettingServiceLogic->setting_service_list(); |
| 23 | foreach ($lists as $k => $v){ | 23 | foreach ($lists as $k => $v){ |
| 24 | if($v['type'] == self::TYPE_CODE){ | 24 | if($v['type'] == self::TYPE_CODE){ |
| 25 | - $v['values_link'] = getImageUrl($v['values']); | 25 | + $v['values_link'] = getImageUrl($v['values'],$this->user['storage_type'],$this->user['project_location']); |
| 26 | $lists[$k] = $v; | 26 | $lists[$k] = $v; |
| 27 | } | 27 | } |
| 28 | } | 28 | } |
| @@ -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'],$this->user['storage_type']); | 25 | + $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']); |
| 26 | $lists['list'][$k] = $v; | 26 | $lists['list'][$k] = $v; |
| 27 | } | 27 | } |
| 28 | } | 28 | } |
| @@ -363,7 +363,7 @@ class ImageController extends Controller | @@ -363,7 +363,7 @@ class ImageController extends Controller | ||
| 363 | $lists = $imageModel->lists($this->map,$this->page,$this->row); | 363 | $lists = $imageModel->lists($this->map,$this->page,$this->row); |
| 364 | if(!empty($lists) && !empty($lists['list'])){ | 364 | if(!empty($lists) && !empty($lists['list'])){ |
| 365 | foreach ($lists['list'] as $k => $v){ | 365 | foreach ($lists['list'] as $k => $v){ |
| 366 | - $v['image_link'] = getImageUrl($v['path'],$this->cache['storage_type'] ?? 0); | 366 | + $v['image_link'] = getImageUrl($v['path'],$this->cache['storage_type'] ?? 0,$this->cache['project_location']); |
| 367 | $lists['list'][$k] = $v; | 367 | $lists['list'][$k] = $v; |
| 368 | } | 368 | } |
| 369 | } | 369 | } |
| @@ -429,7 +429,7 @@ class ImageController extends Controller | @@ -429,7 +429,7 @@ class ImageController extends Controller | ||
| 429 | public function responseData($path = '', $name = ''){ | 429 | public function responseData($path = '', $name = ''){ |
| 430 | $data = [ | 430 | $data = [ |
| 431 | 'image'=>$path, | 431 | 'image'=>$path, |
| 432 | - 'image_link'=>getImageUrl($path,$this->cache['storage_type'] ?? 0), | 432 | + 'image_link'=>getImageUrl($path,$this->cache['storage_type'] ?? 0,$this->cache['project_location'] ?? 0), |
| 433 | 'name'=>$name, | 433 | 'name'=>$name, |
| 434 | 'image_download'=>url('a/download_images?path='.$path) | 434 | 'image_download'=>url('a/download_images?path='.$path) |
| 435 | ]; | 435 | ]; |
| @@ -3,8 +3,10 @@ | @@ -3,8 +3,10 @@ | ||
| 3 | namespace App\Http\Logic\Aside\Project; | 3 | namespace App\Http\Logic\Aside\Project; |
| 4 | 4 | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | +use App\Events\CopyImageFile; | ||
| 6 | use App\Events\CopyProject; | 7 | use App\Events\CopyProject; |
| 7 | use App\Exceptions\AsideGlobalException; | 8 | use App\Exceptions\AsideGlobalException; |
| 9 | +use App\Jobs\CopyImageFileJob; | ||
| 8 | use App\Models\Com\NoticeLog; | 10 | use App\Models\Com\NoticeLog; |
| 9 | use App\Models\Com\UpdateLog; | 11 | use App\Models\Com\UpdateLog; |
| 10 | use App\Models\Devops\ServerConfig; | 12 | use App\Models\Devops\ServerConfig; |
| @@ -128,8 +130,8 @@ class ProjectLogic extends BaseLogic | @@ -128,8 +130,8 @@ class ProjectLogic extends BaseLogic | ||
| 128 | * @time :2023/8/30 11:57 | 130 | * @time :2023/8/30 11:57 |
| 129 | */ | 131 | */ |
| 130 | public function projectSave(){ | 132 | public function projectSave(){ |
| 131 | - DB::beginTransaction(); | ||
| 132 | - try { | 133 | +// DB::beginTransaction(); |
| 134 | +// try { | ||
| 133 | if($this->param['type'] == Project::TYPE_SEVEN){ | 135 | if($this->param['type'] == Project::TYPE_SEVEN){ |
| 134 | //错误单直接返回,单独处理 | 136 | //错误单直接返回,单独处理 |
| 135 | $this->setTypeSevenEdit($this->param); | 137 | $this->setTypeSevenEdit($this->param); |
| @@ -149,19 +151,26 @@ class ProjectLogic extends BaseLogic | @@ -149,19 +151,26 @@ class ProjectLogic extends BaseLogic | ||
| 149 | //保存询盘过滤配置 | 151 | //保存询盘过滤配置 |
| 150 | // $this->param['inquiry_filter_config']['project_id'] = $this->param['id']; | 152 | // $this->param['inquiry_filter_config']['project_id'] = $this->param['id']; |
| 151 | // $this->saveInquiryFilterConfig($this->param['inquiry_filter_config']); | 153 | // $this->saveInquiryFilterConfig($this->param['inquiry_filter_config']); |
| 152 | - | 154 | + $this->syncImageFile($this->param['project_location'],$this->param['id']); |
| 153 | //创建站点 | 155 | //创建站点 |
| 154 | // $this->createSite($this->param); | 156 | // $this->createSite($this->param); |
| 155 | } | 157 | } |
| 156 | - DB::commit(); | ||
| 157 | - }catch (\Exception $e){ | ||
| 158 | - DB::rollBack(); | ||
| 159 | - $this->fail('保存失败,请联系管理员'); | ||
| 160 | - } | 158 | +// DB::commit(); |
| 159 | +// }catch (\Exception $e){ | ||
| 160 | +// DB::rollBack(); | ||
| 161 | +// $this->fail('保存失败,请联系管理员'); | ||
| 162 | +// } | ||
| 161 | (new SyncService())->projectAcceptAddress($this->param['id']); | 163 | (new SyncService())->projectAcceptAddress($this->param['id']); |
| 162 | return $this->success(); | 164 | return $this->success(); |
| 163 | } | 165 | } |
| 164 | 166 | ||
| 167 | + public function syncImageFile($location,$project_id){ | ||
| 168 | + if($location == 1){ | ||
| 169 | + CopyImageFileJob::dispatch(['project_id'=>$project_id]); | ||
| 170 | + } | ||
| 171 | + return $this->success(); | ||
| 172 | + } | ||
| 173 | + | ||
| 165 | /** | 174 | /** |
| 166 | * @remark :保存项目 | 175 | * @remark :保存项目 |
| 167 | * @name :setExtendType | 176 | * @name :setExtendType |
| @@ -330,7 +339,7 @@ class ProjectLogic extends BaseLogic | @@ -330,7 +339,7 @@ class ProjectLogic extends BaseLogic | ||
| 330 | $config['filter_mobiles'] = Arr::a2s(!empty($config['filter_mobiles']) ? $config['filter_mobiles'] : []); | 339 | $config['filter_mobiles'] = Arr::a2s(!empty($config['filter_mobiles']) ? $config['filter_mobiles'] : []); |
| 331 | $config['filter_names'] = Arr::a2s(!empty($config['filter_names']) ? $config['filter_names'] : []); | 340 | $config['filter_names'] = Arr::a2s(!empty($config['filter_names']) ? $config['filter_names'] : []); |
| 332 | $config['black_ips'] = $config['black_ips'] ?? ''; | 341 | $config['black_ips'] = $config['black_ips'] ?? ''; |
| 333 | - | 342 | + |
| 334 | $model = InquiryFilterConfig::where('project_id', $config['project_id'])->first(); | 343 | $model = InquiryFilterConfig::where('project_id', $config['project_id'])->first(); |
| 335 | if(!$model){ | 344 | if(!$model){ |
| 336 | $model = new InquiryFilterConfig(); | 345 | $model = new InquiryFilterConfig(); |
| @@ -64,12 +64,12 @@ class AyrReleaseLogic extends BaseLogic | @@ -64,12 +64,12 @@ class AyrReleaseLogic extends BaseLogic | ||
| 64 | $imageModel = new Image(); | 64 | $imageModel = new Image(); |
| 65 | $list = $imageModel->list(['path'=>['in',$images]],'id'); | 65 | $list = $imageModel->list(['path'=>['in',$images]],'id'); |
| 66 | foreach ($list as $v1){ | 66 | foreach ($list as $v1){ |
| 67 | - $arr[] = getImageUrl($v1['path']); | 67 | + $arr[] = getImageUrl($v1['path'],$this->user['storage_type'],$this->user['project_location']); |
| 68 | } | 68 | } |
| 69 | }else{ | 69 | }else{ |
| 70 | $fileModel = new File(); | 70 | $fileModel = new File(); |
| 71 | $info = $fileModel->read(['path'=>$v]); | 71 | $info = $fileModel->read(['path'=>$v]); |
| 72 | - $arr[] = getFileUrl($info['path']); | 72 | + $arr[] = getFileUrl($info['path'],$this->user['storage_type'],$this->user['project_location']); |
| 73 | } | 73 | } |
| 74 | } | 74 | } |
| 75 | return $this->success($arr); | 75 | return $this->success($arr); |
| @@ -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'],$this->user['storage_type']); | 104 | + $info['image_link'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']); |
| 105 | return $this->success($info); | 105 | return $this->success($info); |
| 106 | } | 106 | } |
| 107 | 107 |
| @@ -82,7 +82,7 @@ class CustomModuleCategoryLogic extends BaseLogic | @@ -82,7 +82,7 @@ class CustomModuleCategoryLogic extends BaseLogic | ||
| 82 | if($info === false){ | 82 | if($info === false){ |
| 83 | $this->fail('当前数据不存在或已被删除'); | 83 | $this->fail('当前数据不存在或已被删除'); |
| 84 | } | 84 | } |
| 85 | - $info['image'] = getImageUrl($info['image']); | 85 | + $info['image'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']); |
| 86 | return $this->success($info); | 86 | return $this->success($info); |
| 87 | } | 87 | } |
| 88 | 88 |
| @@ -39,7 +39,7 @@ class CustomModuleContentLogic extends BaseLogic | @@ -39,7 +39,7 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 39 | if($info === false){ | 39 | if($info === false){ |
| 40 | $this->fail('当前数据不存在或已被删除'); | 40 | $this->fail('当前数据不存在或已被删除'); |
| 41 | } | 41 | } |
| 42 | - $info['image'] = getImageUrl($info['image'],$this->user['storage_type']); | 42 | + $info['image'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']); |
| 43 | $info['extend'] = $this->getExtendInfo($info['module_id'],$info['id']); | 43 | $info['extend'] = $this->getExtendInfo($info['module_id'],$info['id']); |
| 44 | return $this->success($info); | 44 | return $this->success($info); |
| 45 | } | 45 | } |
| @@ -86,14 +86,14 @@ class CustomModuleContentLogic extends BaseLogic | @@ -86,14 +86,14 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 86 | $arr = json_decode($info['values']); | 86 | $arr = json_decode($info['values']); |
| 87 | foreach ($arr as $k1=>$v1){ | 87 | foreach ($arr as $k1=>$v1){ |
| 88 | $v1 = (array)$v1; | 88 | $v1 = (array)$v1; |
| 89 | - $v1['url'] = getImageUrl($v1['url'],$this->user['storage_type']); | 89 | + $v1['url'] = getImageUrl($v1['url'],$this->user['storage_type'],$this->user['project_location']); |
| 90 | $arr[$k1] = $v1; | 90 | $arr[$k1] = $v1; |
| 91 | } | 91 | } |
| 92 | $v['values'] = $arr; | 92 | $v['values'] = $arr; |
| 93 | }elseif($v['type'] == 4){ | 93 | }elseif($v['type'] == 4){ |
| 94 | $arr1 = json_decode($info['values']); | 94 | $arr1 = json_decode($info['values']); |
| 95 | foreach ($arr1 as $k1=>$v1){ | 95 | foreach ($arr1 as $k1=>$v1){ |
| 96 | - $v1 = getFileUrl($v1,$this->user['storage_type']); | 96 | + $v1 = getFileUrl($v1,$this->user['storage_type'],$this->user['project_location']); |
| 97 | $arr1[$k1] = $v1; | 97 | $arr1[$k1] = $v1; |
| 98 | } | 98 | } |
| 99 | $v['values'] = $arr1; | 99 | $v['values'] = $arr1; |
| @@ -97,7 +97,7 @@ class InquiryLogic extends BaseLogic | @@ -97,7 +97,7 @@ class InquiryLogic extends BaseLogic | ||
| 97 | foreach ($data['list'] as &$v){ | 97 | foreach ($data['list'] as &$v){ |
| 98 | foreach ($v['data'] as &$field){ | 98 | foreach ($v['data'] as &$field){ |
| 99 | if(is_array($field) && !empty($field['path'])){ | 99 | if(is_array($field) && !empty($field['path'])){ |
| 100 | - $field['path'] = getImageUrl($field['path']); | 100 | + $field['path'] = getImageUrl($field['path'],$this->user['storage_type'],$this->user['project_location']); |
| 101 | } | 101 | } |
| 102 | } | 102 | } |
| 103 | $v = array_merge($v, $v['data']); | 103 | $v = array_merge($v, $v['data']); |
| @@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
| 3 | namespace App\Http\Logic\Bside\News; | 3 | namespace App\Http\Logic\Bside\News; |
| 4 | 4 | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | +use App\Helper\Arr; | ||
| 6 | use App\Http\Logic\Bside\BaseLogic; | 7 | use App\Http\Logic\Bside\BaseLogic; |
| 7 | use App\Models\News\News; | 8 | use App\Models\News\News; |
| 8 | use App\Models\News\NewsCategory; | 9 | use App\Models\News\NewsCategory; |
| @@ -147,7 +148,7 @@ class NewsLogic extends BaseLogic | @@ -147,7 +148,7 @@ class NewsLogic extends BaseLogic | ||
| 147 | $this->fail('error'); | 148 | $this->fail('error'); |
| 148 | } | 149 | } |
| 149 | $info['category_id'] = explode(',',trim($info['category_id'],',')); | 150 | $info['category_id'] = explode(',',trim($info['category_id'],',')); |
| 150 | - $info['image_link'] = getImageUrl($info['image'],$this->user['storage_type']); | 151 | + $info['image_link'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']); |
| 151 | return $this->success($info); | 152 | return $this->success($info); |
| 152 | } | 153 | } |
| 153 | 154 | ||
| @@ -181,6 +182,9 @@ class NewsLogic extends BaseLogic | @@ -181,6 +182,9 @@ class NewsLogic extends BaseLogic | ||
| 181 | */ | 182 | */ |
| 182 | public function paramProcessing($param) | 183 | public function paramProcessing($param) |
| 183 | { | 184 | { |
| 185 | + if(isset($param['image'])){ | ||
| 186 | + $param['image'] = str_replace_url($param['image'] ?? ''); | ||
| 187 | + } | ||
| 184 | if(isset($this->param['id'])){ | 188 | if(isset($this->param['id'])){ |
| 185 | $param['operator_id'] = $this->user['id']; | 189 | $param['operator_id'] = $this->user['id']; |
| 186 | if(isset($param['category_id']) && !empty($param['category_id'])){ | 190 | if(isset($param['category_id']) && !empty($param['category_id'])){ |
| @@ -32,7 +32,7 @@ class CategoryLogic extends BaseLogic | @@ -32,7 +32,7 @@ class CategoryLogic extends BaseLogic | ||
| 32 | foreach ($data as &$v){ | 32 | foreach ($data as &$v){ |
| 33 | $v['url'] = $this->user['domain'] . $v['route'] ; | 33 | $v['url'] = $this->user['domain'] . $v['route'] ; |
| 34 | $v['product_num'] = Category::getProductNum($v['id']); | 34 | $v['product_num'] = Category::getProductNum($v['id']); |
| 35 | - $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type']); | 35 | + $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']); |
| 36 | } | 36 | } |
| 37 | if(!$map){ | 37 | if(!$map){ |
| 38 | $data = Arr::listToTree($data); | 38 | $data = Arr::listToTree($data); |
| @@ -100,8 +100,8 @@ class CategoryLogic extends BaseLogic | @@ -100,8 +100,8 @@ class CategoryLogic extends BaseLogic | ||
| 100 | if($info === false){ | 100 | if($info === false){ |
| 101 | $this->fail('当前数据不存在或者已被删除'); | 101 | $this->fail('当前数据不存在或者已被删除'); |
| 102 | } | 102 | } |
| 103 | - $info['image_link'] = getImageUrl($info['image']); | ||
| 104 | - $info['describe_image'] = !empty($info['describe_image']) ? getImageUrl(json_decode($info['describe_image'])) : []; | 103 | + $info['image_link'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']); |
| 104 | + $info['describe_image'] = !empty($info['describe_image']) ? getImageUrl(json_decode($info['describe_image']),$this->user['storage_type'],$this->user['project_location']) : []; | ||
| 105 | return $this->success($info); | 105 | return $this->success($info); |
| 106 | } | 106 | } |
| 107 | 107 |
| @@ -40,8 +40,10 @@ class KeywordLogic extends BaseLogic | @@ -40,8 +40,10 @@ class KeywordLogic extends BaseLogic | ||
| 40 | public function getKeywordInfo() | 40 | public function getKeywordInfo() |
| 41 | { | 41 | { |
| 42 | $info = $this->model->read($this->param); | 42 | $info = $this->model->read($this->param); |
| 43 | - $info['url'] = $this->user['domain'] . $info['route']; | ||
| 44 | - $info['related_news_info'] = News::whereIn('id', $info['related_news_ids'])->select(['id', 'name'])->get(); | 43 | + if($info !== false){ |
| 44 | + $info['url'] = $this->user['domain'] . $info['route']; | ||
| 45 | + $info['related_news_info'] = News::whereIn('id', $info['related_news_ids'])->select(['id', 'name'])->get(); | ||
| 46 | + } | ||
| 45 | return $this->success($info); | 47 | return $this->success($info); |
| 46 | } | 48 | } |
| 47 | 49 | ||
| @@ -103,30 +105,20 @@ class KeywordLogic extends BaseLogic | @@ -103,30 +105,20 @@ class KeywordLogic extends BaseLogic | ||
| 103 | * @time :2023/10/23 14:47 | 105 | * @time :2023/10/23 14:47 |
| 104 | */ | 106 | */ |
| 105 | public function handleSaveParam($param){ | 107 | public function handleSaveParam($param){ |
| 106 | - if(isset($param['keyword_top_banner']) && !empty($param['keyword_top_banner'])){ | ||
| 107 | - $param['keyword_top_banner'] = str_replace_url($param['keyword_top_banner']); | ||
| 108 | - }else{ | ||
| 109 | - unset($param['keyword_top_banner']); | 108 | + if(isset($param['keyword_top_banner'])){ |
| 109 | + $param['keyword_top_banner'] = str_replace_url($param['keyword_top_banner'] ?? []); | ||
| 110 | } | 110 | } |
| 111 | - if(isset($param['keyword_foot_banner']) && !empty($param['keyword_foot_banner'])){ | ||
| 112 | - $param['keyword_foot_banner'] = str_replace_url($param['keyword_foot_banner']); | ||
| 113 | - }else{ | ||
| 114 | - unset($param['keyword_foot_banner']); | 111 | + if(isset($param['keyword_foot_banner'])){ |
| 112 | + $param['keyword_foot_banner'] = str_replace_url($param['keyword_foot_banner'] ?? []); | ||
| 115 | } | 113 | } |
| 116 | - if(isset($param['keyword_video']) && !empty($param['keyword_video'])){ | ||
| 117 | - $param['keyword_video'] = Arr::a2s($param['keyword_video']); | ||
| 118 | - }else{ | ||
| 119 | - unset($param['keyword_video']); | 114 | + if(isset($param['keyword_video'])){ |
| 115 | + $param['keyword_video'] = Arr::a2s($param['keyword_video'] ?? []); | ||
| 120 | } | 116 | } |
| 121 | if(!empty($param['related_news_ids'])){ | 117 | if(!empty($param['related_news_ids'])){ |
| 122 | - $param['related_news_ids'] = Arr::arrToSet($param['related_news_ids']); | ||
| 123 | - }else{ | ||
| 124 | - unset($param['related_news_ids']); | 118 | + $param['related_news_ids'] = Arr::arrToSet($param['related_news_ids'] ?? []); |
| 125 | } | 119 | } |
| 126 | if(!empty($param['related_blog_ids'])){ | 120 | if(!empty($param['related_blog_ids'])){ |
| 127 | - $param['related_blog_ids'] = Arr::arrToSet($param['related_blog_ids']); | ||
| 128 | - }else{ | ||
| 129 | - unset($param['related_blog_ids']); | 121 | + $param['related_blog_ids'] = Arr::arrToSet($param['related_blog_ids'] ?? []); |
| 130 | } | 122 | } |
| 131 | return $param; | 123 | return $param; |
| 132 | } | 124 | } |
| @@ -28,11 +28,11 @@ class WebSettingAmpLogic extends BaseLogic | @@ -28,11 +28,11 @@ class WebSettingAmpLogic extends BaseLogic | ||
| 28 | return $this->success(); | 28 | return $this->success(); |
| 29 | } | 29 | } |
| 30 | //log图处理 | 30 | //log图处理 |
| 31 | - $info['top_logo'] = getImageUrl($info['top_logo'], $this->user['storage_type'] ?? 0); | 31 | + $info['top_logo'] = getImageUrl($info['top_logo'],$this->user['storage_type'],$this->user['project_location']); |
| 32 | //banner处理 | 32 | //banner处理 |
| 33 | if (!empty($info['index_banner'])) { | 33 | if (!empty($info['index_banner'])) { |
| 34 | foreach ($info['index_banner'] as &$v) { | 34 | foreach ($info['index_banner'] as &$v) { |
| 35 | - $v = getImageUrl($v, $this->user['storage_type'] ?? 0); | 35 | + $v = getImageUrl($v,$this->user['storage_type'],$this->user['project_location']); |
| 36 | } | 36 | } |
| 37 | } | 37 | } |
| 38 | return $this->success($info); | 38 | return $this->success($info); |
app/Jobs/CopyImageFileJob.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Jobs; | ||
| 4 | + | ||
| 5 | +use App\Events\CopyImageFile; | ||
| 6 | +use App\Models\File\File as FileModel; | ||
| 7 | +use App\Models\File\Image as ImageModel; | ||
| 8 | +use App\Services\AmazonS3Service; | ||
| 9 | +use Illuminate\Bus\Queueable; | ||
| 10 | +use Illuminate\Contracts\Queue\ShouldQueue; | ||
| 11 | +use Illuminate\Foundation\Bus\Dispatchable; | ||
| 12 | +use Illuminate\Queue\InteractsWithQueue; | ||
| 13 | +use Illuminate\Queue\SerializesModels; | ||
| 14 | + | ||
| 15 | +class CopyImageFileJob implements ShouldQueue | ||
| 16 | +{ | ||
| 17 | + use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; | ||
| 18 | + public $tries = 3; // 可配置任务重试次数 | ||
| 19 | + | ||
| 20 | + protected $param; | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * Create a new job instance. | ||
| 24 | + * | ||
| 25 | + * @param CopyImageFile $event | ||
| 26 | + * @return void | ||
| 27 | + */ | ||
| 28 | + public function __construct($data) | ||
| 29 | + { | ||
| 30 | + $this->param = $data; | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * Execute the job. | ||
| 35 | + * | ||
| 36 | + * @return void | ||
| 37 | + */ | ||
| 38 | + public function handle() | ||
| 39 | + { | ||
| 40 | + $imageModel = new ImageModel(); | ||
| 41 | + //获取当前项目的所有图片 | ||
| 42 | + $imageList = $imageModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','size']); | ||
| 43 | + if(!empty($imageList)){ | ||
| 44 | + $amazonS3Service = new AmazonS3Service(); | ||
| 45 | + foreach ($imageList as $k => $v){ | ||
| 46 | + $amazonS3Service->syncImageFiles(getImageUrl($v['path'])); | ||
| 47 | + $imageModel->edit(['is_cos'=>0],['id'=>$v['id']]); | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + $fileModel = new FileModel(); | ||
| 52 | + $fileList = $fileModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos']); | ||
| 53 | + if(!empty($fileList)){ | ||
| 54 | + $amazonS3Service = new AmazonS3Service(); | ||
| 55 | + foreach ($fileList as $k => $v){ | ||
| 56 | + $amazonS3Service->syncImageFiles(getImageUrl($v['path'])); | ||
| 57 | + $fileModel->edit(['is_cos'=>0],['id'=>$v['id']]); | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + return true; | ||
| 61 | + } | ||
| 62 | +} |
| @@ -65,31 +65,31 @@ class BNav extends Base | @@ -65,31 +65,31 @@ class BNav extends Base | ||
| 65 | return static::where(['pid'=>$id,'project_id'=>$project_id])->limit(1)->count(); | 65 | return static::where(['pid'=>$id,'project_id'=>$project_id])->limit(1)->count(); |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | - /** | ||
| 69 | - * @remark :获取图片 | ||
| 70 | - * @name :getImageAttribute | ||
| 71 | - * @author :lyh | ||
| 72 | - * @method :post | ||
| 73 | - * @time :2023/9/18 16:20 | ||
| 74 | - */ | ||
| 75 | - public function getImageAttribute($value) | ||
| 76 | - { | ||
| 77 | - $value = getImageUrl($value); | ||
| 78 | - return $value; | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | - /** | ||
| 82 | - * @remark :获取图片 | ||
| 83 | - * @name :getImageAttribute | ||
| 84 | - * @author :lyh | ||
| 85 | - * @method :post | ||
| 86 | - * @time :2023/9/18 16:20 | ||
| 87 | - */ | ||
| 88 | - public function getRemarkImageAttribute($value) | ||
| 89 | - { | ||
| 90 | - $value = getImageUrl($value); | ||
| 91 | - return $value; | ||
| 92 | - } | 68 | +// /** |
| 69 | +// * @remark :获取图片 | ||
| 70 | +// * @name :getImageAttribute | ||
| 71 | +// * @author :lyh | ||
| 72 | +// * @method :post | ||
| 73 | +// * @time :2023/9/18 16:20 | ||
| 74 | +// */ | ||
| 75 | +// public function getImageAttribute($value) | ||
| 76 | +// { | ||
| 77 | +// $value = getImageUrl($value); | ||
| 78 | +// return $value; | ||
| 79 | +// } | ||
| 80 | +// | ||
| 81 | +// /** | ||
| 82 | +// * @remark :获取图片 | ||
| 83 | +// * @name :getImageAttribute | ||
| 84 | +// * @author :lyh | ||
| 85 | +// * @method :post | ||
| 86 | +// * @time :2023/9/18 16:20 | ||
| 87 | +// */ | ||
| 88 | +// public function getRemarkImageAttribute($value) | ||
| 89 | +// { | ||
| 90 | +// $value = getImageUrl($value); | ||
| 91 | +// return $value; | ||
| 92 | +// } | ||
| 93 | 93 | ||
| 94 | /** | 94 | /** |
| 95 | * 是否支持一键导入 | 95 | * 是否支持一键导入 |
| @@ -13,35 +13,8 @@ class Keyword extends Base | @@ -13,35 +13,8 @@ class Keyword extends Base | ||
| 13 | //设置关联表名 | 13 | //设置关联表名 |
| 14 | protected $table = 'gl_product_keyword'; | 14 | protected $table = 'gl_product_keyword'; |
| 15 | 15 | ||
| 16 | -// protected $appends = ['route']; | ||
| 17 | - | ||
| 18 | //连接数据库 | 16 | //连接数据库 |
| 19 | protected $connection = 'custom_mysql'; | 17 | protected $connection = 'custom_mysql'; |
| 20 | -// public function getRouteAttribute(){ | ||
| 21 | -// return RouteMap::getRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $this->id, $this->project_id); | ||
| 22 | -// } | ||
| 23 | - | ||
| 24 | - /** | ||
| 25 | - * @remark :图 | ||
| 26 | - * @name :getKeywordTopBannerAttribute | ||
| 27 | - * @author :lyh | ||
| 28 | - * @method :post | ||
| 29 | - * @time :2023/7/21 11:11 | ||
| 30 | - */ | ||
| 31 | - public function getKeywordTopBannerAttribute($value){ | ||
| 32 | - return getImageUrl($value); | ||
| 33 | - } | ||
| 34 | - | ||
| 35 | - /** | ||
| 36 | - * @remark :图 | ||
| 37 | - * @name :getKeywordTopBannerAttribute | ||
| 38 | - * @author :lyh | ||
| 39 | - * @method :post | ||
| 40 | - * @time :2023/7/21 11:11 | ||
| 41 | - */ | ||
| 42 | - public function getKeywordFootBannerAttribute($value){ | ||
| 43 | - return getImageUrl($value); | ||
| 44 | - } | ||
| 45 | 18 | ||
| 46 | /** | 19 | /** |
| 47 | * @remark :视频 | 20 | * @remark :视频 |
| @@ -2,12 +2,13 @@ | @@ -2,12 +2,13 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Providers; | 3 | namespace App\Providers; |
| 4 | 4 | ||
| 5 | +use App\Events\CopyImageFile; | ||
| 5 | use App\Events\CopyProject; | 6 | use App\Events\CopyProject; |
| 7 | +use App\Listeners\CopyImageFileListener; | ||
| 6 | use App\Listeners\CopyProjectListener; | 8 | use App\Listeners\CopyProjectListener; |
| 7 | use Illuminate\Auth\Events\Registered; | 9 | use Illuminate\Auth\Events\Registered; |
| 8 | use Illuminate\Auth\Listeners\SendEmailVerificationNotification; | 10 | use Illuminate\Auth\Listeners\SendEmailVerificationNotification; |
| 9 | use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; | 11 | use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; |
| 10 | -use Illuminate\Support\Facades\Event; | ||
| 11 | 12 | ||
| 12 | class EventServiceProvider extends ServiceProvider | 13 | class EventServiceProvider extends ServiceProvider |
| 13 | { | 14 | { |
| @@ -56,4 +56,30 @@ class AmazonS3Service | @@ -56,4 +56,30 @@ class AmazonS3Service | ||
| 56 | return false; | 56 | return false; |
| 57 | } | 57 | } |
| 58 | } | 58 | } |
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * @remark :同步图片文件到亚马逊 | ||
| 62 | + * @name :uploadImage | ||
| 63 | + * @author :lyh | ||
| 64 | + * @method :post | ||
| 65 | + * @time :2024/1/23 9:20 | ||
| 66 | + */ | ||
| 67 | + public function syncImageFiles($files) | ||
| 68 | + { | ||
| 69 | + $file_content = curl_c($files,false); | ||
| 70 | + @file_put_contents(storage_path('logs/lyh_error.log'), var_export($file_content, true) . PHP_EOL, FILE_APPEND); | ||
| 71 | + $key = str_replace_url($files); | ||
| 72 | + try { | ||
| 73 | + $result = $this->s3->putObject([ | ||
| 74 | + 'Bucket' => $this->bucket, | ||
| 75 | + 'Key' => ltrim($key,'/'), | ||
| 76 | + 'Body' => $file_content, | ||
| 77 | + ]); | ||
| 78 | +// unlink($location); | ||
| 79 | + return $result['ObjectURL']; | ||
| 80 | + } catch (AwsException $e) { | ||
| 81 | + return '上传文件到S3时发生错误:' . $e->getMessage(); | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + | ||
| 59 | } | 85 | } |
| @@ -13,7 +13,7 @@ return [ | @@ -13,7 +13,7 @@ return [ | ||
| 13 | | | 13 | | |
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | - 'default' => env('QUEUE_CONNECTION', 'sync'), | 16 | + 'default' => env('QUEUE_CONNECTION', 'redis'), |
| 17 | 17 | ||
| 18 | /* | 18 | /* |
| 19 | |-------------------------------------------------------------------------- | 19 | |-------------------------------------------------------------------------- |
| @@ -75,6 +75,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -75,6 +75,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 75 | Route::any('/del', [\App\Http\Controllers\Bside\News\NewsController::class, 'del'])->name('news_del'); | 75 | Route::any('/del', [\App\Http\Controllers\Bside\News\NewsController::class, 'del'])->name('news_del'); |
| 76 | Route::any('/status', [\App\Http\Controllers\Bside\News\NewsController::class, 'status'])->name('news_status'); | 76 | Route::any('/status', [\App\Http\Controllers\Bside\News\NewsController::class, 'status'])->name('news_status'); |
| 77 | Route::any('/sort', [\App\Http\Controllers\Bside\News\NewsController::class, 'sort'])->name('news_sort'); | 77 | Route::any('/sort', [\App\Http\Controllers\Bside\News\NewsController::class, 'sort'])->name('news_sort'); |
| 78 | + Route::any('/sendAiNews', [\App\Http\Controllers\Bside\News\NewsController::class, 'sendAiNews'])->name('news_sendAiNews'); | ||
| 78 | Route::any('/allSort', [\App\Http\Controllers\Bside\News\NewsController::class, 'allSort'])->name('news_allSort'); | 79 | Route::any('/allSort', [\App\Http\Controllers\Bside\News\NewsController::class, 'allSort'])->name('news_allSort'); |
| 79 | Route::any('/batchSetCategory', [\App\Http\Controllers\Bside\News\NewsController::class, 'batchSetCategory'])->name('news_batchSetCategory'); | 80 | Route::any('/batchSetCategory', [\App\Http\Controllers\Bside\News\NewsController::class, 'batchSetCategory'])->name('news_batchSetCategory'); |
| 80 | Route::any('/statusNum', [\App\Http\Controllers\Bside\News\NewsController::class, 'getStatusNumber'])->name('news_statusNum'); | 81 | Route::any('/statusNum', [\App\Http\Controllers\Bside\News\NewsController::class, 'getStatusNumber'])->name('news_statusNum'); |
-
请 注册 或 登录 后发表评论