作者 张关杰

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into bate

@@ -83,23 +83,28 @@ class DomainInfo extends Command @@ -83,23 +83,28 @@ class DomainInfo extends Command
83 public function startUpdateCert() 83 public function startUpdateCert()
84 { 84 {
85 $domainModel = new DomainInfoModel(); 85 $domainModel = new DomainInfoModel();
86 - $end_day = date('Y-m-d H:i:s', time() + 2 * 24 * 3600);//2天后到期 86 + $end_day = date('Y-m-d H:i:s', time() + 3 * 24 * 3600);//3天后到期
87 $list = $domainModel->where('status', '!=', 2)->where(function ($query) use ($end_day) { 87 $list = $domainModel->where('status', '!=', 2)->where(function ($query) use ($end_day) {
88 $query->whereNull('certificate_end_time')->orWhere('certificate_end_time', '<', $end_day); 88 $query->whereNull('certificate_end_time')->orWhere('certificate_end_time', '<', $end_day);
89 })->get()->toArray(); 89 })->get()->toArray();
90 foreach ($list as $v) { 90 foreach ($list as $v) {
91 //更新证书到期时间 91 //更新证书到期时间
92 $data = []; 92 $data = [];
  93 +
93 $ssl = $this->updateDomainSsl($v['domain']); 94 $ssl = $this->updateDomainSsl($v['domain']);
94 $ssl['from'] && $data['certificate_start_time'] = $ssl['from']; 95 $ssl['from'] && $data['certificate_start_time'] = $ssl['from'];
95 $ssl['to'] && $data['certificate_end_time'] = $ssl['to']; 96 $ssl['to'] && $data['certificate_end_time'] = $ssl['to'];
96 97
97 - $domainModel->edit($data, ['id' => $v['id']]);  
98 -  
99 - if ($v['type'] == 1 && ($data['certificate_end_time'] ?? '') < $end_day) { 98 + if ($v['type'] == 1 && $ssl['to'] < $end_day) {
100 //申请免费证书 99 //申请免费证书
101 $this->updatePrivate($v); 100 $this->updatePrivate($v);
  101 +
  102 + $ssl_new = $this->updateDomainSsl($v['domain']);
  103 + $ssl_new['from'] && $data['certificate_start_time'] = $ssl_new['from'];
  104 + $ssl_new['to'] && $data['certificate_end_time'] = $ssl_new['to'];
102 } 105 }
  106 +
  107 + $domainModel->edit($data, ['id' => $v['id']]);
103 } 108 }
104 } 109 }
105 110
@@ -111,7 +116,7 @@ class DomainInfo extends Command @@ -111,7 +116,7 @@ class DomainInfo extends Command
111 public function startUpdateAmpCert() 116 public function startUpdateAmpCert()
112 { 117 {
113 $domainModel = new DomainInfoModel(); 118 $domainModel = new DomainInfoModel();
114 - $end_day = date('Y-m-d H:i:s', time() + 2 * 24 * 3600);//2天后到期 119 + $end_day = date('Y-m-d H:i:s', time() + 3 * 24 * 3600);//3天后到期
115 $list = $domainModel->where('status', '!=', 2)->where('amp_status', 1)->where(function ($query) use ($end_day) { 120 $list = $domainModel->where('status', '!=', 2)->where('amp_status', 1)->where(function ($query) use ($end_day) {
116 $query->whereNull('amp_certificate_end_time')->orWhere('amp_certificate_end_time', '<', $end_day); 121 $query->whereNull('amp_certificate_end_time')->orWhere('amp_certificate_end_time', '<', $end_day);
117 })->get()->toArray(); 122 })->get()->toArray();
@@ -132,12 +137,16 @@ class DomainInfo extends Command @@ -132,12 +137,16 @@ class DomainInfo extends Command
132 $ssl['from'] && $data['amp_certificate_start_time'] = $ssl['from']; 137 $ssl['from'] && $data['amp_certificate_start_time'] = $ssl['from'];
133 $ssl['to'] && $data['amp_certificate_end_time'] = $ssl['to']; 138 $ssl['to'] && $data['amp_certificate_end_time'] = $ssl['to'];
134 139
135 - $domainModel->edit($data, ['id' => $v['id']]);  
136 -  
137 - if ($v['amp_type'] == 1 && ($data['amp_certificate_end_time'] ?? '') < $end_day) { 140 + if ($v['amp_type'] == 1 && $ssl['to'] < $end_day) {
138 //申请免费证书 141 //申请免费证书
139 $this->updateAmpPrivate($v['domain']); 142 $this->updateAmpPrivate($v['domain']);
  143 +
  144 + $ssl_new = $this->updateDomainSsl($v['domain']);
  145 + $ssl_new['from'] && $data['certificate_start_time'] = $ssl_new['from'];
  146 + $ssl_new['to'] && $data['certificate_end_time'] = $ssl_new['to'];
140 } 147 }
  148 +
  149 + $domainModel->edit($data, ['id' => $v['id']]);
141 } 150 }
142 } 151 }
143 152
@@ -149,7 +158,7 @@ class DomainInfo extends Command @@ -149,7 +158,7 @@ class DomainInfo extends Command
149 public function startUpdateCustomCert() 158 public function startUpdateCustomCert()
150 { 159 {
151 $customModel = new CountryCustom(); 160 $customModel = new CountryCustom();
152 - $end_day = date('Y-m-d H:i:s', time() + 2 * 24 * 3600);//2天后到期 161 + $end_day = date('Y-m-d H:i:s', time() + 3 * 24 * 3600);//3天后到期
153 $list = $customModel->where('status', 1)->where('is_create', 1)->where(function ($query) use ($end_day) { 162 $list = $customModel->where('status', 1)->where('is_create', 1)->where(function ($query) use ($end_day) {
154 $query->whereNull('certificate_end_time')->orWhere('certificate_end_time', '<', $end_day); 163 $query->whereNull('certificate_end_time')->orWhere('certificate_end_time', '<', $end_day);
155 })->get()->toArray(); 164 })->get()->toArray();
@@ -160,12 +169,16 @@ class DomainInfo extends Command @@ -160,12 +169,16 @@ class DomainInfo extends Command
160 $ssl['from'] && $data['certificate_start_time'] = $ssl['from']; 169 $ssl['from'] && $data['certificate_start_time'] = $ssl['from'];
161 $ssl['to'] && $data['certificate_end_time'] = $ssl['to']; 170 $ssl['to'] && $data['certificate_end_time'] = $ssl['to'];
162 171
163 - $customModel->edit($data, ['id' => $v['id']]);  
164 -  
165 - if ($v['type'] == 1 && ($data['certificate_end_time'] ?? '') < $end_day) { 172 + if ($v['type'] == 1 && $ssl['to'] < $end_day) {
166 //申请免费证书 173 //申请免费证书
167 $this->updateCustomPrivate($v['custom_domain']); 174 $this->updateCustomPrivate($v['custom_domain']);
  175 +
  176 + $ssl_new = $this->updateDomainSsl($v['domain']);
  177 + $ssl_new['from'] && $data['certificate_start_time'] = $ssl_new['from'];
  178 + $ssl_new['to'] && $data['certificate_end_time'] = $ssl_new['to'];
168 } 179 }
  180 +
  181 + $customModel->edit($data, ['id' => $v['id']]);
169 } 182 }
170 } 183 }
171 184
@@ -297,6 +310,8 @@ class DomainInfo extends Command @@ -297,6 +310,8 @@ class DomainInfo extends Command
297 */ 310 */
298 public function updateDomainSsl($domain) 311 public function updateDomainSsl($domain)
299 { 312 {
  313 + $valid_from = '';
  314 + $valid_to = '';
300 try { 315 try {
301 $context = stream_context_create([ 316 $context = stream_context_create([
302 'ssl' => [ 317 'ssl' => [
@@ -307,15 +322,13 @@ class DomainInfo extends Command @@ -307,15 +322,13 @@ class DomainInfo extends Command
307 ], 322 ],
308 ]); 323 ]);
309 $stream = stream_socket_client('ssl://' . $domain . ':443', $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $context); 324 $stream = stream_socket_client('ssl://' . $domain . ':443', $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $context);
310 - if (!$stream) {  
311 - die("Failed to connect: $errno - $errstr");  
312 - }  
313 - $remote_cert = stream_context_get_params($stream)['options']['ssl']['peer_certificate'];  
314 - if (!$remote_cert) {  
315 - die("Failed to retrieve certificate"); 325 + if($stream){
  326 + $remote_cert = stream_context_get_params($stream)['options']['ssl']['peer_certificate'];
  327 + if($remote_cert){
  328 + $valid_from = date('Y-m-d H:i:s', openssl_x509_parse($remote_cert)['validFrom_time_t']);
  329 + $valid_to = date('Y-m-d H:i:s', openssl_x509_parse($remote_cert)['validTo_time_t']);
  330 + }
316 } 331 }
317 - $valid_from = date('Y-m-d H:i:s', openssl_x509_parse($remote_cert)['validFrom_time_t']);  
318 - $valid_to = date('Y-m-d H:i:s', openssl_x509_parse($remote_cert)['validTo_time_t']);  
319 fclose($stream); 332 fclose($stream);
320 } catch (\Exception $e) { 333 } catch (\Exception $e) {
321 $valid_from = ''; 334 $valid_from = '';
@@ -65,7 +65,7 @@ class RankData extends BaseCommands @@ -65,7 +65,7 @@ class RankData extends BaseCommands
65 $error = 0; 65 $error = 0;
66 $api = new QuanqiusouApi(); 66 $api = new QuanqiusouApi();
67 //有排名api编号的项目 67 //有排名api编号的项目
68 - $list = DeployOptimize::where('api_no', '>', 0)->select('api_no', 'minor_languages', 'project_id')->get(); 68 + $list = DeployOptimize::where('api_no', '>', 0)->select('api_no', 'minor_languages', 'project_id')->orderBy('project_id', 'asc')->get();
69 Log::channel('rank_data')->info('开始-排名数据-' . count($list)); 69 Log::channel('rank_data')->info('开始-排名数据-' . count($list));
70 //当日所有站点谷歌收录数据 70 //当日所有站点谷歌收录数据
71 $site_res = $api->getSiteRes(); 71 $site_res = $api->getSiteRes();
@@ -73,7 +73,7 @@ class RankData extends BaseCommands @@ -73,7 +73,7 @@ class RankData extends BaseCommands
73 Log::channel('rank_data')->error('谷歌收录数据获取失败'); 73 Log::channel('rank_data')->error('谷歌收录数据获取失败');
74 } 74 }
75 foreach ($list as $item) { 75 foreach ($list as $item) {
76 - echo $item['api_no'] . PHP_EOL; 76 + Log::channel('rank_data')->info('项目开始:ID' . $item['project_id'] .' - '. $item['api_no']) . '';
77 try { 77 try {
78 (new RankDataLogic())->syncRankData($item['api_no'], $site_res); 78 (new RankDataLogic())->syncRankData($item['api_no'], $site_res);
79 } catch (\Exception $e) { 79 } catch (\Exception $e) {
@@ -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(['id'=>951]); 58 + $list = $projectModel->list(['id'=>687]);
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;
@@ -19,6 +19,7 @@ class Kernel extends ConsoleKernel @@ -19,6 +19,7 @@ class Kernel extends ConsoleKernel
19 $schedule->command('remain_day')->dailyAt('08:00')->withoutOverlapping(1); // 项目剩余服务时长 19 $schedule->command('remain_day')->dailyAt('08:00')->withoutOverlapping(1); // 项目剩余服务时长
20 $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务 20 $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务
21 $schedule->command('rank_data')->dailyAt('07:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次 21 $schedule->command('rank_data')->dailyAt('07:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次
  22 + $schedule->command('rank_data')->dailyAt('08:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次
22 $schedule->command('rank_data_speed')->dailyAt('01:10')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次 23 $schedule->command('rank_data_speed')->dailyAt('01:10')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次
23 $schedule->command('rank_data_external_links')->dailyAt('08:30')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次 24 $schedule->command('rank_data_external_links')->dailyAt('08:30')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次
24 $schedule->command('rank_data_external_links')->dailyAt('18:00')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次 25 $schedule->command('rank_data_external_links')->dailyAt('18:00')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次
@@ -80,7 +80,6 @@ class AyrReleaseController extends BaseController @@ -80,7 +80,6 @@ class AyrReleaseController extends BaseController
80 $param['youTubeOptions'] = ['title'=>$this->param['title']]; 80 $param['youTubeOptions'] = ['title'=>$this->param['title']];
81 } 81 }
82 } 82 }
83 -  
84 if(isset($this->param['schedule_date']) && !empty($this->param['schedule_date'])){ 83 if(isset($this->param['schedule_date']) && !empty($this->param['schedule_date'])){
85 $datetime = new \DateTime($this->param['schedule_date'] ?? date('Y-m-d H:i:s')); 84 $datetime = new \DateTime($this->param['schedule_date'] ?? date('Y-m-d H:i:s'));
86 $formattedTime = $datetime->format("Y-m-d\TH:i:s\Z"); 85 $formattedTime = $datetime->format("Y-m-d\TH:i:s\Z");
@@ -129,8 +129,8 @@ class FileController @@ -129,8 +129,8 @@ class FileController
129 $amazonS3Service = new AmazonS3Service(); 129 $amazonS3Service = new AmazonS3Service();
130 $amazonS3Service->uploadFiles($files,$this->path,$fileName); 130 $amazonS3Service->uploadFiles($files,$this->path,$fileName);
131 } 131 }
132 - $this->synchronizationFile($files->getClientOriginalExtension(),$fileName);  
133 $this->saveMysql($fileModel,$files->getSize(),$files->getClientOriginalExtension(),$fileName,$hash,$this->upload_location,$files->getMimeType(),$name); 132 $this->saveMysql($fileModel,$files->getSize(),$files->getClientOriginalExtension(),$fileName,$hash,$this->upload_location,$files->getMimeType(),$name);
  133 + $this->synchronizationFile($files->getClientOriginalExtension(),$fileName);
134 $this->response('资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name)); 134 $this->response('资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name));
135 } 135 }
136 136
@@ -142,14 +142,10 @@ class FileController @@ -142,14 +142,10 @@ class FileController
142 * @time :2024/4/8 11:10 142 * @time :2024/4/8 11:10
143 */ 143 */
144 public function synchronizationFile($file_type,$fileName){ 144 public function synchronizationFile($file_type,$fileName){
145 - $fileTypeArr = ['zip', 'pdf', 'mp4', 'doc', 'docx', 'm4v', 'xlsx'];  
146 - if(in_array($file_type,$fileTypeArr)){  
147 - //同步到大文件  
148 - $file_path = getFileUrl($this->path.'/'.$fileName,$this->cache['storage_type'] ?? 0);  
149 - $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php';  
150 - shell_exec($cmd);  
151 - }  
152 - return true; 145 + //同步到大文件
  146 + $file_path = getFileUrl($this->path.'/'.$fileName,$this->cache['storage_type'] ?? 0);
  147 + $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php';
  148 + shell_exec($cmd);
153 } 149 }
154 150
155 /** 151 /**
@@ -266,6 +262,7 @@ class FileController @@ -266,6 +262,7 @@ class FileController
266 $mime = $file->getMimeType(); 262 $mime = $file->getMimeType();
267 $this->saveMysql($fileModel,$size,$file_type,$fileName,$hash,$this->upload_location,$mime,$name); 263 $this->saveMysql($fileModel,$size,$file_type,$fileName,$hash,$this->upload_location,$mime,$name);
268 $data[] = $this->responseData($this->path.'/'.$fileName, $name); 264 $data[] = $this->responseData($this->path.'/'.$fileName, $name);
  265 + $this->synchronizationFile($file_type,$fileName);
269 } 266 }
270 $this->response('资源',Code::SUCCESS,$data); 267 $this->response('资源',Code::SUCCESS,$data);
271 } 268 }
@@ -210,10 +210,25 @@ class ImageController extends Controller @@ -210,10 +210,25 @@ class ImageController extends Controller
210 $amazonS3Service->uploadFiles($files,$this->path,$fileName); 210 $amazonS3Service->uploadFiles($files,$this->path,$fileName);
211 } 211 }
212 $this->saveMysql($imageModel,$files->getSize(),$image_type,$fileName,$hash,$this->upload_location,$files->getMimeType(), $name); 212 $this->saveMysql($imageModel,$files->getSize(),$image_type,$fileName,$hash,$this->upload_location,$files->getMimeType(), $name);
  213 + $this->synchronizationImage($fileName);
213 return $this->response('图片资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name)); 214 return $this->response('图片资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name));
214 } 215 }
215 216
216 /** 217 /**
  218 + * @remark :指定同步文件到獨立177服務器
  219 + * @name :synchronizationFile
  220 + * @author :lyh
  221 + * @method :post
  222 + * @time :2024/4/8 11:10
  223 + */
  224 + public function synchronizationImage($fileName){
  225 + //同步到大文件
  226 + $file_path = getImageUrl($this->path.'/'.$fileName,$this->cache['storage_type'] ?? 0);
  227 + $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php';
  228 + shell_exec($cmd);
  229 + }
  230 +
  231 + /**
217 * @remark :保存数据库 232 * @remark :保存数据库
218 * @name :saveMysql 233 * @name :saveMysql
219 * @author :lyh 234 * @author :lyh
@@ -290,6 +305,7 @@ class ImageController extends Controller @@ -290,6 +305,7 @@ class ImageController extends Controller
290 } 305 }
291 //批量存储 306 //批量存储
292 $this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name); 307 $this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name);
  308 + $this->synchronizationImage($fileName);
293 $data[] = $this->responseData($this->path.'/'.$fileName,$name); 309 $data[] = $this->responseData($this->path.'/'.$fileName,$name);
294 } 310 }
295 $this->response('图片资源',Code::SUCCESS,$data); 311 $this->response('图片资源',Code::SUCCESS,$data);
@@ -266,6 +266,8 @@ class ProjectLogic extends BaseLogic @@ -266,6 +266,8 @@ class ProjectLogic extends BaseLogic
266 protected function saveProjectDeployBuild($deploy_build){ 266 protected function saveProjectDeployBuild($deploy_build){
267 $deployBuildModel = new DeployBuild(); 267 $deployBuildModel = new DeployBuild();
268 $deploy_build['configuration'] = Arr::a2s(!empty($deploy_build['configuration']) ? $deploy_build['configuration'] : []); 268 $deploy_build['configuration'] = Arr::a2s(!empty($deploy_build['configuration']) ? $deploy_build['configuration'] : []);
  269 + $deploy_build['main_verify_file'] = $deploy_build['main_verify_file'] ?? '';
  270 + $deploy_build['amp_verify_file'] = $deploy_build['amp_verify_file'] ?? '';
269 $deployBuildModel->edit($deploy_build,['id'=>$deploy_build['id']]); 271 $deployBuildModel->edit($deploy_build,['id'=>$deploy_build['id']]);
270 return $this->success(); 272 return $this->success();
271 } 273 }
@@ -59,18 +59,18 @@ class AyrReleaseLogic extends BaseLogic @@ -59,18 +59,18 @@ class AyrReleaseLogic extends BaseLogic
59 */ 59 */
60 public function image_file_param($data) { 60 public function image_file_param($data) {
61 $arr = []; 61 $arr = [];
62 - foreach ($data as $k => $v){  
63 - if($k == 'images'){  
64 - foreach ($v as $v1){  
65 - $v1 = 'https://file.globalso.com'.str_replace_url($v1);  
66 - $arr[] = $v1; 62 + if(!empty($data)){
  63 + foreach ($data as $k => $v){
  64 + if($k == 'images'){
  65 + foreach ($v as $v1){
  66 + $arr[] = getImageUrl($v1);
  67 + }
  68 + }else{
  69 + $arr[] = getFileUrl($v);
67 } 70 }
68 - }else{  
69 - $v = 'https://file.globalso.com'.str_replace_url($v);  
70 - $arr[] = $v;  
71 } 71 }
72 } 72 }
73 - return $this->success($arr); 73 + return $this->success($arr);
74 } 74 }
75 75
76 } 76 }
@@ -518,8 +518,6 @@ class ProductLogic extends BaseLogic @@ -518,8 +518,6 @@ class ProductLogic extends BaseLogic
518 'created_uid'=>$this->user['id'], 518 'created_uid'=>$this->user['id'],
519 'created_at'=>date('Y-m-d H:i:s'), 519 'created_at'=>date('Y-m-d H:i:s'),
520 'updated_at'=>date('Y-m-d H:i:s'), 520 'updated_at'=>date('Y-m-d H:i:s'),
521 - 'six_read'=>$info['six_read'],  
522 - 'is_upgrade'=>$info['is_upgrade']  
523 ]; 521 ];
524 if(isset($info['icon']) && !empty($info['icon'])){ 522 if(isset($info['icon']) && !empty($info['icon'])){
525 foreach ($info['icon'] as $k1 => $v1){ 523 foreach ($info['icon'] as $k1 => $v1){
@@ -724,7 +724,7 @@ class RankDataLogic extends BaseLogic @@ -724,7 +724,7 @@ class RankDataLogic extends BaseLogic
724 } 724 }
725 725
726 $rank_week->project_id = $project_id; 726 $rank_week->project_id = $project_id;
727 - $rank_week->data = $res['data'][$api_no]; 727 + $rank_week->data = $res['data'][$api_no] ?? [];
728 $rank_week->date = $res['date']; 728 $rank_week->date = $res['date'];
729 $rank_week->updated_date = date('Y-m-d'); 729 $rank_week->updated_date = date('Y-m-d');
730 $rank_week->save(); 730 $rank_week->save();
@@ -26,17 +26,18 @@ class TranslateLogic extends BaseLogic @@ -26,17 +26,18 @@ class TranslateLogic extends BaseLogic
26 } 26 }
27 27
28 /** 28 /**
29 - * 获取翻译校对文案  
30 - * @return array  
31 - * @throws \App\Exceptions\AsideGlobalException  
32 - * @throws \App\Exceptions\BsideGlobalException 29 + * @remark :
  30 + * @name :getTranslateList
  31 + * @author :lyh
  32 + * @method :post
  33 + * @time :2024/4/9 10:59
33 */ 34 */
34 public function getTranslateList(){ 35 public function getTranslateList(){
35 $data = []; 36 $data = [];
36 - if($this->param['url'] == 'All'){ 37 + if($this->param['url'] == 'All' || $this->param['url'] == 'other_all_text'){
37 $info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]); 38 $info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]);
38 if(!empty($info) && !empty($info['data'])){ 39 if(!empty($info) && !empty($info['data'])){
39 - $translateInfo = json_decode($info['data'],JSON_UNESCAPED_UNICODE); 40 + $translateInfo = json_decode($info['data'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
40 foreach ($translateInfo as $k => $v){ 41 foreach ($translateInfo as $k => $v){
41 $data[] = [$k=>$v]; 42 $data[] = [$k=>$v];
42 } 43 }
@@ -49,18 +50,22 @@ class TranslateLogic extends BaseLogic @@ -49,18 +50,22 @@ class TranslateLogic extends BaseLogic
49 $languageInfo = $this->getLanguage($this->param['language_id']); 50 $languageInfo = $this->getLanguage($this->param['language_id']);
50 // 原始校对内容 51 // 原始校对内容
51 $info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]); 52 $info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]);
  53 + //获取当前URl的所有文本内容
  54 + $text_array = $this->getUrlRead($url);
  55 + // 原始校对程序
  56 + $old_key = [];//key值组成数据
