作者 刘锟

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

@@ -16,8 +16,12 @@ use App\Models\Domain\DomainInfo; @@ -16,8 +16,12 @@ use App\Models\Domain\DomainInfo;
16 use App\Models\Product\Keyword; 16 use App\Models\Product\Keyword;
17 use App\Models\Product\Product; 17 use App\Models\Product\Product;
18 use App\Models\RouteMap\RouteMap; 18 use App\Models\RouteMap\RouteMap;
  19 +use App\Models\Template\BSettingTemplate;
  20 +use App\Models\Template\BTemplateCommon;
  21 +use App\Models\Template\Setting;
19 use App\Services\ProjectServer; 22 use App\Services\ProjectServer;
20 use Illuminate\Console\Command; 23 use Illuminate\Console\Command;
  24 +use Illuminate\Support\Facades\Cache;
21 use Illuminate\Support\Facades\DB; 25 use Illuminate\Support\Facades\DB;
22 use Illuminate\Support\Facades\Http; 26 use Illuminate\Support\Facades\Http;
23 use Illuminate\Support\Facades\Log; 27 use Illuminate\Support\Facades\Log;
@@ -97,6 +101,7 @@ class VideoTask extends Command @@ -97,6 +101,7 @@ class VideoTask extends Command
97 $task_project->save(); 101 $task_project->save();
98 continue; 102 continue;
99 } 103 }
  104 + $logo_bg = $this->getImage($domainInfo);
