作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

正在显示 42 个修改的文件 包含 350 行增加219 行删除
@@ -42,7 +42,7 @@ class Count extends Command @@ -42,7 +42,7 @@ class Count extends Command
42 public function handle() 42 public function handle()
43 { 43 {
44 $list = DB::table('gl_project')->where('gl_project.extend_type','=',0) 44 $list = DB::table('gl_project')->where('gl_project.extend_type','=',0)
45 - ->where('gl_project.type','!=',0) 45 + ->where('gl_project.type','!=',0)->where('gl_project.delete_status',0)
46 ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id') 46 ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id')
47 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id') 47 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
48 ->select($this->selectParam())->get(); 48 ->select($this->selectParam())->get();
@@ -33,7 +33,7 @@ class UpgradeProjectCount extends Command @@ -33,7 +33,7 @@ class UpgradeProjectCount extends Command
33 protected $description = '升级项目统计'; 33 protected $description = '升级项目统计';
34 34
35 public function handle(){ 35 public function handle(){
36 - $project_id = 632; 36 + $project_id = 769;
37 ProjectServer::useProject($project_id); 37 ProjectServer::useProject($project_id);
38 $this->count($project_id); 38 $this->count($project_id);
39 DB::disconnect('custom_mysql'); 39 DB::disconnect('custom_mysql');
@@ -38,7 +38,7 @@ class InquiryMonthlyCount extends Command @@ -38,7 +38,7 @@ class InquiryMonthlyCount extends Command
38 */ 38 */
39 public function handle(){ 39 public function handle(){
40 $list = DB::table('gl_project')->where('gl_project.extend_type','=',0) 40 $list = DB::table('gl_project')->where('gl_project.extend_type','=',0)
41 - ->where('gl_project.type','!=',0) 41 + ->where('gl_project.type','!=',0)->where('gl_project.delete_status',0)
42 ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id') 42 ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id')
43 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id') 43 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
44 ->select($this->selectParam())->get()->toArray(); 44 ->select($this->selectParam())->get()->toArray();
@@ -36,7 +36,7 @@ class UpgradeProjectCount extends Command @@ -36,7 +36,7 @@ class UpgradeProjectCount extends Command
36 protected $description = '升级项目统计'; 36 protected $description = '升级项目统计';
37 37
38 public function handle(){ 38 public function handle(){
39 - $project_id = 632; 39 + $project_id = 769;
40 $oldModel = new UpdateOldInfo(); 40 $oldModel = new UpdateOldInfo();
41 $info = $oldModel->read(['project_id'=>$project_id]); 41 $info = $oldModel->read(['project_id'=>$project_id]);
42 $url = $info['old_domain_online']; 42 $url = $info['old_domain_online'];
@@ -59,17 +59,40 @@ class UpdateMainHtml extends Command @@ -59,17 +59,40 @@ class UpdateMainHtml extends Command
59 */ 59 */
60 public function handle(){ 60 public function handle(){
61 $projectModel = new Project(); 61 $projectModel = new Project();
62 - $list = $projectModel->list(['id'=>223]); 62 + $list = $projectModel->list(['is_upgrade'=>0,'type'=>['!=',0]]);
63 foreach ($list as $v){ 63 foreach ($list as $v){
64 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 64 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
65 ProjectServer::useProject($v['id']); 65 ProjectServer::useProject($v['id']);
66 - $this->setBlogCustomContent(); 66 + $this->getVideoModule($v['id']);
67 DB::disconnect('custom_mysql'); 67 DB::disconnect('custom_mysql');
68 } 68 }
69 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 69 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
70 } 70 }
71 71
72 /** 72 /**
  73 + * @remark :查看项目是否有video模块
  74 + * @name :getVideoModule
  75 + * @author :lyh
  76 + * @method :post
  77 + * @time :2024/1/29 11:29
  78 + */
  79 + public function getVideoModule($project_id){
  80 + $customModel = new CustomModule();
  81 + $info = $customModel->read(['name'=>'视频模块']);
  82 + if($info === false){
  83 + echo date('Y-m-d H:i:s') . '添加,项目id:'.$project_id . PHP_EOL;
  84 + //执行添加
  85 + $data = [
  86 + 'name'=>'视频模块',
  87 + 'project_id'=>$project_id,
  88 + 'route'=>'video',
  89 + ];
  90 + $customModel->add($data);
  91 + }
  92 + return true;
  93 + }
  94 +
  95 + /**
73 * @remark :所有博客数据添加到自定义模块 96 * @remark :所有博客数据添加到自定义模块
74 * @name :setBlogCustom 97 * @name :setBlogCustom
75 * @author :lyh 98 * @author :lyh
@@ -55,7 +55,7 @@ class UpdateRoute extends Command @@ -55,7 +55,7 @@ class UpdateRoute extends Command
55 */ 55 */
56 public function handle(){ 56 public function handle(){
57 $projectModel = new Project(); 57 $projectModel = new Project();
58 - $list = $projectModel->list(['is_upgrade'=>0]); 58 + $list = $projectModel->list(['id'=>206]);
59 $data = []; 59 $data = [];
60 foreach ($list as $v){ 60 foreach ($list as $v){
61 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 61 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
@@ -114,23 +114,25 @@ class UpdateRoute extends Command @@ -114,23 +114,25 @@ class UpdateRoute extends Command
114 if(!empty($lists)){ 114 if(!empty($lists)){
115 foreach ($lists as $v){ 115 foreach ($lists as $v){
116 if(!empty($v['route'])){ 116 if(!empty($v['route'])){
117 - $tag = "-tag";  
118 - if ((substr($v['route'], -strlen($tag)) === $tag)) {  
119 - echo date('Y-m-d H:i:s') . '拼接 :'.$v['id'] . PHP_EOL;  
120 -// $route = Translate::tran($v['route'], 'en').$tag;  
121 - // 如果不是以 '-tag' 结尾,则拼接上 '-tag'  
122 - $route = trim($v['route'],'-tag');  
123 - $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);  
124 - $keywordModel->edit(['route'=>$route],['id'=>$v['id']]);  
125 -// }else{  
126 -// $route = Translate::tran($v['title'], 'en').$tag; 117 +// $tag = "-tag";
  118 +// if ((substr($v['route'], -strlen($tag)) === $tag)) {
  119 +// echo date('Y-m-d H:i:s') . '拼接 :'.$v['id'] . PHP_EOL;
  120 +//// $route = Translate::tran($v['route'], 'en').$tag;
  121 +// // 如果不是以 '-tag' 结尾,则拼接上 '-tag'
  122 +// $route = trim($v['route'],'-tag');
127 // $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']); 123 // $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);
128 // $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); 124 // $keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
129 - }  
130 // }else{ 125 // }else{
131 -// echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL;  
132 -// $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']); 126 +// $route = Translate::tran($v['title'], 'en').$tag;
  127 +// $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);
133 // $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); 128 // $keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
  129 +// }
  130 + }else{
  131 + echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL;
  132 + $route = Translate::tran($v['title'], 'en');
  133 + echo date('Y-m-d H:i:s') . 'route :'.$route . PHP_EOL;
  134 + $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);
  135 + $keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
134 } 136 }
135 echo date('Y-m-d H:i:s') . 'end :' . PHP_EOL; 137 echo date('Y-m-d H:i:s') . 'end :' . PHP_EOL;
136 } 138 }
@@ -282,7 +282,9 @@ class WebTraffic extends Command @@ -282,7 +282,9 @@ class WebTraffic extends Command
282 ProjectServer::useProject($project_id); 282 ProjectServer::useProject($project_id);
283 //已发布产品分类页面 283 //已发布产品分类页面
284 $data['urls_cats'] = DB::connection('custom_mysql')->table('gl_product_category') 284 $data['urls_cats'] = DB::connection('custom_mysql')->table('gl_product_category')
285 - ->where('project_id', $project_id)->where('status', Category::STATUS_ACTIVE)->pluck('route','id')->toArray(); 285 + ->where('project_id', $project_id)->where('status', Category::STATUS_ACTIVE)
  286 + ->whereNull('deleted_at')
  287 + ->pluck('route','id')->toArray();
286 288
287 //已发布单页面 289 //已发布单页面
288 $data['urls_page'] = []; 290 $data['urls_page'] = [];
@@ -291,7 +293,9 @@ class WebTraffic extends Command @@ -291,7 +293,9 @@ class WebTraffic extends Command
291 293
292 //已发布产品详情页 294 //已发布产品详情页
293 $data['urls_details'] = DB::connection('custom_mysql')->table('gl_product') 295 $data['urls_details'] = DB::connection('custom_mysql')->table('gl_product')
294 - ->where('project_id', $project_id)->where('status', Product::STATUS_ON)->pluck('route', 'id')->toArray(); 296 + ->where('project_id', $project_id)->where('status', Product::STATUS_ON)
  297 + ->whereNull('deleted_at')
  298 + ->pluck('route', 'id')->toArray();
295 299
296 $data['urls_cats'] = array_merge($data['urls_cats'], $data['urls_page']); 300 $data['urls_cats'] = array_merge($data['urls_cats'], $data['urls_page']);
297 if(empty($data['urls_cats'])){ 301 if(empty($data['urls_cats'])){
1 -<?php  
2 -/**  
3 - * @remark :  
4 - * @name :CopyProject.php  
5 - * @author :lyh  
6 - * @method :post  
7 - * @time :2024/1/9 16:01  
8 - */  
9 -  
10 -namespace App\Events;  
11 -  
12 -use Illuminate\Broadcasting\InteractsWithSockets;  
13 -use Illuminate\Foundation\Events\Dispatchable;  
14 -use Illuminate\Queue\SerializesModels;  
15 -class CopyProject  
16 -{  
17 - use Dispatchable, InteractsWithSockets, SerializesModels;  
18 - public $data;  
19 - /**  
20 - * 监听更新HTML静态页  
21 - */  
22 - public function __construct($data)  
23 - {  
24 - $this->data = $data;  
25 - }  
26 -}  
1 <?php 1 <?php
2 2
3 use App\Models\File\Image; 3 use App\Models\File\Image;
4 -use App\Models\File\File; 4 +use App\Models\File\File as FileModel;
5 use App\Models\RouteMap\RouteMap; 5 use App\Models\RouteMap\RouteMap;
6 use App\Services\CosService; 6 use App\Services\CosService;
7 use App\Utils\EncryptUtils; 7 use App\Utils\EncryptUtils;
@@ -10,7 +10,6 @@ use GuzzleHttp\Client; @@ -10,7 +10,6 @@ use GuzzleHttp\Client;
10 use GuzzleHttp\Exception\GuzzleException; 10 use GuzzleHttp\Exception\GuzzleException;
11 use Illuminate\Support\Carbon; 11 use Illuminate\Support\Carbon;
12 use Illuminate\Support\Facades\Redis; 12 use Illuminate\Support\Facades\Redis;
13 -use App\Models\User\User;  
14 13
15 define('HTTP_OPENAI_URL', 'http://openai.waimaoq.com/'); 14 define('HTTP_OPENAI_URL', 'http://openai.waimaoq.com/');
16 /** 15 /**
@@ -77,7 +76,6 @@ if (!function_exists('http_post')) { @@ -77,7 +76,6 @@ if (!function_exists('http_post')) {
77 if (curl_errno($ch)) { 76 if (curl_errno($ch)) {
78 $error_message = curl_error($ch); 77 $error_message = curl_error($ch);
79 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($error_message, true) . PHP_EOL, FILE_APPEND); 78 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($error_message, true) . PHP_EOL, FILE_APPEND);
80 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($res, true) . PHP_EOL, FILE_APPEND);  
81 } 79 }
82 curl_close($ch); 80 curl_close($ch);
83 return json_decode($res, true); 81 return json_decode($res, true);
@@ -457,11 +455,11 @@ if (!function_exists('getImageUrl')) { @@ -457,11 +455,11 @@ if (!function_exists('getImageUrl')) {
457 * @method :post 455 * @method :post
458 * @time :2023/7/20 16:46 456 * @time :2023/7/20 16:46
459 */ 457 */
460 - function getImageUrl($path,$storage_type = 0){ 458 + function getImageUrl($path,$storage_type = 0,$location = 0){
461 if(is_array($path)){ 459 if(is_array($path)){
462 $url =[]; 460 $url =[];
463 foreach ($path as $v){ 461 foreach ($path as $v){
464 - $url[] = getImageUrl($v,$storage_type); 462 + $url[] = getImageUrl($v,$storage_type,$location);
465 } 463 }
466 }else{ 464 }else{
467 if(empty($path)){ 465 if(empty($path)){
@@ -473,12 +471,7 @@ if (!function_exists('getImageUrl')) { @@ -473,12 +471,7 @@ if (!function_exists('getImageUrl')) {
473 if(substr($path,0,2) == '//'){ 471 if(substr($path,0,2) == '//'){
474 return 'https:'.$path; 472 return 'https:'.$path;
475 } 473 }
476 - $imageModel = new Image();  
477 - $imageInfo = $imageModel->read(['path'=>$path],'is_cos');  
478 - if($imageInfo === false){  
479 - return '';  
480 - }  
481 - if($imageInfo['is_cos'] == 1){ 474 + if($location == 0){
482 $cos = config('filesystems.disks.cos'); 475 $cos = config('filesystems.disks.cos');
483 $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1']; 476 $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1'];
484 $url = $cosCdn.$path; 477 $url = $cosCdn.$path;
@@ -500,11 +493,11 @@ if (!function_exists('getFileUrl')) { @@ -500,11 +493,11 @@ if (!function_exists('getFileUrl')) {
500 * @method :post 493 * @method :post
501 * @time :2023/7/20 16:46 494 * @time :2023/7/20 16:46
502 */ 495 */
503 - function getFileUrl($path,$storage_type = 0){ 496 + function getFileUrl($path,$storage_type = 0,$location = 0){
504 if(is_array($path)){ 497 if(is_array($path)){
505 $url =[]; 498 $url =[];
506 foreach ($path as $v){ 499 foreach ($path as $v){
507 - $url[] = getFileUrl($v,$storage_type); 500 + $url[] = getFileUrl($v,$storage_type,$location);
508 } 501 }
509 }else{ 502 }else{
510 if(empty($path)){ 503 if(empty($path)){
@@ -516,12 +509,7 @@ if (!function_exists('getFileUrl')) { @@ -516,12 +509,7 @@ if (!function_exists('getFileUrl')) {
516 if(substr($path,0,2) == '//'){ 509 if(substr($path,0,2) == '//'){
517 return 'https:'.$path; 510 return 'https:'.$path;
518 } 511 }
519 - $fileModel = new File();  
520 - $fileInfo = $fileModel->read(['path'=>$path],'is_cos');  
521 - if($fileInfo === false){  
522 - return '';  
523 - }  
524 - if($fileInfo['is_cos'] == 1){ 512 + if($location == 0){
525 $cos = config('filesystems.disks.cos'); 513 $cos = config('filesystems.disks.cos');
526 $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1']; 514 $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1'];
527 $url = $cosCdn.$path; 515 $url = $cosCdn.$path;
@@ -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
@@ -43,7 +43,7 @@ class ProductController extends BaseController @@ -43,7 +43,7 @@ class ProductController extends BaseController
43 */ 43 */
44 public function index(Product $product) 44 public function index(Product $product)
45 { 45 {
46 - $filed = ['id', 'project_id', 'title', 'sort' ,'thumb', 'gallery' ,'product_type' , 'route' , 46 + $filed = ['id', 'project_id', 'title', 'sort' ,'thumb' ,'product_type' , 'route' ,
47 'category_id', 'keyword_id', 'status', 'created_uid', 'is_upgrade' ,'created_at', 'updated_at','six_read']; 47 'category_id', 'keyword_id', 'status', 'created_uid', 'is_upgrade' ,'created_at', 'updated_at','six_read'];
48 $this->order = 'sort'; 48 $this->order = 'sort';
49 $query = $product->orderBy($this->order ,'desc')->orderBy('id','desc'); 49 $query = $product->orderBy($this->order ,'desc')->orderBy('id','desc');
@@ -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,11 @@ @@ -3,8 +3,11 @@
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;
  10 +use App\Jobs\CopyProjectJob;
8 use App\Models\Com\NoticeLog; 11 use App\Models\Com\NoticeLog;
9 use App\Models\Com\UpdateLog; 12 use App\Models\Com\UpdateLog;
10 use App\Models\Devops\ServerConfig; 13 use App\Models\Devops\ServerConfig;
@@ -149,7 +152,7 @@ class ProjectLogic extends BaseLogic @@ -149,7 +152,7 @@ class ProjectLogic extends BaseLogic
149 //保存询盘过滤配置 152 //保存询盘过滤配置
150 // $this->param['inquiry_filter_config']['project_id'] = $this->param['id']; 153 // $this->param['inquiry_filter_config']['project_id'] = $this->param['id'];
151 // $this->saveInquiryFilterConfig($this->param['inquiry_filter_config']); 154 // $this->saveInquiryFilterConfig($this->param['inquiry_filter_config']);
152 - 155 + $this->syncImageFile($this->param['project_location'],$this->param['id']);
153 //创建站点 156 //创建站点
154 // $this->createSite($this->param); 157 // $this->createSite($this->param);
155 } 158 }
@@ -162,6 +165,13 @@ class ProjectLogic extends BaseLogic @@ -162,6 +165,13 @@ class ProjectLogic extends BaseLogic
162 return $this->success(); 165 return $this->success();
163 } 166 }
164 167
  168 + public function syncImageFile($location,$project_id){
  169 + if($location == 1){
  170 + CopyImageFileJob::dispatch(['project_id'=>$project_id]);
  171 + }
  172 + return $this->success();
  173 + }
  174 +
165 /** 175 /**
166 * @remark :保存项目 176 * @remark :保存项目
167 * @name :setExtendType 177 * @name :setExtendType
@@ -603,7 +613,7 @@ class ProjectLogic extends BaseLogic @@ -603,7 +613,7 @@ class ProjectLogic extends BaseLogic
603 * @time :2023/11/8 14:23 613 * @time :2023/11/8 14:23
604 */ 614 */
605 public function copyProject(){ 615 public function copyProject(){
606 - CopyProject::dispatch(['project_id'=>$this->param['project_id']]); 616 + CopyProjectJob::dispatch(['project_id'=>$this->param['project_id']]);
607 return $this->success(); 617 return $this->success();
608 } 618 }
609 619
@@ -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 + if($info !== false){
43 $info['url'] = $this->user['domain'] . $info['route']; 44 $info['url'] = $this->user['domain'] . $info['route'];
44 $info['related_news_info'] = News::whereIn('id', $info['related_news_ids'])->select(['id', 'name'])->get(); 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 }
@@ -24,11 +24,10 @@ class TranslateLogic extends BaseLogic @@ -24,11 +24,10 @@ class TranslateLogic extends BaseLogic
24 } 24 }
25 25
26 /** 26 /**
27 - * @remark :  
28 - * @name :getTranslateList  
29 - * @author :lyh  
30 - * @method :post  
31 - * @time :2024/1/12 9:43 27 + * 获取翻译校对文案
  28 + * @return array
  29 + * @throws \App\Exceptions\AsideGlobalException
  30 + * @throws \App\Exceptions\BsideGlobalException
32 */ 31 */
33 public function getTranslateList(){ 32 public function getTranslateList(){
34 $data = []; 33 $data = [];
@@ -42,44 +41,46 @@ class TranslateLogic extends BaseLogic @@ -42,44 +41,46 @@ class TranslateLogic extends BaseLogic
42 } 41 }
43 return $this->success($data); 42 return $this->success($data);
44 } 43 }
45 - $url = $this->user['domain'].(($this->param['url'] != '/') ? $this->param['url'] : ''); 44 + // 需要校对路由
  45 + $url = $this->user['domain'] . (($this->param['url'] != '/') ? $this->param['url'] : '');
  46 + // 需要校对语种
46 $languageInfo = $this->getLanguage($this->param['language_id']); 47 $languageInfo = $this->getLanguage($this->param['language_id']);
  48 + // 原始校对内容
47 $info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]); 49 $info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]);
48 //获取当前URl的所有文本内容 50 //获取当前URl的所有文本内容
49 - $new_key = $this->getUrlRead($url);  
50 - if($info === false){  
51 - $translate_list = Translate::tran($new_key, $languageInfo['short']);  
52 - if(empty($translate_list)){  
53 - $this->fail('翻译失败,请联系管理员');  
54 - }  
55 - foreach ($new_key as $k=>$v){  
56 - $data[] = [  
57 - trim($v)=>$translate_list[$k],  
58 - ];  
59 - }  
60 - return $this->success($data);  
61 - } 51 + $text_array = $this->getUrlRead($url);
  52 + // 原始校对程序
62 $old_key = [];//key值组成数据 53 $old_key = [];//key值组成数据
  54 + if($info !== false){
63 $data_read = json_decode($info['data'],JSON_UNESCAPED_UNICODE); 55 $data_read = json_decode($info['data'],JSON_UNESCAPED_UNICODE);
64 foreach ($data_read as $k => $v){ 56 foreach ($data_read as $k => $v){
65 $old_key[] = $k; 57 $old_key[] = $k;
66 $data[] = [$k => $v]; 58 $data[] = [$k => $v];
67 } 59 }
68 - $arr2 = array_values(array_diff($new_key, $old_key)); 60 + }
  61 + $arr2 = array_values(array_diff($text_array, $old_key));
69 if(!empty($arr2)){ 62 if(!empty($arr2)){
  63 + $i = 0;
  64 + TranslateText:
70 $translate_list = Translate::tran($arr2, $languageInfo['short']); 65 $translate_list = Translate::tran($arr2, $languageInfo['short']);
  66 + if(empty($translate_list)){
  67 + if ($i < 3) {
  68 + $i++;
  69 + goto TranslateText;
  70 + }
  71 + $this->fail('翻译失败,请稍后重试!');
  72 + }
71 if(count($arr2) == 1){ 73 if(count($arr2) == 1){
72 $data[] = [ 74 $data[] = [
73 $arr2[0]=>$translate_list 75 $arr2[0]=>$translate_list
74 ]; 76 ];
75 }else{ 77 }else{
76 - if(!empty($translate_list)){  
77 foreach ($arr2 as $k => $v){ 78 foreach ($arr2 as $k => $v){
78 $data[] = [ 79 $data[] = [
79 trim($v)=>$translate_list[$k] 80 trim($v)=>$translate_list[$k]
80 ]; 81 ];
81 } 82 }
82 - } 83 +
83 } 84 }
84 } 85 }
85 return $this->success($data); 86 return $this->success($data);
@@ -153,11 +154,9 @@ class TranslateLogic extends BaseLogic @@ -153,11 +154,9 @@ class TranslateLogic extends BaseLogic
153 } 154 }
154 155
155 /** 156 /**
156 - * @remark :获取Url内容  
157 - * @name :getUrlRead  
158 - * @author :lyh  
159 - * @method :post  
160 - * @time :2023/11/22 10:02 157 + * 获取url HTML需要翻译的文本
  158 + * @param $url
  159 + * @return array
161 */ 160 */
162 public function getUrlRead($url){ 161 public function getUrlRead($url){
163 $dom = file_get_html($url); 162 $dom = file_get_html($url);
@@ -184,10 +183,9 @@ class TranslateLogic extends BaseLogic @@ -184,10 +183,9 @@ class TranslateLogic extends BaseLogic
184 } 183 }
185 $need_tran[] = htmlspecialchars_decode(html_entity_decode($string)); 184 $need_tran[] = htmlspecialchars_decode(html_entity_decode($string));
186 } 185 }
187 - $need_tran[] = $description->attr['content'];  
188 - $need_tran[] = $keywords->attr['content']; 186 + $need_tran[] = $description ? $description->attr['content'] : '';
  187 + $need_tran[] = $keywords ? $keywords->attr['content'] : '';
189 return $need_tran; 188 return $need_tran;
190 - return $data;  
191 } 189 }
192 190
193 191
@@ -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);
  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 +}
1 <?php 1 <?php
2 2
3 -namespace App\Listeners; 3 +namespace App\Jobs;
4 4
5 use App\Events\CopyProject; 5 use App\Events\CopyProject;
6 use App\Events\UpdateHtml; 6 use App\Events\UpdateHtml;
@@ -14,37 +14,52 @@ use App\Models\Template\Setting; @@ -14,37 +14,52 @@ use App\Models\Template\Setting;
14 use App\Models\User\User as UserModel; 14 use App\Models\User\User as UserModel;
15 use App\Services\ProjectServer; 15 use App\Services\ProjectServer;
16 use Hashids\Hashids; 16 use Hashids\Hashids;
  17 +use Illuminate\Bus\Queueable;
17 use Illuminate\Contracts\Queue\ShouldQueue; 18 use Illuminate\Contracts\Queue\ShouldQueue;
  19 +use Illuminate\Foundation\Bus\Dispatchable;
  20 +use Illuminate\Queue\InteractsWithQueue;
  21 +use Illuminate\Queue\SerializesModels;
18 use Illuminate\Support\Facades\DB; 22 use Illuminate\Support\Facades\DB;
19 use Illuminate\Support\Facades\Schema; 23 use Illuminate\Support\Facades\Schema;
20 24
21 -class CopyProjectListener implements ShouldQueue 25 +class CopyProjectJob implements ShouldQueue
22 { 26 {
23 - public function __construct() 27 + use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  28 + public $tries = 3; // 可配置任务重试次数
  29 +
  30 + protected $param;
  31 +
  32 + /**
  33 + * Create a new job instance.
  34 + *
  35 + * @param CopyImageFile $event
  36 + * @return void
  37 + */
  38 + public function __construct($data)
24 { 39 {
25 - // 40 + $this->param = $data;
26 } 41 }
27 42
  43 +
28 /** 44 /**
29 * Handle the event. 45 * Handle the event.
30 * 46 *
31 * @param UpdateHtml $event 47 * @param UpdateHtml $event
32 * @return void 48 * @return void
33 */ 49 */
34 - public function handle(CopyProject $event) 50 + public function handle()
35 { 51 {
36 - $this->param = $event->data;  
37 - $this->model = new Project(); 52 + $projectModel = new Project();
38 DB::beginTransaction(); 53 DB::beginTransaction();
39 try { 54 try {
40 //复制初始项目 55 //复制初始项目
41 - $data = $this->model::where('id', $this->param['project_id'])->first(); 56 + $data = $projectModel::where('id', $this->param['project_id'])->first();
42 $data = $data->getAttributes(); 57 $data = $data->getAttributes();
43 $type = $data['type']; 58 $type = $data['type'];
44 $data['type'] = 0; 59 $data['type'] = 0;
45 $data['title'] = $data['title'].'-copy'; 60 $data['title'] = $data['title'].'-copy';
46 unset($data['id']); 61 unset($data['id']);
47 - $project_id = $this->model->insertGetId($data); 62 + $project_id = $projectModel->insertGetId($data);
48 //复制部署表 63 //复制部署表
49 $buildModel = new DeployBuild(); 64 $buildModel = new DeployBuild();
50 $buildData = $buildModel::where('project_id', $this->param['project_id'])->first(); 65 $buildData = $buildModel::where('project_id', $this->param['project_id'])->first();
@@ -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 {
@@ -24,7 +25,6 @@ class EventServiceProvider extends ServiceProvider @@ -24,7 +25,6 @@ class EventServiceProvider extends ServiceProvider
24 'Illuminate\Database\Events\QueryExecuted' => [ 25 'Illuminate\Database\Events\QueryExecuted' => [
25 'App\Listeners\QueryListener', 26 'App\Listeners\QueryListener',
26 ], 27 ],
27 - CopyProject::class => [CopyProjectListener::class],  
28 ]; 28 ];
29 29
30 /** 30 /**
@@ -51,11 +51,35 @@ class AmazonS3Service @@ -51,11 +51,35 @@ class AmazonS3Service
51 'SourceFile' => $body, 51 'SourceFile' => $body,
52 // 'ACL' => 'public-read', // 设置图片为公共可读,可根据需求修改 52 // 'ACL' => 'public-read', // 设置图片为公共可读,可根据需求修改
53 ]); 53 ]);
54 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export('ok:'.$result['ObjectURL'], true) . PHP_EOL, FILE_APPEND);  
55 return $result['ObjectURL']; 54 return $result['ObjectURL'];
56 } catch (S3Exception $e) { 55 } catch (S3Exception $e) {
57 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export('失败'.$e->getMessage(), true) . PHP_EOL, FILE_APPEND);  
58 return false; 56 return false;
59 } 57 }
60 } 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 +
61 } 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');