作者 刘锟

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

@@ -7,39 +7,14 @@ @@ -7,39 +7,14 @@
7 */ 7 */
8 namespace App\Console\Commands\Test; 8 namespace App\Console\Commands\Test;
9 9
10 -use App\Helper\Common;  
11 -use App\Models\Blog\Blog;  
12 -use App\Models\Devops\ServerConfig;  
13 -use App\Models\Domain\DomainInfo; 10 +
14 use App\Models\File\File; 11 use App\Models\File\File;
15 use App\Models\File\File as FileModel; 12 use App\Models\File\File as FileModel;
16 use App\Models\File\Image; 13 use App\Models\File\Image;
17 use App\Models\File\Image as ImageModel; 14 use App\Models\File\Image as ImageModel;
18 -use App\Models\Manage\BelongingGroup;  
19 -use App\Models\Manage\Dept;  
20 -use App\Models\Manage\EntryPosition;  
21 -use App\Models\Manage\ManageHr;  
22 -use App\Models\Nav\BNav;  
23 -use App\Models\Nav\BNavGroup;  
24 -use App\Models\Product\Keyword;  
25 -use App\Models\Product\Product;  
26 -use App\Models\Project\DeployOptimize;  
27 -use App\Models\Project\MinorLanguages;  
28 -use App\Models\Project\Project;  
29 -use App\Models\RouteMap\RouteMap;  
30 -use App\Models\Template\BCustomTemplate;  
31 -use App\Models\Template\BTemplate;  
32 -use App\Models\Template\BTemplateCom;  
33 -use App\Models\Template\BTemplateCommon;  
34 -use App\Models\Template\Setting;  
35 -use App\Models\WebSetting\WebSettingService;  
36 use App\Services\AmazonS3Service; 15 use App\Services\AmazonS3Service;
37 -use App\Services\ProjectServer;  
38 -use App\Services\SyncService;  
39 -use GuzzleHttp\Client;  
40 use Illuminate\Console\Command; 16 use Illuminate\Console\Command;
41 -use Illuminate\Support\Facades\DB;  
42 -use Illuminate\Support\Facades\Log; 17 +
43 18
44 class Demo extends Command 19 class Demo extends Command
45 { 20 {
@@ -56,6 +31,8 @@ class Demo extends Command @@ -56,6 +31,8 @@ class Demo extends Command
56 * @var string 31 * @var string
57 */ 32 */
58 protected $description = 'demo'; 33 protected $description = 'demo';
  34 +
  35 +
59 /** 36 /**
60 * Execute the job. 37 * Execute the job.
61 * 38 *
@@ -63,77 +40,30 @@ class Demo extends Command @@ -63,77 +40,30 @@ class Demo extends Command
63 */ 40 */
64 public function handle() 41 public function handle()
65 { 42 {
66 - $projectModel = new Project();  
67 - $list = $projectModel->list(['delete_status'=>0,'type'=>['!=',0]]);  
68 - $data = [];  
69 - foreach ($list as $v){  
70 - echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;  
71 - ProjectServer::useProject($v['id']);  
72 - DB::table('gl_web_template_com')->truncate();  
73 - $templateComModel = new BTemplateCom();  
74 - $templateComModel->truncate();  
75 - $this->saveTemplateCom($v['id']);  
76 - DB::disconnect('custom_mysql');  
77 - }  
78 - echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;  
79 - } 43 + $this->param['project_id'] = 181;
  44 + $imageModel = new ImageModel();
  45 +// //获取当前项目的所有图片
  46 +// $imageList = $imageModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','size']);
  47 +// if(!empty($imageList)){
  48 +// $amazonS3Service = new AmazonS3Service();
  49 +// foreach ($imageList as $k => $v){
  50 +// $amazonS3Service->syncImageFiles(getImageUrl($v['path']));
  51 +// $imageModel->edit(['is_cos'=>0],['id'=>$v['id']]);
  52 +// }
  53 +// }
80 54
81 - public function saveTemplateCom($project_id){  
82 - //获取当前项目选择的模版  
83 - $settingModel = new Setting();  
84 - $settingInfo = $settingModel->read(['project_id'=>$project_id]);  
85 - echo date('Y-m-d H:i:s') . '设置的模版:'.json_encode($settingInfo) . PHP_EOL;  
86 - if($settingInfo !== false){  
87 - $templateCommonModel = new BTemplateCommon();  
88 - $commonList = $templateCommonModel->list(['template_id'=>['in',[$settingInfo['template_id'],0]]]);  
89 - if(!empty($commonList)){  
90 - foreach ($commonList as $v){  
91 - $typeArr = [1, 2, 3];  
92 - foreach ($typeArr as $type){  
93 - if($type == 1){  
94 - $headData = [  
95 - 'project_id'=>$v['project_id'],  
96 - 'source'=>$v['type'] == 1 ? 99 : $v['type'],  
97 - 'common_type'=>1,  
98 - 'template_id'=>$v['template_id'],  
99 - 'html'=>$v['head_html'],  
100 - 'html_style'=>$v['head_css'],  
101 - 'is_custom'=>$v['is_custom'],  
102 - 'is_list'=>$v['is_list']  
103 - ];  
104 - $templateComModel = new BTemplateCom();  
105 - $templateComModel->add($headData);  
106 - }elseif ($type == 2){  
107 - $footerData = [  
108 - 'project_id'=>$v['project_id'],  
109 - 'source'=>$v['type'] == 1 ? 99 : $v['type'],  
110 - 'common_type'=>2,  
111 - 'template_id'=>$v['template_id'],  
112 - 'html'=>$v['footer_html'],  
113 - 'html_style'=>$v['footer_css'],  
114 - 'is_custom'=>$v['is_custom'],  
115 - 'is_list'=>$v['is_list']  
116 - ];  
117 - $templateComModel = new BTemplateCom();  
118 - $templateComModel->add($footerData);  
119 - }elseif ($type == 3){  
120 - $otherData = [  
121 - 'project_id'=>$v['project_id'],  
122 - 'source'=>$v['type'] == 1 ? 99 : $v['type'],  
123 - 'common_type'=>3,  
124 - 'template_id'=>$v['template_id'],  
125 - 'html'=>$v['other'],  
126 - 'html_style'=>null,  
127 - 'is_custom'=>$v['is_custom'],  
128 - 'is_list'=>$v['is_list']  
129 - ];  
130 - $templateComModel = new BTemplateCom();  
131 - $templateComModel->add($otherData);  
132 - }  
133 - }  
134 - } 55 + $fileModel = new FileModel();
  56 + $fileList = $fileModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','name']);
  57 + if(!empty($fileList)){
  58 + $amazonS3Service = new AmazonS3Service();
  59 + foreach ($fileList as $k => $v){
  60 + echo date('Y-m-d H:i:s') . '执行的数据id:' . $v['id'] . '名称:'.$v['name'] . PHP_EOL;
  61 + $amazonS3Service->syncImageFiles(getFileUrl($v['path']));
  62 + $fileModel->edit(['is_cos'=>0],['id'=>$v['id']]);
  63 + gc_collect_cycles();
135 } 64 }
136 } 65 }
137 return true; 66 return true;
138 } 67 }
  68 +
139 } 69 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :HeaderFooter.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/5/21 9:42
  8 + */
  9 +
  10 +namespace App\Console\Commands\Test;
  11 +
  12 +use App\Models\Template\BTemplateCom;
  13 +use App\Models\Template\BTemplateCommon;
  14 +use App\Models\Template\Setting;
  15 +use Illuminate\Console\Command;
  16 +
  17 +/**
  18 + * @remark :头部底部分开 脚本数据
  19 + * @name :HeaderFooter
  20 + * @author :lyh
  21 + * @method :post
  22 + * @time :2024/5/21 9:42
  23 + */
  24 +class HeaderFooter extends Command
  25 +{
  26 + /**
  27 + * The name and signature of the console command.
  28 + *
  29 + * @var string
  30 + */
  31 + protected $signature = 'common_header';
  32 +
  33 + /**
  34 + * The console command description.
  35 + *
  36 + * @var string
  37 + */
  38 + protected $description = 'common_header';
  39 + /**
  40 + * Execute the job.
  41 + *
  42 + * @return void
  43 + */
  44 + public function handle()
  45 + {
  46 + $projectModel = new Project();
  47 + $list = $projectModel->list(['delete_status'=>0,'type'=>['!=',0]]);
  48 + $data = [];
  49 + foreach ($list as $v){
  50 + echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
  51 + ProjectServer::useProject($v['id']);
  52 + DB::table('gl_web_template_com')->truncate();
  53 + $templateComModel = new BTemplateCom();
  54 + $templateComModel->truncate();
  55 + $this->saveTemplateCom($v['id']);
  56 + DB::disconnect('custom_mysql');
  57 + }
  58 + echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
  59 + }
  60 +
  61 + public function saveTemplateCom($project_id){
  62 + //获取当前项目选择的模版
  63 + $settingModel = new Setting();
  64 + $settingInfo = $settingModel->read(['project_id'=>$project_id]);
  65 + echo date('Y-m-d H:i:s') . '设置的模版:'.json_encode($settingInfo) . PHP_EOL;
  66 + if($settingInfo !== false){
  67 + $templateCommonModel = new BTemplateCommon();
  68 + $commonList = $templateCommonModel->list(['template_id'=>['in',[$settingInfo['template_id'],0]]]);
  69 + if(!empty($commonList)){
  70 + foreach ($commonList as $v){
  71 + $typeArr = [1, 2, 3];
  72 + foreach ($typeArr as $type){
  73 + if($type == 1){
  74 + $headData = [
  75 + 'project_id'=>$v['project_id'],
  76 + 'source'=>$v['type'] == 1 ? 99 : $v['type'],
  77 + 'common_type'=>1,
  78 + 'template_id'=>$v['template_id'],
  79 + 'html'=>$v['head_html'],
  80 + 'html_style'=>$v['head_css'],
  81 + 'is_custom'=>$v['is_custom'],
  82 + 'is_list'=>$v['is_list']
  83 + ];
  84 + $templateComModel = new BTemplateCom();
  85 + $templateComModel->add($headData);
  86 + }elseif ($type == 2){
  87 + $footerData = [
  88 + 'project_id'=>$v['project_id'],
  89 + 'source'=>$v['type'] == 1 ? 99 : $v['type'],
  90 + 'common_type'=>2,
  91 + 'template_id'=>$v['template_id'],
  92 + 'html'=>$v['footer_html'],
  93 + 'html_style'=>$v['footer_css'],
  94 + 'is_custom'=>$v['is_custom'],
  95 + 'is_list'=>$v['is_list']
  96 + ];
  97 + $templateComModel = new BTemplateCom();
  98 + $templateComModel->add($footerData);
  99 + }elseif ($type == 3){
  100 + $otherData = [
  101 + 'project_id'=>$v['project_id'],
  102 + 'source'=>$v['type'] == 1 ? 99 : $v['type'],
  103 + 'common_type'=>3,
  104 + 'template_id'=>$v['template_id'],
  105 + 'html'=>$v['other'],
  106 + 'html_style'=>null,
  107 + 'is_custom'=>$v['is_custom'],
  108 + 'is_list'=>$v['is_list']
  109 + ];
  110 + $templateComModel = new BTemplateCom();
  111 + $templateComModel->add($otherData);
  112 + }
  113 + }
  114 + }
  115 + }
  116 + }
  117 + return true;
  118 + }
  119 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :Translate.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/5/21 9:32
  8 + */
  9 +
  10 +namespace App\Console\Commands\Test;
  11 +
  12 +use App\Models\Project\Project;
  13 +use App\Models\RouteMap\RouteMap;
  14 +use App\Models\Template\BTemplateCom;
  15 +use App\Models\Template\BTemplateCommon;
  16 +use App\Models\Template\Setting;
  17 +use App\Services\ProjectServer;
  18 +use Illuminate\Console\Command;
  19 +use Illuminate\Support\Facades\DB;
  20 +
  21 +class Translate extends Command
  22 +{
  23 + /**
  24 + * The name and signature of the console command.
  25 + *
  26 + * @var string
  27 + */
  28 + protected $signature = 'translate';
  29 +
  30 + /**
  31 + * The console command description.
  32 + *
  33 + * @var string
  34 + */
  35 + protected $description = 'translate';
  36 + public function handle(){
  37 + $projectModel = new Project();
  38 + $list = $projectModel->list(['delete_status'=>0,'type'=>['!=',0],'id'=>['<=',1194]]);
  39 + foreach ($list as $v){
  40 + echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
  41 + ProjectServer::useProject($v['id']);
  42 + $translateModel = new \App\Models\WebSetting\Translate();
  43 + $translateList = $translateModel->list([],'id',['id','url']);
  44 + foreach ($translateList as $value){
  45 + echo date('Y-m-d H:i:s') . '数据路由:'.$value['url'] . PHP_EOL;
  46 + $data = $this->getRouteSource($value['url']);
  47 + if($data === false){
  48 + continue;
  49 + }
  50 + $rs = $translateModel->edit($data,['id'=>$value['id']]);
  51 + gc_collect_cycles();
  52 + }
  53 + DB::disconnect('custom_mysql');
  54 + }
  55 + DB::disconnect('custom_mysql');
  56 + }
  57 +
  58 + /**
  59 + * @remark :根据路由获取source+source_id
  60 + * @name :getRouteSource
  61 + * @author :lyh
  62 + * @method :post
  63 + * @time :2024/5/17 15:11
  64 + */
  65 + public function getRouteSource($route){
  66 + $data = ['source'=>0,'source_id'=>0,'is_list'=>0,'is_custom'=>0];
  67 + if(strtolower($route) == 'all'){
  68 + return $data;
  69 + }
  70 + if($route == '/'){
  71 + $data['source'] = 1;
  72 + return $data;
  73 + }
  74 + $route = basename($route);
  75 + $routeModel = new RouteMap();
  76 + $routeInfo = $routeModel->read(['route'=>$route]);
  77 + if($routeInfo === false){
  78 + return false;
  79 + }
  80 + return $this->resultData($routeInfo,$data);
  81 + }
  82 +
  83 + /**
  84 + * @remark :返回数据
  85 + * @name :resultData
  86 + * @author :lyh
  87 + * @method :post
  88 + * @time :2024/5/20 11:54
  89 + */
  90 + public function resultData($routeInfo,$data){
  91 + if($routeInfo['source'] == RouteMap::SOURCE_PAGE){
  92 + if($routeInfo['source_id']){
  93 + $data = ['source'=>9,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0];
  94 + }
  95 + }
  96 + if($routeInfo['source'] == RouteMap::SOURCE_PRODUCT){
  97 + if($routeInfo['source_id']){
  98 + $data = ['source'=>2,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0];
  99 + }
  100 + }
  101 + if($routeInfo['source'] == RouteMap::SOURCE_PRODUCT_CATE){
  102 + if($routeInfo['source_id']){
  103 + $data = ['source'=>2,'source_id'=>$routeInfo['source_id'],'is_list'=>1,'is_custom'=>0];
  104 + }
  105 + }
  106 + if($routeInfo['source'] == RouteMap::SOURCE_BLOG){
  107 + if($routeInfo['source_id']){
  108 + $data = ['source'=>3,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0];
  109 + }
  110 + }
  111 + if($routeInfo['source'] == RouteMap::SOURCE_BLOG_CATE){
  112 + if($routeInfo['source_id']){
  113 + $data = ['source'=>3,'source_id'=>$routeInfo['source_id'],'is_list'=>1,'is_custom'=>0];
  114 + }
  115 + }
  116 + if($routeInfo['source'] == RouteMap::SOURCE_NEWS){
  117 + if($routeInfo['source_id']){
  118 + $data = ['source'=>4,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0];
  119 + }
  120 + }
  121 + if($routeInfo['source'] == RouteMap::SOURCE_NEWS_CATE){
  122 + if($routeInfo['source_id']){
  123 + $data = ['source'=>4,'source_id'=>$routeInfo['source_id'],'is_list'=>1,'is_custom'=>0];
  124 + }
  125 + }
  126 + if($routeInfo['source'] == RouteMap::SOURCE_MODULE){
  127 + if($routeInfo['source_id']){
  128 + $data = ['source'=>7,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>1];
  129 + }
  130 + }
  131 + if($routeInfo['source'] == RouteMap::SOURCE_MODULE_CATE){
  132 + if($routeInfo['source_id']){
  133 + $data = ['source'=>7,'source_id'=>$routeInfo['source_id'],'is_list'=>1,'is_custom'=>1];
  134 + }
  135 + }
  136 + return $data;
  137 + }
  138 +
  139 +}
@@ -683,8 +683,9 @@ if (!function_exists('str_replace_url')) { @@ -683,8 +683,9 @@ if (!function_exists('str_replace_url')) {
683 $cos = config('filesystems.disks.cos'); 683 $cos = config('filesystems.disks.cos');
684 $cosCdn = $cos['cdn']; 684 $cosCdn = $cos['cdn'];
685 $cosCdn1 = $cos['cdn1']; 685 $cosCdn1 = $cos['cdn1'];
686 - $cosCdn2 = config('filesystems.disks.s3')['cdn'];  
687 - if($url && ((strpos($url,$cosCdn) !== false) || (strpos($url,$cosCdn1) !== false) || (strpos($url,$cosCdn2) !== false))){ 686 + $cosCdn2 = $cos['cdn2'];
  687 + $cosCdn3 = config('filesystems.disks.s3')['cdn'];
  688 + if($url && ((strpos($url,$cosCdn) !== false) || (strpos($url,$cosCdn1) !== false) || (strpos($url,$cosCdn2) !== false) || (strpos($url,$cosCdn3) !== false))){
688 // 外部URL无需解析 689 // 外部URL无需解析
689 // 使用 parse_url 函数来解析 URL 690 // 使用 parse_url 函数来解析 URL
690 $urlParts = parse_url($url); 691 $urlParts = parse_url($url);
@@ -48,6 +48,7 @@ class AyrReleaseController extends BaseController @@ -48,6 +48,7 @@ class AyrReleaseController extends BaseController
48 $info = $ayrShareLogic->ayr_share_info($this->param['share_id']); 48 $info = $ayrShareLogic->ayr_share_info($this->param['share_id']);
49 $this->response('success',Code::SUCCESS,$info); 49 $this->response('success',Code::SUCCESS,$info);
50 } 50 }
  51 +
51 /** 52 /**
52 * @name :(发布社交)send_post 53 * @name :(发布社交)send_post
53 * @author :lyh 54 * @author :lyh
@@ -88,7 +89,9 @@ class AyrReleaseController extends BaseController @@ -88,7 +89,9 @@ class AyrReleaseController extends BaseController
88 //发送请求发布社交文章 89 //发送请求发布社交文章
89 $res = $ayrShare->post_send_msg($param,$share_info['profile_key']); 90 $res = $ayrShare->post_send_msg($param,$share_info['profile_key']);
90 //保存数据库 91 //保存数据库
91 - $ayrReleaseLogic->release_add($res); 92 + if($res){
  93 + $ayrReleaseLogic->release_add($res);
  94 + }
92 //保存返回的内容 95 //保存返回的内容
93 $this->response('success',Code::SUCCESS,json_decode($res)); 96 $this->response('success',Code::SUCCESS,json_decode($res));
94 } 97 }
@@ -43,7 +43,7 @@ class ServerConfigLogic extends BaseLogic @@ -43,7 +43,7 @@ class ServerConfigLogic extends BaseLogic
43 $projectModel = new Project(); 43 $projectModel = new Project();
44 foreach ($lists['list'] as $k => $v){ 44 foreach ($lists['list'] as $k => $v){
45 if($v['type'] == $this->model::TYPE_SERVER){ 45 if($v['type'] == $this->model::TYPE_SERVER){
46 - $v['count'] = $projectModel->where(['serve_id'=>$v['id']])->count(); 46 + $v['count'] = $projectModel->where(['serve_id'=>$v['id'],'delete_status'=>0])->count();
47 } 47 }
48 $lists['list'][$k] = $v; 48 $lists['list'][$k] = $v;
49 } 49 }
@@ -143,7 +143,7 @@ class ProjectLogic extends BaseLogic @@ -143,7 +143,7 @@ class ProjectLogic extends BaseLogic
143 public function projectSave(){ 143 public function projectSave(){
144 DB::beginTransaction(); 144 DB::beginTransaction();
145 try { 145 try {
146 - $this->param['project_location'] = 0;//TODO::图片文件存储不同地方,上线后删除 146 +// $this->param['project_location'] = 0;//TODO::图片文件存储不同地方,上线后删除
147 if($this->param['type'] == Project::TYPE_SEVEN){ 147 if($this->param['type'] == Project::TYPE_SEVEN){
148 //错误单直接返回,单独处理 148 //错误单直接返回,单独处理
149 $this->setTypeSevenEdit($this->param); 149 $this->setTypeSevenEdit($this->param);
@@ -259,12 +259,17 @@ class TranslateLogic extends BaseLogic @@ -259,12 +259,17 @@ class TranslateLogic extends BaseLogic
259 // try { 259 // try {
260 $info = $this->model->read(['language_id'=>$this->param['language_id'],'url'=>$this->param['url'],'project_id'=>$this->user['project_id'],'type'=>$this->param['type']]); 260 $info = $this->model->read(['language_id'=>$this->param['language_id'],'url'=>$this->param['url'],'project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
261 if($info === false){ 261 if($info === false){
  262 + $sourceInfo = $this->getRouteSource($this->param['url']);
262 $param = [ 263 $param = [
263 'type'=>$this->param['type'], 264 'type'=>$this->param['type'],
264 'project_id'=>$this->user['project_id'], 265 'project_id'=>$this->user['project_id'],
265 'url'=>str_replace_url($this->param['url']), 266 'url'=>str_replace_url($this->param['url']),
266 'language_id'=>$this->param['language_id'], 267 'language_id'=>$this->param['language_id'],
267 'alias'=>$this->param['alias'], 268 'alias'=>$this->param['alias'],
  269 + 'source'=>$sourceInfo['source'],
  270 + 'source_id'=>$sourceInfo['source_id'],
  271 + 'is_list'=>$sourceInfo['is_list'],
  272 + 'is_custom'=>$sourceInfo['is_custom']
268 ]; 273 ];
269 $param['data'] = json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); 274 $param['data'] = json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
270 $rs = $this->model->add($param); 275 $rs = $this->model->add($param);
@@ -303,16 +308,63 @@ class TranslateLogic extends BaseLogic @@ -303,16 +308,63 @@ class TranslateLogic extends BaseLogic
303 $route = basename($route); 308 $route = basename($route);
304 $routeModel = new RouteMap(); 309 $routeModel = new RouteMap();
305 $routeInfo = $routeModel->read(['route'=>$route]); 310 $routeInfo = $routeModel->read(['route'=>$route]);
  311 + return $this->resultData($routeInfo,$data);
  312 + }
  313 +
  314 + /**
  315 + * @remark :返回数据
  316 + * @name :resultData
  317 + * @author :lyh
  318 + * @method :post
  319 + * @time :2024/5/20 11:54
  320 + */
  321 + public function resultData($routeInfo,$data){
306 if($routeInfo['source'] == RouteMap::SOURCE_PAGE){ 322 if($routeInfo['source'] == RouteMap::SOURCE_PAGE){
307 if($routeInfo['source_id']){ 323 if($routeInfo['source_id']){
308 $data = ['source'=>9,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0]; 324 $data = ['source'=>9,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0];
309 } 325 }
310 } 326 }
311 - if($routeInfo['source'] == RouteMap::SOURCE_PAGE){ 327 + if($routeInfo['source'] == RouteMap::SOURCE_PRODUCT){
312 if($routeInfo['source_id']){ 328 if($routeInfo['source_id']){
313 - $data = ['source'=>9,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0]; 329 + $data = ['source'=>2,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0];
  330 + }
  331 + }
  332 + if($routeInfo['source'] == RouteMap::SOURCE_PRODUCT_CATE){
  333 + if($routeInfo['source_id']){
  334 + $data = ['source'=>2,'source_id'=>$routeInfo['source_id'],'is_list'=>1,'is_custom'=>0];
  335 + }
  336 + }
  337 + if($routeInfo['source'] == RouteMap::SOURCE_BLOG){
  338 + if($routeInfo['source_id']){
  339 + $data = ['source'=>3,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0];
  340 + }
  341 + }
  342 + if($routeInfo['source'] == RouteMap::SOURCE_BLOG_CATE){
  343 + if($routeInfo['source_id']){
  344 + $data = ['source'=>3,'source_id'=>$routeInfo['source_id'],'is_list'=>1,'is_custom'=>0];
  345 + }
  346 + }
  347 + if($routeInfo['source'] == RouteMap::SOURCE_NEWS){
  348 + if($routeInfo['source_id']){
  349 + $data = ['source'=>4,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0];
  350 + }
  351 + }
  352 + if($routeInfo['source'] == RouteMap::SOURCE_NEWS_CATE){
  353 + if($routeInfo['source_id']){
  354 + $data = ['source'=>4,'source_id'=>$routeInfo['source_id'],'is_list'=>1,'is_custom'=>0];
314 } 355 }
315 } 356 }
  357 + if($routeInfo['source'] == RouteMap::SOURCE_MODULE){
  358 + if($routeInfo['source_id']){
  359 + $data = ['source'=>7,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>1];
  360 + }
  361 + }
  362 + if($routeInfo['source'] == RouteMap::SOURCE_MODULE_CATE){
  363 + if($routeInfo['source_id']){
  364 + $data = ['source'=>7,'source_id'=>$routeInfo['source_id'],'is_list'=>1,'is_custom'=>1];
  365 + }
  366 + }
  367 + return $data;
316 } 368 }
317 369
318 /** 370 /**
@@ -34,6 +34,9 @@ class AyrReleaseRequest extends FormRequest @@ -34,6 +34,9 @@ class AyrReleaseRequest extends FormRequest
34 { 34 {
35 return [ 35 return [
36 'name.required'=>'参数错误', 36 'name.required'=>'参数错误',
  37 + 'content.required'=>'内容不能为空',
  38 + 'share_id.required'=>'参数错误',
  39 + 'platforms.required'=>'参数错误',
37 ]; 40 ];
38 } 41 }
39 } 42 }
@@ -46,6 +46,7 @@ class CopyImageFileJob implements ShouldQueue @@ -46,6 +46,7 @@ class CopyImageFileJob implements ShouldQueue
46 echo date('Y-m-d H:i:s') . '执行图片的数据id:' . $v['id'] . '名称:'.$v['name'] . PHP_EOL; 46 echo date('Y-m-d H:i:s') . '执行图片的数据id:' . $v['id'] . '名称:'.$v['name'] . PHP_EOL;
47 $amazonS3Service->syncImageFiles(getImageUrl($v['path'])); 47 $amazonS3Service->syncImageFiles(getImageUrl($v['path']));
48 $imageModel->edit(['is_cos'=>0],['id'=>$v['id']]); 48 $imageModel->edit(['is_cos'=>0],['id'=>$v['id']]);
  49 + gc_collect_cycles();
49 } 50 }
50 } 51 }
51 52
@@ -57,6 +58,7 @@ class CopyImageFileJob implements ShouldQueue @@ -57,6 +58,7 @@ class CopyImageFileJob implements ShouldQueue
57 echo date('Y-m-d H:i:s') . '执行文件的数据id:' . $v['id'] . '名称:'.$v['name'] . PHP_EOL; 58 echo date('Y-m-d H:i:s') . '执行文件的数据id:' . $v['id'] . '名称:'.$v['name'] . PHP_EOL;
58 $amazonS3Service->syncImageFiles(getFileUrl($v['path'])); 59 $amazonS3Service->syncImageFiles(getFileUrl($v['path']));
59 $fileModel->edit(['is_cos'=>0],['id'=>$v['id']]); 60 $fileModel->edit(['is_cos'=>0],['id'=>$v['id']]);
  61 + gc_collect_cycles();
60 } 62 }
61 } 63 }
62 return true; 64 return true;
@@ -68,6 +68,10 @@ class AmazonS3Service @@ -68,6 +68,10 @@ class AmazonS3Service
68 { 68 {
69 $file_content = curl_c($files,false); 69 $file_content = curl_c($files,false);
70 $key = str_replace_url($files); 70 $key = str_replace_url($files);
  71 + $parsedUrl = parse_url($key);
  72 + if(isset($parsedUrl['path'])){
  73 + $key = $parsedUrl['path'];
  74 + }
71 try { 75 try {
72 $result = $this->s3->putObject([ 76 $result = $this->s3->putObject([
73 'Bucket' => $this->bucket, 77 'Bucket' => $this->bucket,
@@ -51,7 +51,7 @@ return [ @@ -51,7 +51,7 @@ return [
51 'url' => env('AWS_URL'), 51 'url' => env('AWS_URL'),
52 'endpoint' => env('AWS_ENDPOINT'), 52 'endpoint' => env('AWS_ENDPOINT'),
53 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 53 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
54 - 'cdn'=>'https://globalso-v6.s3.us-west-2.amazonaws.com' 54 + 'cdn'=>'https://v6-file.globalso.com'
55 ], 55 ],
56 56
57 'upload' => [ 57 'upload' => [