100 foreach ($keyword as $val) { 105 foreach ($keyword as $val) {
101 $log = KeywordVideoTaskLog::where(['project_id' => $task_project->project_id, 'keyword_id' => $val->id])->first(); 106 $log = KeywordVideoTaskLog::where(['project_id' => $task_project->project_id, 'keyword_id' => $val->id])->first();
102 if ($log){ 107 if ($log){
@@ -109,7 +114,7 @@ class VideoTask extends Command @@ -109,7 +114,7 @@ class VideoTask extends Command
109 'keyword' => $val->title, 114 'keyword' => $val->title,
110 'data' => json_encode(['url' => $keywordInfo['url'],'title' => $keywordInfo['title'], 115 'data' => json_encode(['url' => $keywordInfo['url'],'title' => $keywordInfo['title'],
111 'description' => $keywordInfo['keyword_content'], 'images' => $keywordInfo['product_list'], 116 'description' => $keywordInfo['keyword_content'], 'images' => $keywordInfo['product_list'],
112 - 'keywords' => $keywordInfo['keyword_list']]), 117 + 'keywords' => $keywordInfo['keyword_list'], 'logo_bg' => $logo_bg]),
113 'status' => KeywordVideoTaskLog::STATUS_INIT, 118 'status' => KeywordVideoTaskLog::STATUS_INIT,
114 'updated_at' => date('Y-m-d H:i:s'), 119 'updated_at' => date('Y-m-d H:i:s'),
115 'created_at' => date('Y-m-d H:i:s'), 120 'created_at' => date('Y-m-d H:i:s'),
@@ -130,10 +135,11 @@ class VideoTask extends Command @@ -130,10 +135,11 @@ class VideoTask extends Command
130 public function sendSubTask() 135 public function sendSubTask()
131 { 136 {
132 $subTask = KeywordVideoTaskLog::where(['status' => KeywordVideoTaskLog::STATUS_INIT])->orderBy('id', 'asc')->limit($this->max_sub_task)->get(); 137 $subTask = KeywordVideoTaskLog::where(['status' => KeywordVideoTaskLog::STATUS_INIT])->orderBy('id', 'asc')->limit($this->max_sub_task)->get();
133 - if ($subTask->isEmpty()) 138 + if ($subTask->isEmpty()){
134 return true; 139 return true;
  140 + }
135 foreach ($subTask as $val) { 141 foreach ($subTask as $val) {
136 - $valData = (array)json_decode($val->data); 142 + $valData = json_decode($val->data,true);
137 $task_id = 'v6-' . uniqid(); 143 $task_id = 'v6-' . uniqid();
138 $data = [ 144 $data = [
139 'project_data' => [ 145 'project_data' => [
@@ -141,7 +147,9 @@ class VideoTask extends Command @@ -141,7 +147,9 @@ class VideoTask extends Command
141 'title' => $valData['title'], 147 'title' => $valData['title'],
142 'keywords' => $valData['keywords'], 148 'keywords' => $valData['keywords'],
143 'description' => $valData['description'], 149 'description' => $valData['description'],
144 - 'images' => $valData['images'] 150 + 'images' => $valData['images'],
  151 + 'logo'=> $valData['logo_bg']['logo'] ?? '',
  152 + 'bg'=> $valData['logo_bg']['bg'] ?? ''
145 ], 153 ],
146 'task_id' => $task_id, 154 'task_id' => $task_id,
147 'callback_url' => env('APP_URL') . '/api/video_task_callback', 155 'callback_url' => env('APP_URL') . '/api/video_task_callback',
@@ -262,4 +270,24 @@ class VideoTask extends Command @@ -262,4 +270,24 @@ class VideoTask extends Command
262 return $data; 270 return $data;
263 } 271 }
264 272
  273 + /**
  274 + * @remark :获取图片
  275 + * @name :getImage
  276 + * @author :lyh
  277 + * @method :post
  278 + * @time :2024/3/12 15:29
  279 + */
  280 + public function getImage($domainInfo){
  281 + $dom = file_get_html('https://'.$domainInfo['domain'].'/');
  282 + $logoDom = $dom->find('.logo', 0)->find("img",0);
  283 + if($logoDom != null){
  284 + $logo = $logoDom->src;
  285 + }
  286 + $bgDom = $dom->find('.section-banner-wrap-block',0)->find('img', 0);
  287 + if($bgDom != null){
  288 + $bg = $bgDom->src;
  289 + }
  290 + $dom->clear();
  291 + return ['logo'=>$logo ?? '','bg'=>$bg ?? ''];
  292 + }
265 } 293 }
@@ -265,7 +265,24 @@ class Demo extends Command @@ -265,7 +265,24 @@ class Demo extends Command
265 // print_r($include); 265 // print_r($include);
266 // } 266 // }
267 public function handle(){ 267 public function handle(){
268 - echo '加密字符串:'.md5('company_list+2024-03-05+prod_desc=led&total=10'); 268 + $domainModel = new DomainInfo();
  269 + $domainInfo = $domainModel->read(['project_id'=>1]);
  270 + if($domainInfo === false){
  271 + dd('11111');
  272 + }
  273 + $bg = '';
  274 + $logo = '';
  275 + $dom = file_get_html('https://'.$domainInfo['domain'].'/');
  276 + $logoDom = $dom->find('.logo', 0)->find("img",0);
  277 + if($logoDom != null){
  278 + $logo = $logoDom->src;
  279 + }
  280 + $bgDom = $dom->find('.section-banner-wrap-block',0)->find('img', 0);
  281 + if($bgDom != null){
  282 + $bg = $bgDom->src;
  283 + }
  284 +// return $logo;
  285 + dd(['logo'=>$logo ?? '','ng'=>$bg ?? '']);
269 // $projectModel = new Project(); 286 // $projectModel = new Project();
270 // $list = $projectModel->list(['delete_status'=>0,'type'=>['!=',0]]); 287 // $list = $projectModel->list(['delete_status'=>0,'type'=>['!=',0]]);
271 // foreach ($list as $v1){ 288 // foreach ($list as $v1){
@@ -25,13 +25,13 @@ class Kernel extends ConsoleKernel @@ -25,13 +25,13 @@ class Kernel extends ConsoleKernel
25 $schedule->command('rank_data_recomm_domain')->dailyAt('01:40')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次 25 $schedule->command('rank_data_recomm_domain')->dailyAt('01:40')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次
26 $schedule->command('rank_data_week')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次 26 $schedule->command('rank_data_week')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次
27 // $schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次 27 // $schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次
28 - $schedule->command('count')->dailyAt('00:30')->withoutOverlapping(1); //每天凌晨1点执行一次 28 +// $schedule->command('count')->dailyAt('00:30')->withoutOverlapping(1); //每天凌晨1点执行一次
29 $schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次 29 $schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次
30 $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次 30 $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次
31 $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次 31 $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次
32 $schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次 32 $schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次
33 $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次 33 $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次
34 - $schedule->command('month_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计记录 34 +// $schedule->command('month_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计记录
35 $schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录 35 $schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录
36 $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次 36 $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次
37 $schedule->command('inquiry_count')->dailyAt('01:00')->withoutOverlapping(1); // 询盘统计数据,每天凌晨执行一次 37 $schedule->command('inquiry_count')->dailyAt('01:00')->withoutOverlapping(1); // 询盘统计数据,每天凌晨执行一次
@@ -45,9 +45,9 @@ class Kernel extends ConsoleKernel @@ -45,9 +45,9 @@ class Kernel extends ConsoleKernel
45 45
46 $schedule->command('recommended_suppliers')->dailyAt('03:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商 46 $schedule->command('recommended_suppliers')->dailyAt('03:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商
47 // 每日推送视频任务 47 // 每日推送视频任务
48 - $schedule->command('video_task')->dailyAt('01:30')->withoutOverlapping(1); 48 + $schedule->command('video_task')->dailyAt('03:30')->withoutOverlapping(1);
49 // 每日推送已完成视频任务项目生成对应界面 49 // 每日推送已完成视频任务项目生成对应界面
50 - $schedule->command('notice_c')->dailyAt('02:00')->withoutOverlapping(1); 50 + $schedule->command('notice_c')->dailyAt('04:00')->withoutOverlapping(1);
51 } 51 }
52 52
53 /** 53 /**
@@ -264,8 +264,8 @@ class ProjectController extends BaseController @@ -264,8 +264,8 @@ class ProjectController extends BaseController
264 if(isset($this->map['tech_mid'])){ 264 if(isset($this->map['tech_mid'])){
265 $query = $query->where('gl_project_deploy_optimize.tech_mid',$this->map['tech_mid']); 265 $query = $query->where('gl_project_deploy_optimize.tech_mid',$this->map['tech_mid']);
266 } 266 }
267 - if(isset($this->map['optimist_mid'])){  
268 - $query = $query->where('gl_project_deploy_optimize.optimist_mid',$this->map['optimist_mid']); 267 + if(isset($this->map['optimize_optimist_mid'])){
  268 + $query = $query->where('gl_project_deploy_optimize.optimist_mid',$this->map['optimize_optimist_mid']);
269 } 269 }
270 return $query; 270 return $query;
271 } 271 }
@@ -34,7 +34,7 @@ class TranslateLogic extends BaseLogic @@ -34,7 +34,7 @@ class TranslateLogic extends BaseLogic
34 if($this->param['url'] == 'All'){ 34 if($this->param['url'] == 'All'){
35 $info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]); 35 $info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]);
36 if(!empty($info) && !empty($info['data'])){ 36 if(!empty($info) && !empty($info['data'])){
37 - $translateInfo = json_decode($info['data'],JSON_UNESCAPED_UNICODE); 37 + $translateInfo = json_decode($info['data']);
38 foreach ($translateInfo as $k => $v){ 38 foreach ($translateInfo as $k => $v){
39 $data[] = [$k=>$v]; 39 $data[] = [$k=>$v];
40 } 40 }
@@ -52,13 +52,17 @@ class TranslateLogic extends BaseLogic @@ -52,13 +52,17 @@ class TranslateLogic extends BaseLogic
52 // 原始校对程序 52 // 原始校对程序
53 $old_key = [];//key值组成数据 53 $old_key = [];//key值组成数据
54 if($info !== false){ 54 if($info !== false){
55 - $data_read = json_decode($info['data'],JSON_UNESCAPED_UNICODE); 55 + $data_read = json_decode($info['data']);
56 foreach ($data_read as $k => $v){ 56 foreach ($data_read as $k => $v){
57 - $old_key[] = trim($k); 57 +// if(!in_array($k,$text_array)){
  58 +// $arr2[] = $k;
  59 +// }
  60 +// $old_key[] = $k;
58 $data[] = [$k => $v]; 61 $data[] = [$k => $v];
59 } 62 }
  63 + }else{
  64 + $arr2 = array_values(array_diff($text_array, $old_key));
60 } 65 }
61 - $arr2 = array_values(array_diff($text_array, $old_key));  
62 if(!empty($arr2)){ 66 if(!empty($arr2)){
63 $i = 0; 67 $i = 0;
64 TranslateText: 68 TranslateText:
@@ -77,10 +81,9 @@ class TranslateLogic extends BaseLogic @@ -77,10 +81,9 @@ class TranslateLogic extends BaseLogic
77 }else{ 81 }else{
78 foreach ($arr2 as $k => $v){ 82 foreach ($arr2 as $k => $v){
79 $data[] = [ 83 $data[] = [
80 - trim($v)=>$translate_list[$k] 84 + $v=>$translate_list[$k]
81 ]; 85 ];
82 } 86 }
83 -  
84 } 87 }
85 } 88 }
86 return $this->success($data); 89 return $this->success($data);
@@ -99,7 +102,7 @@ class TranslateLogic extends BaseLogic @@ -99,7 +102,7 @@ class TranslateLogic extends BaseLogic
99 $info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]); 102 $info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]);
100 $data = []; 103 $data = [];
101 if(!empty($info) && !empty($info['data'])){ 104 if(!empty($info) && !empty($info['data'])){
102 - $translateInfo = json_decode($info['data'],JSON_UNESCAPED_UNICODE); 105 + $translateInfo = json_decode($info['data']);
103 foreach ($translateInfo as $k => $v){ 106 foreach ($translateInfo as $k => $v){
104 $data[] = [$k=>$v]; 107 $data[] = [$k=>$v];
105 } 108 }
@@ -120,7 +123,7 @@ class TranslateLogic extends BaseLogic @@ -120,7 +123,7 @@ class TranslateLogic extends BaseLogic
120 } 123 }
121 $new_list = $this->getUrlImageRead($url); 124 $new_list = $this->getUrlImageRead($url);
122 $old_list = []; 125 $old_list = [];
123 - $data_read = json_decode($info['data'],JSON_UNESCAPED_UNICODE); 126 + $data_read = json_decode($info['data']);
124 foreach ($data_read as $k=>$v){ 127 foreach ($data_read as $k=>$v){
125 $old_list[] = $k; 128 $old_list[] = $k;
126 $data[] = [ 129 $data[] = [
@@ -182,11 +185,12 @@ class TranslateLogic extends BaseLogic @@ -182,11 +185,12 @@ class TranslateLogic extends BaseLogic
182 if(FALSE !== strpos($country_class, 'country-flag')) { 185 if(FALSE !== strpos($country_class, 'country-flag')) {
183 continue; 186 continue;
184 } 187 }
185 - $need_tran[] = trim(htmlspecialchars_decode(html_entity_decode($string))); 188 + if(!in_array(htmlspecialchars_decode(html_entity_decode($string)),$need_tran)){
  189 + $need_tran[] = htmlspecialchars_decode(html_entity_decode($string));
  190 + }
186 } 191 }
187 $need_tran[] = $description ? $description->attr['content'] : ''; 192 $need_tran[] = $description ? $description->attr['content'] : '';
188 $need_tran[] = $keywords ? $keywords->attr['content'] : ''; 193 $need_tran[] = $keywords ? $keywords->attr['content'] : '';
189 - $need_tran = array_unique($need_tran);  
190 return $need_tran; 194 return $need_tran;
191 } 195 }
192 196
@@ -250,10 +254,10 @@ class TranslateLogic extends BaseLogic @@ -250,10 +254,10 @@ class TranslateLogic extends BaseLogic
250 'language_id'=>$this->param['language_id'], 254 'language_id'=>$this->param['language_id'],
251 'alias'=>$this->param['alias'], 255 'alias'=>$this->param['alias'],
252 ]; 256 ];
253 - $param['data'] = json_encode($data,JSON_UNESCAPED_UNICODE); 257 + $param['data'] = json_encode($data);
254 $this->model->add($param); 258 $this->model->add($param);
255 }else{ 259 }else{
256 - $data = json_encode($data,JSON_UNESCAPED_UNICODE); 260 + $data = json_encode($data);
257 $this->model->edit(['data'=>$data],['language_id'=>$this->param['language_id'],'url'=>$this->param['url'],'type'=>$this->param['type']]); 261 $this->model->edit(['data'=>$data],['language_id'=>$this->param['language_id'],'url'=>$this->param['url'],'type'=>$this->param['type']]);
258 } 262 }
259 }catch (\Exception $e){ 263 }catch (\Exception $e){
@@ -7,11 +7,8 @@ @@ -7,11 +7,8 @@
7 */ 7 */
8 namespace App\Services\Html; 8 namespace App\Services\Html;
9 9
10 -use App\Enums\Common\Code;  
11 -use App\Models\Product\Keyword;  
12 use App\Models\Project\Project; 10 use App\Models\Project\Project;
13 use App\Models\RouteMap\RouteMap; 11 use App\Models\RouteMap\RouteMap;
14 -use App\Models\WebSetting\WebSettingSeo;  
15 use App\Services\TdkService; 12 use App\Services\TdkService;
16 13
17 class CreateHtmlService 14 class CreateHtmlService
@@ -389,7 +389,6 @@ class TdkService{ @@ -389,7 +389,6 @@ class TdkService{
389 $webSeoInfo = $webSeoModel->read(['project_id'=>$projectInfo['id']]); 389 $webSeoInfo = $webSeoModel->read(['project_id'=>$projectInfo['id']]);
390 //网站设置 390 //网站设置
391 $webSetting = $this->getWebSetting($projectInfo); 391 $webSetting = $this->getWebSetting($projectInfo);
392 - $titleContent = "";  
393 $descriptionContent = ""; 392 $descriptionContent = "";
394 $keywordsContent = ""; 393 $keywordsContent = "";
395 if ($webCustomInfo !== false){ 394 if ($webCustomInfo !== false){
@@ -434,7 +433,7 @@ class TdkService{ @@ -434,7 +433,7 @@ class TdkService{
434 /** 433 /**
435 * 新闻博客详情通用版块 434 * 新闻博客详情通用版块
436 */ 435 */
437 - public function newsBlogTdk($info, $projectInfo, string $titleContent, $descriptionContent, $keywordsContent, array $tdkInfo): array 436 + public function newsBlogTdk($info, $projectInfo, $titleContent, $descriptionContent, $keywordsContent, array $tdkInfo): array
438 { 437 {
439 if (!empty($info)) { 438 if (!empty($info)) {
440 //seo拼接 439 //seo拼接