52 if($info !== false){ 57 if($info !== false){
53 - $data_read = json_decode($info['data'],JSON_UNESCAPED_UNICODE); 58 + $data_read = json_decode($info['data'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
54 foreach ($data_read as $k => $v){ 59 foreach ($data_read as $k => $v){
  60 + $old_key[] = $k;
55 $data[] = [$k => $v]; 61 $data[] = [$k => $v];
56 } 62 }
57 - return $this->success($data);  
58 - }else{  
59 - //获取当前URl的所有文本内容  
60 - $text_array = $this->getUrlRead($url); 63 + }
  64 + $arr2 = array_values(array_diff($text_array, $old_key));
  65 + if(!empty($arr2)){
61 $i = 0; 66 $i = 0;
62 TranslateText: 67 TranslateText:
63 - $translate_list = Translate::tran($text_array, $languageInfo['short']); 68 + $translate_list = Translate::tran($arr2, $languageInfo['short']);
64 if(empty($translate_list)){ 69 if(empty($translate_list)){
65 if ($i < 3) { 70 if ($i < 3) {
66 $i++; 71 $i++;
@@ -68,57 +73,22 @@ class TranslateLogic extends BaseLogic @@ -68,57 +73,22 @@ class TranslateLogic extends BaseLogic
68 } 73 }
69 $this->fail('翻译失败,请稍后重试!'); 74 $this->fail('翻译失败,请稍后重试!');
70 } 75 }
71 - if(count($text_array) == 1){ 76 + if(count($arr2) == 1){
72 $data[] = [ 77 $data[] = [
73 - $text_array[0]=>$translate_list 78 + $arr2[0]=>$translate_list
74 ]; 79 ];
75 }else{ 80 }else{
76 - foreach ($text_array as $k => $v){ 81 + foreach ($arr2 as $k => $v){
77 $data[] = [ 82 $data[] = [
78 $v=>$translate_list[$k] 83 $v=>$translate_list[$k]
79 ]; 84 ];
80 } 85 }
  86 +
81 } 87 }
82 - return $this->success($data);  
83 } 88 }
  89 + return $this->success($data);
84 } 90 }
85 91
86 - // $old_key = [];//key值组成数据  
87 - // if($info !== false){  
88 - // $data_read = json_decode($info['data']);  
89 - // foreach ($data_read as $k => $v){  
90 - //// if(!in_array($k,$text_array)){  
91 - //// $arr2[] = $k;  
92 - //// }  
93 - //// $old_key[] = $k;  
94 - // $data[] = [$k => $v];  
95 - // }  
96 - // }else{  
97 - // $arr2 = array_values(array_diff($text_array, $old_key));  
98 - // }  
99 - // if(!empty($arr2)){  
100 - // $i = 0;  
101 - // TranslateText:  
102 - // $translate_list = Translate::tran($arr2, $languageInfo['short']);  
103 - // if(empty($translate_list)){  
104 - // if ($i < 3) {  
105 - // $i++;  
106 - // goto TranslateText;  
107 - // }  
108 - // $this->fail('翻译失败,请稍后重试!');  
109 - // }  
110 - // if(count($arr2) == 1){  
111 - // $data[] = [  
112 - // $arr2[0]=>$translate_list  
113 - // ];  
114 - // }else{  
115 - // foreach ($arr2 as $k => $v){  
116 - // $data[] = [  
117 - // $v=>$translate_list[$k]  
118 - // ];  
119 - // }  
120 - // }  
121 - // }  
122 92
123 /** 93 /**
124 * @remark :获取图片列表 94 * @remark :获取图片列表
@@ -153,7 +123,7 @@ class TranslateLogic extends BaseLogic @@ -153,7 +123,7 @@ class TranslateLogic extends BaseLogic
153 } 123 }
154 $new_list = $this->getUrlImageRead($url); 124 $new_list = $this->getUrlImageRead($url);
155 $old_list = []; 125 $old_list = [];
156 - $data_read = json_decode($info['data'],JSON_UNESCAPED_UNICODE); 126 + $data_read = json_decode($info['data'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
157 foreach ($data_read as $k=>$v){ 127 foreach ($data_read as $k=>$v){
158 $old_list[] = $k; 128 $old_list[] = $k;
159 $data[] = [ 129 $data[] = [
@@ -285,11 +255,11 @@ class TranslateLogic extends BaseLogic @@ -285,11 +255,11 @@ class TranslateLogic extends BaseLogic
285 'language_id'=>$this->param['language_id'], 255 'language_id'=>$this->param['language_id'],
286 'alias'=>$this->param['alias'], 256 'alias'=>$this->param['alias'],
287 ]; 257 ];
288 - $param['data'] = json_encode($data,JSON_UNESCAPED_UNICODE); 258 + $param['data'] = json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
289 $this->model->add($param); 259 $this->model->add($param);
290 }else{ 260 }else{
291 if(!empty($data)){ 261 if(!empty($data)){
292 - $data = json_encode($data,JSON_UNESCAPED_UNICODE); 262 + $data = json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
293 $this->model->edit(['data'=>$data],['language_id'=>$this->param['language_id'],'project_id'=>$this->user['project_id'],'url'=>$this->param['url'],'type'=>$this->param['type']]); 263 $this->model->edit(['data'=>$data],['language_id'=>$this->param['language_id'],'project_id'=>$this->user['project_id'],'url'=>$this->param['url'],'type'=>$this->param['type']]);
294 } 264 }
295 } 265 }
@@ -4,6 +4,7 @@ namespace App\Models\Inquiry; @@ -4,6 +4,7 @@ namespace App\Models\Inquiry;
4 4
5 use App\Helper\FormGlobalsoApi; 5 use App\Helper\FormGlobalsoApi;
6 use App\Models\Base; 6 use App\Models\Base;
  7 +use App\Utils\LogUtils;
7 use Illuminate\Database\Eloquent\SoftDeletes; 8 use Illuminate\Database\Eloquent\SoftDeletes;
8 use Illuminate\Support\Facades\DB; 9 use Illuminate\Support\Facades\DB;
9 10
@@ -83,7 +84,10 @@ class InquiryFormData extends Base @@ -83,7 +84,10 @@ class InquiryFormData extends Base
83 $data['message'].= "<br/>" . $k .': ' . $v; 84 $data['message'].= "<br/>" . $k .': ' . $v;
84 } 85 }
85 } 86 }
86 - !$has_file && (new FormGlobalsoApi())->submitInquiry($ip, $referer, $submit_at, $data); 87 + if(!$has_file) {
  88 + $res = (new FormGlobalsoApi())->submitInquiry($ip, $referer, $submit_at, $data);
  89 + LogUtils::info('询盘提交', $data, $res?: []);
  90 + }
87 } 91 }
88 return true; 92 return true;
89 } 93 }
@@ -13,8 +13,6 @@ use Illuminate\Database\Eloquent\SoftDeletes; @@ -13,8 +13,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
13 */ 13 */
14 class Category extends Base 14 class Category extends Base
15 { 15 {
16 - use SoftDeletes;  
17 -  
18 //设置关联表名 16 //设置关联表名
19 protected $table = 'gl_product_category'; 17 protected $table = 'gl_product_category';
20 //连接数据库 18 //连接数据库
@@ -69,7 +69,8 @@ class SyncSubmitTaskService @@ -69,7 +69,8 @@ class SyncSubmitTaskService
69 ]; 69 ];
70 70
71 if(Str::contains($referer, $url)){ 71 if(Str::contains($referer, $url)){
72 - $referer = pathinfo($referer,PATHINFO_DIRNAME); 72 + $referer = parse_url($referer);
  73 + $referer = !empty($referer['host']) ? $referer['scheme'] . '://' . $referer['host'] . '/' : $referer['path'];
73 } 74 }
74 return $referer; 75 return $referer;
75 } 76 }
@@ -171,8 +172,8 @@ class SyncSubmitTaskService @@ -171,8 +172,8 @@ class SyncSubmitTaskService
171 throw new InquiryFilterException('项目不存在'); 172 throw new InquiryFilterException('项目不存在');
172 } 173 }
173 174
174 - // 测试环境返回信息  
175 - if (FALSE !== strpos($domain, 'globalso.site') && !$project->is_record_test_visit) { 175 + // 访问记录过滤测试环境
  176 + if ($type == SyncSubmitTask::TYPE_VISIT && FALSE !== strpos($domain, 'globalso.site') && !$project->is_record_test_visit) {
176 throw new InquiryFilterException('测试环境过滤'); 177 throw new InquiryFilterException('测试环境过滤');
177 } 178 }
178 179
@@ -180,8 +181,8 @@ class SyncSubmitTaskService @@ -180,8 +181,8 @@ class SyncSubmitTaskService
180 throw new InquiryFilterException('127.0.0.1过滤'); 181 throw new InquiryFilterException('127.0.0.1过滤');
181 } 182 }
182 $country = self::getCountryByIp($ip); 183 $country = self::getCountryByIp($ip);
183 - //访问记录才过滤是否国内  
184 - if ($country == "中国" && !$project->is_record_china_visit && $type == SyncSubmitTask::TYPE_VISIT){ 184 + //访问记录过滤国内
  185 + if ($type == SyncSubmitTask::TYPE_VISIT && $country == "中国" && !$project->is_record_china_visit){
185 throw new InquiryFilterException('中国内地过滤'); 186 throw new InquiryFilterException('中国内地过滤');
186 } 187 }
187 return [ 188 return [