作者 赵彬吉
正在显示 55 个修改的文件 包含 1184 行增加150 行删除
@@ -16,6 +16,7 @@ use App\Models\Product\Keyword; @@ -16,6 +16,7 @@ use App\Models\Product\Keyword;
16 use App\Models\Product\Product; 16 use App\Models\Product\Product;
17 use App\Services\ProjectServer; 17 use App\Services\ProjectServer;
18 use Illuminate\Console\Command; 18 use Illuminate\Console\Command;
  19 +use Illuminate\Support\Facades\DB;
19 use Illuminate\Support\Facades\Http; 20 use Illuminate\Support\Facades\Http;
20 use Illuminate\Support\Facades\Log; 21 use Illuminate\Support\Facades\Log;
21 22
@@ -87,7 +88,10 @@ class VideoTask extends Command @@ -87,7 +88,10 @@ class VideoTask extends Command
87 continue; 88 continue;
88 } 89 }
89 ProjectServer::useProject($task_project->project_id); 90 ProjectServer::useProject($task_project->project_id);
90 - $keyword = $this->getProjectKeyword($task_project->num); 91 + if(!empty($task_project->keywords)){
  92 + $task_project->keywords = explode(',',trim(',',$task_project->keywords));
  93 + }
  94 + $keyword = $this->getProjectKeyword($task_project->number,$task_project->keywords);
91 // 已经没有需要生成视频的关键词 95 // 已经没有需要生成视频的关键词
92 if (!$keyword) { 96 if (!$keyword) {
93 $task_project->status = KeywordVideoTask::STATUS_CLOSE; 97 $task_project->status = KeywordVideoTask::STATUS_CLOSE;
@@ -95,13 +99,7 @@ class VideoTask extends Command @@ -95,13 +99,7 @@ class VideoTask extends Command
95 continue; 99 continue;
96 } 100 }
97 $logo_bg = $this->getImage($domainInfo); 101 $logo_bg = $this->getImage($domainInfo);
98 - $num = $task_project->num;  
99 foreach ($keyword as $val) { 102 foreach ($keyword as $val) {
100 - if($sub_task_num == 0){  
101 - $task_project->num = $num;  
102 - $task_project->save();  
103 - break;  
104 - }  
105 $log = KeywordVideoTaskLog::where(['project_id' => $task_project->project_id, 'keyword_id' => $val->id])->first(); 103 $log = KeywordVideoTaskLog::where(['project_id' => $task_project->project_id, 'keyword_id' => $val->id])->first();
106 if ($log){ 104 if ($log){
107 continue; 105 continue;
@@ -120,19 +118,13 @@ class VideoTask extends Command @@ -120,19 +118,13 @@ class VideoTask extends Command
120 'created_at' => date('Y-m-d H:i:s'), 118 'created_at' => date('Y-m-d H:i:s'),
121 ]; 119 ];
122 $rs = KeywordVideoTaskLog::insert($array); 120 $rs = KeywordVideoTaskLog::insert($array);
123 - if($rs){  
124 - $num--; 121 + if($rs && ($sub_task_num > 0)){
125 $sub_task_num--; 122 $sub_task_num--;
126 } 123 }
127 } 124 }
128 } 125 }
129 - if($sub_task_num != 0){  
130 - $task_project->num = $num;  
131 - if($num == 0){  
132 - $task_project->status = KeywordVideoTask::STATUS_CLOSE;  
133 - }  
134 - $task_project->save();  
135 - } 126 + $task_project->status = KeywordVideoTask::STATUS_CLOSE;
  127 + $task_project->save();
136 } 128 }
137 return true; 129 return true;
138 } 130 }
@@ -182,18 +174,27 @@ class VideoTask extends Command @@ -182,18 +174,27 @@ class VideoTask extends Command
182 * @param $number 174 * @param $number
183 * @return mixed 175 * @return mixed
184 */ 176 */
185 - public function getProjectKeyword($number) 177 + public function getProjectKeyword($number,$keywords = [])
186 { 178 {
187 - $keyword_arr_id = Keyword::where('video', null)->where('route', 'not like', '%-tag')->whereNotNull('keyword_content')->pluck('id')->toArray(); 179 + if(!empty($keywords)){
  180 + $keyword_id = Keyword::where('video', null)->whereIn("title", $keywords)
  181 + ->where('route', 'not like', '%-tag')->whereNotNull('keyword_content')->pluck('id')->toArray();
  182 + if(count($keyword_id) == 0){
  183 + $keyword_arr_id = Keyword::where('video', null)->where('route', 'not like', '%-tag')
  184 + ->whereNotNull('keyword_content')->orderBy('id','asc')->limit($number)->pluck('id')->toArray();
  185 + }else{
  186 + $keyword_arr_id = Keyword::where('video', null)->whereNotIn("title", $keywords)->where('route', 'not like', '%-tag')
  187 + ->whereNotNull('keyword_content')->orderBy('id','asc')->limit($number - count($keyword_id))->pluck('id')->toArray();
  188 + $keyword_arr_id = array_merge($keyword_id,$keyword_arr_id);
  189 + }
  190 + }else{
  191 + $keyword_arr_id = Keyword::where('video', null)->where('route', 'not like', '%-tag')
  192 + ->whereNotNull('keyword_content')->orderBy('id','asc')->limit($number)->pluck('id')->toArray();
  193 + }
188 if(count($keyword_arr_id) == 0){ 194 if(count($keyword_arr_id) == 0){
189 return []; 195 return [];
190 } 196 }
191 - if(count($keyword_arr_id) <= $number){  
192 - $keyword_id = array_rand($keyword_arr_id, count($keyword_arr_id));  
193 - }else{  
194 - $keyword_id = array_rand($keyword_arr_id, $number);  
195 - }  
196 - $keyword = Keyword::whereIn("id", $keyword_id)->get(); 197 + $keyword = Keyword::whereIn("id", $keyword_arr_id)->get();
197 return $keyword; 198 return $keyword;
198 } 199 }
199 200
@@ -446,6 +446,8 @@ class SyncProject extends Command @@ -446,6 +446,8 @@ class SyncProject extends Command
446 ProjectServer::createDatabase($project); 446 ProjectServer::createDatabase($project);
447 //创建表 447 //创建表
448 ProjectServer::initTable(); 448 ProjectServer::initTable();
  449 + //初始数据
  450 + ProjectServer::saveInitParam($project_id);
449 } 451 }
450 452
451 /** 453 /**
@@ -9,14 +9,13 @@ @@ -9,14 +9,13 @@
9 9
10 namespace App\Console\Commands\Suppliers; 10 namespace App\Console\Commands\Suppliers;
11 11
12 -use App\Models\Com\Purchaser;  
13 use App\Models\Product\Keyword; 12 use App\Models\Product\Keyword;
14 use App\Models\Project\DeployBuild; 13 use App\Models\Project\DeployBuild;
15 -use App\Models\Project\Project; 14 +use App\Models\Purchaser\Purchaser;
  15 +use App\Models\Purchaser\PurchaserInfo;
16 use App\Services\ProjectServer; 16 use App\Services\ProjectServer;
17 use Illuminate\Console\Command; 17 use Illuminate\Console\Command;
18 use Illuminate\Support\Facades\DB; 18 use Illuminate\Support\Facades\DB;
19 -use Illuminate\Support\Facades\Log;  
20 19
21 class RecommendedSuppliers extends Command 20 class RecommendedSuppliers extends Command
22 { 21 {
@@ -54,25 +53,25 @@ class RecommendedSuppliers extends Command @@ -54,25 +53,25 @@ class RecommendedSuppliers extends Command
54 $project_list = $projectModel->list(['is_supplier'=>1]);//TODO::已开启推荐供应商 53 $project_list = $projectModel->list(['is_supplier'=>1]);//TODO::已开启推荐供应商
55 foreach ($project_list as $k => $v){ 54 foreach ($project_list as $k => $v){
56 echo date('Y-m-d H:i:s') . 'project_id:'.$v['project_id'] . PHP_EOL; 55 echo date('Y-m-d H:i:s') . 'project_id:'.$v['project_id'] . PHP_EOL;
57 - ProjectServer::useProject($v['id']); 56 + ProjectServer::useProject($v['project_id']);
58 $info = Keyword::inRandomOrder()->first(); 57 $info = Keyword::inRandomOrder()->first();
59 if(empty($info)){ 58 if(empty($info)){
60 continue; 59 continue;
61 } 60 }
62 - $keywordInfo = $this->getPurchaser($info['title']); 61 + $keywordInfo = $this->getPurchaser($info->title,$v['project_id']);
63 if($keywordInfo !== false){ 62 if($keywordInfo !== false){
64 continue; 63 continue;
65 } 64 }
66 echo date('Y-m-d H:i:s') . '开始:'.$v['project_id'] . PHP_EOL; 65 echo date('Y-m-d H:i:s') . '开始:'.$v['project_id'] . PHP_EOL;
67 - $this->savePurchaser($v['id'],$info['title']); 66 + $this->savePurchaser($v['project_id'],$info->title);
68 DB::disconnect('custom_mysql'); 67 DB::disconnect('custom_mysql');
69 } 68 }
70 return true; 69 return true;
71 } 70 }
72 71
73 - public function getPurchaser($keyword){ 72 + public function getPurchaser($keyword,$project_id){
74 $purchaserModel = new Purchaser(); 73 $purchaserModel = new Purchaser();
75 - return $purchaserModel->read(['keyword'=>$keyword]); 74 + return $purchaserModel->read(['keyword'=>$keyword,'project_id'=>$project_id]);
76 } 75 }
77 76
78 /** 77 /**
@@ -83,7 +82,7 @@ class RecommendedSuppliers extends Command @@ -83,7 +82,7 @@ class RecommendedSuppliers extends Command
83 * @time :2024/3/5 11:38 82 * @time :2024/3/5 11:38
84 */ 83 */
85 public function savePurchaser($project_id,$keyword,$row = 10){ 84 public function savePurchaser($project_id,$keyword,$row = 10){
86 - $url = 'https://admin.hagro.cn/api/company_list'; 85 + $url = 'https://fob.ai.cc/api/company_list';
87 $data = [ 86 $data = [
88 'prod_desc'=>$keyword, 87 'prod_desc'=>$keyword,
89 'total'=>$row ?? 10, 88 'total'=>$row ?? 10,
@@ -97,7 +96,9 @@ class RecommendedSuppliers extends Command @@ -97,7 +96,9 @@ class RecommendedSuppliers extends Command
97 'total'=>$this->param['row'] ?? 10, 96 'total'=>$this->param['row'] ?? 10,
98 ]; 97 ];
99 $res = http_post($url,json_encode($param)); 98 $res = http_post($url,json_encode($param));
100 - if(!empty($res) && $res['code'] == 200){ 99 + echo date('Y-m-d H:i:s') . json_encode($res) . PHP_EOL;
  100 + if(!empty($res) && $res['code'] == 200 && !empty($res['data'])){
  101 + //保存多条数据
101 $saveData = [ 102 $saveData = [
102 'project_id'=>$project_id, 103 'project_id'=>$project_id,
103 'keyword'=>$keyword, 104 'keyword'=>$keyword,
@@ -105,7 +106,31 @@ class RecommendedSuppliers extends Command @@ -105,7 +106,31 @@ class RecommendedSuppliers extends Command
105 ]; 106 ];
106 $purchaserModel = new Purchaser(); 107 $purchaserModel = new Purchaser();
107 $purchaserModel->add($saveData); 108 $purchaserModel->add($saveData);
  109 + $this->savePurchaserInfo($project_id,$keyword,$res['data']);
108 } 110 }
109 return true; 111 return true;
110 } 112 }
  113 +
  114 + /**
  115 + * @remark :保存供应商详情
  116 + * @name :savePurchaserInfo
  117 + * @author :lyh
  118 + * @method :post
  119 + * @time :2024/5/29 16:38
  120 + */
  121 + public function savePurchaserInfo($project_id,$keyword,$data){
  122 + $param = [];
  123 + foreach ($data as $k =>$v){
  124 + $v['project_id'] = $project_id;
  125 + $v['keyword'] = $keyword;
  126 + $v['email'] = json_encode($v['email'],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
  127 + $v['mobile'] = json_encode($v['mobile'],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
  128 + $v['social_media'] = json_encode($v['social_media'],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
  129 + $v['created_at'] = date('Y-m-d H:i:s');
  130 + $v['updated_at'] = $v['created_at'];
  131 + $param[] = $v;
  132 + }
  133 + $purchaserInfoModel = new PurchaserInfo();
  134 + return $purchaserInfoModel->insert($param);
  135 + }
111 } 136 }
@@ -33,11 +33,16 @@ class SyncFile extends Command @@ -33,11 +33,16 @@ class SyncFile extends Command
33 $errorFileModel = new ErrorFile(); 33 $errorFileModel = new ErrorFile();
34 $lists = $errorFileModel->list(['status'=>0]);//未同步成功的图片及文件 34 $lists = $errorFileModel->list(['status'=>0]);//未同步成功的图片及文件
35 foreach ($lists as $k => $v){ 35 foreach ($lists as $k => $v){
36 - $code = $this->synchronizationFile($v['path']); 36 + if(strpos($v['path'], '/181/') !== false ){
  37 + $code = $this->synchronizationFiles($v['path']);
  38 + }else{
  39 + $code = $this->synchronizationFile($v['path']);
  40 + }
37 if((int)$code == 200){ 41 if((int)$code == 200){
38 echo date('Y-m-d H:i:s') . '编辑的path为:'. $v['path'] .',主键id:'. $v['id'] . PHP_EOL; 42 echo date('Y-m-d H:i:s') . '编辑的path为:'. $v['path'] .',主键id:'. $v['id'] . PHP_EOL;
39 $errorFileModel->edit(['status'=>1],['id'=>$v['id']]); 43 $errorFileModel->edit(['status'=>1],['id'=>$v['id']]);
40 } 44 }
  45 +
41 } 46 }
42 echo date('Y-m-d H:i:s') . '编辑的end为:' . PHP_EOL; 47 echo date('Y-m-d H:i:s') . '编辑的end为:' . PHP_EOL;
43 return true; 48 return true;
@@ -57,4 +62,13 @@ class SyncFile extends Command @@ -57,4 +62,13 @@ class SyncFile extends Command
57 $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php'; 62 $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php';
58 return shell_exec($cmd); 63 return shell_exec($cmd);
59 } 64 }
  65 +
  66 +
  67 + public function synchronizationFiles($path_name){
  68 + //同步到大文件
  69 + $file_path = config('filesystems.disks.s3')['cdn'].$path_name;
  70 + $directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
  71 + $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php';
  72 + return shell_exec($cmd);
  73 + }
60 } 74 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :PopularTemplateLabel.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/6/3 17:00
  8 + */
  9 +
  10 +namespace App\Console\Commands\TemplateLabel;
  11 +
  12 +use App\Models\Template\Template;
  13 +use App\Models\Template\TemplateLabel as TemplateLabelModel;
  14 +use App\Models\Template\TemplateModule;
  15 +use Illuminate\Console\Command;
  16 +
  17 +class PopularTemplateLabel extends Command
  18 +{
  19 + /**
  20 + * The name and signature of the console command.
  21 + *
  22 + * @var string
  23 + */
  24 + protected $signature = 'popular_template_label';
  25 +
  26 + /**
  27 + * The console command description.
  28 + *
  29 + * @var string
  30 + */
  31 + protected $description = '设置热门label';
  32 +
  33 + /**
  34 + * @remark :执行脚本
  35 + * @name :handle
  36 + * @author :lyh
  37 + * @method :post
  38 + * @time :2024/6/3 17:01
  39 + */
  40 + public function handle(){
  41 + $this->setTemplate();
  42 + $this->setTemplateModule();
  43 + return true;
  44 + }
  45 +
  46 + /**
  47 + * @remark :公共模块热门模块
  48 + * @name :setTemplate
  49 + * @author :lyh
  50 + * @method :post
  51 + * @time :2024/6/3 15:56
  52 + */
  53 + public function setTemplate(){
  54 + $templateModel = new Template();
  55 + $info = $templateModel->list(['test_model'=>0,'number'=>['<>',0]],'number',['id'],'desc',50);
  56 + if(empty($info)){
  57 + return true;
  58 + }else{
  59 + //清除当前所有最新标签
  60 + $labelModel = new TemplateLabelModel();
  61 + $labelModel->del(['name'=>'热门','type'=>1]);
  62 + $data = [];
  63 + foreach ($info as $v){
  64 + $data[] = [
  65 + 'name'=>'热门',
  66 + 'type'=>1,
  67 + 'template_id'=>$v['id'],
  68 + 'manager_id'=>0,
  69 + 'created_at'=>date('Y-m-d H:i:s'),
  70 + 'updated_at'=>date('Y-m-d H:i:s')
  71 + ];
  72 + }
  73 + //设置为最新
  74 + $labelModel->insert($data);
  75 + }
  76 + return true;
  77 + }
  78 +
  79 + /**
  80 + * @remark :左侧模块
  81 + * @name :templateModule
  82 + * @author :lyh
  83 + * @method :post
  84 + * @time :2024/6/3 15:54
  85 + */
  86 + public function setTemplateModule(){
  87 + $templateModuleModel = new TemplateModule();
  88 + $moduleInfo = $templateModuleModel->list(['test_model'=>0,'number'=>['<>',0]],'id',['id']);
  89 + if(empty($moduleInfo)){
  90 + return true;
  91 + }else{
  92 + //清除当前所有最新标签
  93 + $labelModel = new TemplateLabelModel();
  94 + $labelModel->del(['name'=>'热门','type'=>2]);
  95 + $moduleData = [];
  96 + foreach ($moduleInfo as $k => $v){
  97 + $moduleData[] = [
  98 + 'name'=>'热门',
  99 + 'type'=>2,
  100 + 'template_id'=>$v['id'],
  101 + 'manager_id'=>0,
  102 + 'created_at'=>date('Y-m-d H:i:s'),
  103 + 'updated_at'=>date('Y-m-d H:i:s')
  104 + ];
  105 + }
  106 + //设置为最新
  107 + $labelModel->insert($moduleData);
  108 + }
  109 + return true;
  110 + }
  111 +
  112 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :TemplateLabel.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/6/3 11:33
  8 + */
  9 +
  10 +namespace App\Console\Commands\TemplateLabel;
  11 +
  12 +use App\Models\Template\Template;
  13 +use App\Models\Template\TemplateModule;
  14 +use Illuminate\Console\Command;
  15 +use App\Models\Template\TemplateLabel as TemplateLabelModel;
  16 +
  17 +class TemplateLabel extends Command
  18 +{
  19 + /**
  20 + * The name and signature of the console command.
  21 + *
  22 + * @var string
  23 + */
  24 + protected $signature = 'template_label';
  25 +
  26 + /**
  27 + * The console command description.
  28 + *
  29 + * @var string
  30 + */
  31 + protected $description = '设置label';
  32 +
  33 + /**
  34 + * @remark :执行脚本
  35 + * @name :handle
  36 + * @author :lyh
  37 + * @method :post
  38 + * @time :2024/6/3 11:35
  39 + */
  40 + public function handle(){
  41 + //获取最近7天模版的记录
  42 + $start_time = now()->subDays(90)->startOfDay()->toDateString();
  43 + $end_time = now()->startOfDay()->toDateString();
  44 + $this->setTemplateModule($start_time,$end_time);
  45 + $this->setTemplate($start_time,$end_time);
  46 + return true;
  47 + }
  48 +
  49 + /**
  50 + * @remark :公共模块
  51 + * @name :setTemplate
  52 + * @author :lyh
  53 + * @method :post
  54 + * @time :2024/6/3 15:56
  55 + */
  56 + public function setTemplate($start_time,$end_time){
  57 + $templateModel = new Template();
  58 + $info = $templateModel->list(['created_at'=>['between',[$start_time,$end_time]],'test_model'=>0],'id',['id']);
  59 + if(empty($info)){
  60 + return true;
  61 + }else{
  62 + //清除当前所有最新标签
  63 + $labelModel = new TemplateLabelModel();
  64 + $labelModel->del(['name'=>'最新','type'=>1]);
  65 + $data = [];
  66 + foreach ($info as $k => $v){
  67 + $data[] = [
  68 + 'name'=>'最新',
  69 + 'type'=>1,
  70 + 'template_id'=>$v['id'],
  71 + 'manager_id'=>0,
  72 + 'created_at'=>date('Y-m-d H:i:s'),
  73 + 'updated_at'=>date('Y-m-d H:i:s')
  74 + ];
  75 + }
  76 + //设置为最新
  77 + $labelModel->insert($data);
  78 + }
  79 + return true;
  80 + }
  81 +
  82 + /**
  83 + * @remark :左侧模块
  84 + * @name :templateModule
  85 + * @author :lyh
  86 + * @method :post
  87 + * @time :2024/6/3 15:54
  88 + */
  89 + public function setTemplateModule($start_time,$end_time){
  90 + $templateModuleModel = new TemplateModule();
  91 + $moduleInfo = $templateModuleModel->list(['created_at'=>['between',[$start_time,$end_time]],'test_model'=>0],'id',['id']);
  92 + if(empty($moduleInfo)){
  93 + return true;
  94 + }else{
  95 + //清除当前所有最新标签
  96 + $labelModel = new TemplateLabelModel();
  97 + $labelModel->del(['name'=>'最新','type'=>2]);
  98 + $moduleData = [];
  99 + foreach ($moduleInfo as $k => $v){
  100 + $moduleData[] = [
  101 + 'name'=>'最新',
  102 + 'type'=>2,
  103 + 'template_id'=>$v['id'],
  104 + 'manager_id'=>0,
  105 + 'created_at'=>date('Y-m-d H:i:s'),
  106 + 'updated_at'=>date('Y-m-d H:i:s')
  107 + ];
  108 + }
  109 + //设置为最新
  110 + $labelModel->insert($moduleData);
  111 + }
  112 + return true;
  113 + }
  114 +}
@@ -8,12 +8,18 @@ @@ -8,12 +8,18 @@
8 namespace App\Console\Commands\Test; 8 namespace App\Console\Commands\Test;
9 9
10 10
  11 +use App\Models\Com\KeywordVideoTask;
11 use App\Models\File\File; 12 use App\Models\File\File;
12 use App\Models\File\File as FileModel; 13 use App\Models\File\File as FileModel;
13 use App\Models\File\Image; 14 use App\Models\File\Image;
14 use App\Models\File\Image as ImageModel; 15 use App\Models\File\Image as ImageModel;
  16 +use App\Models\Product\Keyword;
  17 +use App\Models\Project\Project;
15 use App\Services\AmazonS3Service; 18 use App\Services\AmazonS3Service;
  19 +use App\Services\ProjectServer;
16 use Illuminate\Console\Command; 20 use Illuminate\Console\Command;
  21 +use Illuminate\Support\Facades\DB;
  22 +use Illuminate\Support\Facades\Schema;
17 23
18 24
19 class Demo extends Command 25 class Demo extends Command
@@ -33,25 +39,25 @@ class Demo extends Command @@ -33,25 +39,25 @@ class Demo extends Command
33 protected $description = 'demo'; 39 protected $description = 'demo';
34 40
35 41
36 - /**  
37 - * Execute the job.  
38 - *  
39 - * @return void  
40 - */  
41 - public function handle()  
42 - {  
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 - }  
54 - 42 +// /**
  43 +// * Execute the job.
  44 +// *
  45 +// * @return void
  46 +// */
  47 +// public function handle()
  48 +// {
  49 +// $this->param['project_id'] = 181;
  50 +// $imageModel = new ImageModel();
  51 +// //获取当前项目的所有图片
  52 +// $imageList = $imageModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','size']);
  53 +// if(!empty($imageList)){
  54 +// $amazonS3Service = new AmazonS3Service();
  55 +// foreach ($imageList as $k => $v){
  56 +// $amazonS3Service->syncImageFiles(getImageUrl($v['path']));
  57 +// $imageModel->edit(['is_cos'=>0],['id'=>$v['id']]);
  58 +// }
  59 +// }
  60 +//
55 // $fileModel = new FileModel(); 61 // $fileModel = new FileModel();
56 // $fileList = $fileModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','name']); 62 // $fileList = $fileModel->list(['project_id'=>$this->param['project_id'],'is_cos'=>1],'id',['id','path','is_cos','name']);
57 // if(!empty($fileList)){ 63 // if(!empty($fileList)){
@@ -63,7 +69,73 @@ class Demo extends Command @@ -63,7 +69,73 @@ class Demo extends Command
63 // gc_collect_cycles(); 69 // gc_collect_cycles();
64 // } 70 // }
65 // } 71 // }
  72 +// return true;
  73 +// }
  74 +
  75 + public function handle(){
  76 + $keywordVideoModel = new KeywordVideoTask();
  77 + $project_id_arr = $keywordVideoModel::where('id','>',0)->pluck('project_id')->toArray();
  78 + $projectModel = new Project();
  79 + $list = $projectModel->list(['type'=>['!=',0],'delete_status'=>0,'id'=>['in',$project_id_arr]]);
  80 + $data = [];
  81 + foreach ($list as $v){
  82 + echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
  83 + ProjectServer::useProject($v['id']);
  84 + $this->saveKeyword();
  85 + DB::disconnect('custom_mysql');
  86 + }
  87 + echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
  88 + }
  89 +
  90 + /**
  91 + * @remark :关键字有视频的改为1
  92 + * @name :getProductKeywordInfo
  93 + * @author :lyh
  94 + * @method :post
  95 + * @time :2024/5/31 9:54
  96 + */
  97 + public function saveKeyword(){
  98 + $keywordModel = new Keyword();
  99 + $rs = $keywordModel->edit(['is_video_keyword'=>0],['video'=>'']);
  100 + echo date('Y-m-d H:i:s') . 'end'.$rs . PHP_EOL;
66 return true; 101 return true;
67 } 102 }
68 103
  104 +// public function handle(){
  105 +// //切换数据库配置
  106 +// ProjectServer::useProject(1862);
  107 +// return $this->initTable(1380,1862);
  108 +// }
  109 +//
  110 +// public function initTable($project_id, $news_project_id)
  111 +// {
  112 +// config(['database.connections.custom_tmp_mysql_copy.database' => 'gl_data_' . $project_id]);
  113 +// $database_name = DB::connection('custom_tmp_mysql_copy')->getDatabaseName();
  114 +// $tables = Schema::connection('custom_tmp_mysql_copy')->getAllTables();
  115 +// $tables = array_column($tables, 'Tables_in_' . $database_name);
  116 +// foreach ($tables as $table) {
  117 +// $has_table = Schema::connection('custom_mysql')->hasTable($table);
  118 +// if (!$has_table) {
  119 +// $sql = DB::connection('custom_tmp_mysql_copy')->select("SHOW CREATE TABLE {$table}");
  120 +// DB::connection('custom_mysql')->statement(array_values((array)$sql[0])[0]); // 修正此处的sql语句获取方式
  121 +// }
  122 +//
  123 +// if ($table == 'gl_customer_visit' || $table == 'gl_customer_visit_item' || $table == 'gl_inquiry_other' || $table == 'gl_inquiry_form_data' || $table == 'gl_inquiry_form') {
  124 +// continue;
  125 +// }
  126 +// DB::connection('custom_mysql')->table($table)->truncate(); // 清空目标表数据
  127 +// DB::connection('custom_mysql')->table($table)->insertUsing(
  128 +// [], // 列名数组,留空表示插入所有列
  129 +// function ($query) use ($table, $project_id) {
  130 +// $name = 'gl_data_' . $project_id . '.' . $table;
  131 +// $query->select('*')->from("{$name}");
  132 +// }
  133 +// );
  134 +//
  135 +// if (Schema::connection('custom_mysql')->hasColumn($table, 'project_id')) {
  136 +// DB::connection('custom_mysql')->table($table)->update(['project_id' => $news_project_id]);
  137 +// }
  138 +// }
  139 +// return true;
  140 +// }
69 } 141 }
@@ -50,7 +50,7 @@ class UpdateProductCategory extends Command @@ -50,7 +50,7 @@ class UpdateProductCategory extends Command
50 public function handle(){ 50 public function handle(){
51 //获取所有项目 51 //获取所有项目
52 $projectModel = new Project(); 52 $projectModel = new Project();
53 - $list = $projectModel->list(['id'=>['in',[621]]],'id',['id']); 53 + $list = $projectModel->list(['id'=>['in',[1077]]],'id',['id']);
54 echo date('Y-m-d H:i:s') . ' start: ' . json_encode($list) . PHP_EOL; 54 echo date('Y-m-d H:i:s') . ' start: ' . json_encode($list) . PHP_EOL;
55 try { 55 try {
56 foreach ($list as $v) { 56 foreach ($list as $v) {
@@ -20,6 +20,7 @@ use App\Models\RouteMap\RouteMap; @@ -20,6 +20,7 @@ use App\Models\RouteMap\RouteMap;
20 use App\Services\ProjectServer; 20 use App\Services\ProjectServer;
21 use Illuminate\Console\Command; 21 use Illuminate\Console\Command;
22 use Illuminate\Support\Facades\DB; 22 use Illuminate\Support\Facades\DB;
  23 +use Illuminate\Support\Facades\Schema;
23 24
24 /** 25 /**
25 * @remark :更新所有项目的路由 26 * @remark :更新所有项目的路由
@@ -53,7 +54,7 @@ class UpdateRoute extends Command @@ -53,7 +54,7 @@ class UpdateRoute extends Command
53 */ 54 */
54 public function handle(){ 55 public function handle(){
55 $projectModel = new Project(); 56 $projectModel = new Project();
56 - $list = $projectModel->list(['id'=>688]); 57 + $list = $projectModel->list(['id'=>['in',[358,951]]]);
57 $data = []; 58 $data = [];
58 foreach ($list as $v){ 59 foreach ($list as $v){
59 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 60 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
@@ -119,14 +120,80 @@ class UpdateRoute extends Command @@ -119,14 +120,80 @@ class UpdateRoute extends Command
119 // $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); 120 // $keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
120 // } 121 // }
121 }else{ 122 }else{
  123 + echo date('Y-m-d H:i:s') . 'route :'.$v['id'] . PHP_EOL;
122 $route = Translate::tran($v['title'], 'en'); 124 $route = Translate::tran($v['title'], 'en');
123 - echo date('Y-m-d H:i:s') . 'route :'.$route . PHP_EOL;  
124 - $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);  
125 - $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); 125 + if(!empty($route)){
  126 + echo date('Y-m-d H:i:s') . $route . PHP_EOL;
  127 + $route = $this->setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);
  128 + $keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
  129 + }
126 } 130 }
127 -// echo date('Y-m-d H:i:s') . 'end :' . PHP_EOL; 131 + echo date('Y-m-d H:i:s') . 'end :' . PHP_EOL;
  132 + }
  133 + }
  134 + }
  135 +
  136 + /**
  137 + * @param $title
  138 + * @param $source
  139 + * @param $source_id
  140 + * @param int $project_id
  141 + * @return bool
  142 + * @throws \Exception
  143 + * @author zbj
  144 + * @date 2023/4/17
  145 + */
  146 + public static function setRoute($title, $source, $source_id, $project_id = 0){
  147 + $route = self::generateRoute($title, $source, $source_id, $project_id);
  148 + if(!$route){
  149 + throw new \Exception('路由生成失败');
  150 + }
  151 + try {
  152 + $route_map = RouteMap::where('project_id', $project_id)->where('source_id', $source_id)->where('source', $source)->first();
  153 + if(!$route_map){
  154 + $route_map = new RouteMap();
  155 + $route_map->source = $source;
  156 + $route_map->source_id = $source_id;
  157 + $route_map->project_id = $project_id;
128 } 158 }
  159 + $route_map->route = $route;
  160 + $route_map->save();
  161 + }catch (\Exception $e){
  162 + throw new \Exception('路由映射失败');
  163 + }
  164 + return $route;
  165 + }
  166 +
  167 + /**
  168 + * 生成路由标识
  169 + * @param $title
  170 + * @param $source
  171 + * @param $source_id
  172 + * @param $project_id
  173 + * @return string
  174 + * @author zbj
  175 + * @date 2023/4/17
  176 + */
  177 + public static function generateRoute($title, $source, $source_id, $project_id){
  178 + $i=1;
  179 + $sign = generateRoute($title);
  180 + $length = strlen($sign);
  181 + if($length > 100){
  182 + $sign = trim(mb_substr($sign, 0, 100, 'UTF-8'),'-');
  183 + }
  184 + $info = RouteMap::where(['project_id' => $project_id, 'source' => $source, 'source_id'=>$source_id])->first();
  185 + $suffix = '';
  186 + if(empty($info)){
  187 + if($source == 'product'){
  188 + $suffix = '-product';
  189 + }
  190 + }
  191 + $route = $sign.$suffix;
  192 + while(RouteMap::isExist($route, $source_id, $project_id)){
  193 + $route = $sign .'-'.$i.$suffix;
  194 + $i++;
129 } 195 }
  196 + return $route;
130 } 197 }
131 198
132 /** 199 /**
@@ -278,4 +345,55 @@ class UpdateRoute extends Command @@ -278,4 +345,55 @@ class UpdateRoute extends Command
278 RouteMap::setRoute($v['route'],'product_keyword',$v['id'],569); 345 RouteMap::setRoute($v['route'],'product_keyword',$v['id'],569);
279 } 346 }
280 } 347 }
  348 +
  349 + public function copyTable()
  350 + {
  351 + $sourceTable = 'gl_route_map';
  352 + $destinationTable = 'gl_route_map_copy';
  353 +
  354 + if (!Schema::connection('custom_mysql')->hasTable($sourceTable)) {
  355 + $this->error("Source table {$sourceTable} does not exist.");
  356 + return false;
  357 + }
  358 + if (Schema::connection('custom_mysql')->hasTable($destinationTable)) {
  359 + Schema::connection('custom_mysql')->dropIfExists($destinationTable);
  360 + }
  361 + $columns = DB::connection('custom_mysql')->select(DB::raw("SHOW COLUMNS FROM {$sourceTable}"));
  362 + $columnsDefinition = collect($columns)->map(function($column) {
  363 + $columnDefinition = $column->Field . ' ' . $column->Type .
  364 + ($column->Null === 'NO' ? ' NOT NULL' : '') .
  365 + ($column->Default !== null ? " DEFAULT '" . $column->Default . "'" : '') .
  366 + ($column->Extra ? ' ' . $column->Extra : '');
  367 + return $columnDefinition;
  368 + })->implode(', ');
  369 + // Add PRIMARY KEY to the id column
  370 + $primaryKey = collect($columns)->firstWhere('Field', 'id') ? 'PRIMARY KEY (id)' : '';
  371 + $columnsDefinition = $columnsDefinition . ($primaryKey ? ', ' . $primaryKey : '');
  372 + DB::connection('custom_mysql')->statement("CREATE TABLE {$destinationTable} ({$columnsDefinition})");
  373 + DB::connection('custom_mysql')->statement("INSERT INTO {$destinationTable} SELECT * FROM {$sourceTable}");
  374 + $this->info("Table {$sourceTable} has been copied to {$destinationTable} successfully.");
  375 + }
  376 +
  377 +
  378 + /**
  379 + * @remark :routeMap去重
  380 + * @name :routeMapDeduplication
  381 + * @author :lyh
  382 + * @method :post
  383 + * @time :2024/5/28 11:31
  384 + */
  385 + public function routeMapDeduplication(){
  386 + $routeMapModel = new RouteMap();
  387 + $lists = $routeMapModel->list(['source'=>'product_keyword'],'id',['id'],'asc');
  388 + foreach ($lists as $v){
  389 + echo date('Y-m-d H:i:s') . '关键字id:'.$v['id'] . PHP_EOL;
  390 + //查询当前数据详情
  391 + $info = $routeMapModel->read(['id'=>$v['id']],['id','source_id']);
  392 + if($info !== false){
  393 + //删除其他一样的数据
  394 + $routeMapModel->del(['id'=>['!=',$info['id']],'source'=>'product_keyword','source_id'=>$info['source_id']]);
  395 + }
  396 + }
  397 + return true;
  398 + }
281 } 399 }
@@ -15,6 +15,9 @@ class Kernel extends ConsoleKernel @@ -15,6 +15,9 @@ class Kernel extends ConsoleKernel
15 */ 15 */
16 protected function schedule(Schedule $schedule) 16 protected function schedule(Schedule $schedule)
17 { 17 {
  18 + // 每日更新最新模块
  19 +// $schedule->command('template_label')->dailyAt('01:00')->withoutOverlapping(1);//最新模块
  20 +// $schedule->command('popular_template_label')->dailyAt('01:30')->withoutOverlapping(1);//热门模块
18 // $schedule->command('inspire')->hourly(); 21 // $schedule->command('inspire')->hourly();
19 $schedule->command('remain_day')->dailyAt('09:00')->withoutOverlapping(1); // 项目剩余服务时长 22 $schedule->command('remain_day')->dailyAt('09:00')->withoutOverlapping(1); // 项目剩余服务时长
20 $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务 23 $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务
@@ -39,7 +42,7 @@ class Kernel extends ConsoleKernel @@ -39,7 +42,7 @@ class Kernel extends ConsoleKernel
39 $schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录 42 $schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录
40 $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次 43 $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次
41 $schedule->command('inquiry_count')->dailyAt('01:00')->withoutOverlapping(1); // 询盘统计数据,每天凌晨执行一次 44 $schedule->command('inquiry_count')->dailyAt('01:00')->withoutOverlapping(1); // 询盘统计数据,每天凌晨执行一次
42 - $schedule->command('domain_info')->dailyAt('01:20')->withoutOverlapping(1);// 更新域名|证书结束时间,每天凌晨1点执行一次 45 +// $schedule->command('domain_info')->dailyAt('01:20')->withoutOverlapping(1);// 更新域名|证书结束时间,每天凌晨1点执行一次
43 $schedule->command('last_inquiry')->dailyAt('04:00')->withoutOverlapping(1);// 最近一次询盘信息 46 $schedule->command('last_inquiry')->dailyAt('04:00')->withoutOverlapping(1);// 最近一次询盘信息
44 $schedule->command('update_seo_tdk_crontab')->dailyAt('20:00')->withoutOverlapping(1); //更新上线项目TDK 47 $schedule->command('update_seo_tdk_crontab')->dailyAt('20:00')->withoutOverlapping(1); //更新上线项目TDK
45 $schedule->command('sync_manager')->dailyAt('01:00')->withoutOverlapping(1); //TODO::手机号码同步 每天执行一次 48 $schedule->command('sync_manager')->dailyAt('01:00')->withoutOverlapping(1); //TODO::手机号码同步 每天执行一次
@@ -100,6 +100,7 @@ class NoticeController extends BaseController @@ -100,6 +100,7 @@ class NoticeController extends BaseController
100 $keyword->video = $video; 100 $keyword->video = $video;
101 $keyword->embed_code = $embed_code; 101 $keyword->embed_code = $embed_code;
102 $keyword->video_thumb = $thumb; 102 $keyword->video_thumb = $thumb;
  103 + $keyword->is_video_keyword = 1;
103 $keyword->save(); 104 $keyword->save();
104 DB::disconnect('custom_mysql'); 105 DB::disconnect('custom_mysql');
105 return 200; 106 return 200;
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api; @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api;
4 4
5 use App\Exceptions\InquiryFilterException; 5 use App\Exceptions\InquiryFilterException;
6 use App\Models\Mail\Mail; 6 use App\Models\Mail\Mail;
  7 +use App\Models\Project\DeployBuild;
7 use App\Models\Project\Project; 8 use App\Models\Project\Project;
8 use App\Models\User\User; 9 use App\Models\User\User;
9 use App\Models\Visit\SyncSubmitTask; 10 use App\Models\Visit\SyncSubmitTask;
@@ -124,4 +125,36 @@ class SelfSiteController extends BaseController @@ -124,4 +125,36 @@ class SelfSiteController extends BaseController
124 125
125 return $this->success([]); 126 return $this->success([]);
126 } 127 }
  128 +
  129 + /**
  130 + * 自建站上传验证文件接口
  131 + * @param Request $request
  132 + * @return false|string
  133 + * @author Akun
  134 + * @date 2024/05/28 11:47
  135 + */
  136 + public function selfSiteVerify(Request $request)
  137 + {
  138 + $token = $request->header('token');//token
  139 + $pid = $request->header('pid');//项目id
  140 + $file_name = $request->input('file_name');//验证文件名称
  141 + $type = $request->input('type');//验证文件类型,1主站,2小语种站
  142 +
  143 + if (empty($token) || empty($pid)) {
  144 + return $this->error('token无效', 401);
  145 + }
  146 +
  147 + //判断token是否有效
  148 + $project_model = new Project();
  149 + $project_info = $project_model->read(['id' => $pid, 'site_token' => $token]);
  150 + if (!$project_info) {
  151 + return $this->error('token无效', 401);
  152 + }
  153 +
  154 + $model = new DeployBuild();
  155 + $data = $type == 1 ? ['main_verify_file' => $file_name] : ['amp_verify_file' => $file_name];
  156 + $model->edit($data, ['project_id' => $pid]);
  157 +
  158 + return $this->success([]);
  159 + }
127 } 160 }
@@ -37,10 +37,12 @@ class V6UpdateLogController extends BaseController @@ -37,10 +37,12 @@ class V6UpdateLogController extends BaseController
37 */ 37 */
38 public function save(V6UpdateLogLogic $logic){ 38 public function save(V6UpdateLogLogic $logic){
39 $this->request->validate([ 39 $this->request->validate([
  40 + 'title' => 'required',
40 'version_id' => 'required', 41 'version_id' => 'required',
41 'remark' => 'required', 42 'remark' => 'required',
42 'updated_date' => 'required', 43 'updated_date' => 'required',
43 ], [ 44 ], [
  45 + 'title.required' => 'title不能为空',
44 'version_id.required' => '版本号version_id不能为空', 46 'version_id.required' => '版本号version_id不能为空',
45 'remark.required' => '更新内容不能为空', 47 'remark.required' => '更新内容不能为空',
46 'updated_date.required' => '更新时间不能为空', 48 'updated_date.required' => '更新时间不能为空',
@@ -9,6 +9,7 @@ use App\Http\Logic\Aside\Project\ProjectLogic; @@ -9,6 +9,7 @@ use App\Http\Logic\Aside\Project\ProjectLogic;
9 use App\Models\Ai\AiPrefix; 9 use App\Models\Ai\AiPrefix;
10 use App\Models\ASide\APublicModel; 10 use App\Models\ASide\APublicModel;
11 use App\Models\Channel\Channel; 11 use App\Models\Channel\Channel;
  12 +use App\Models\Com\KeywordVideoTask;
12 use App\Models\Domain\DomainInfo; 13 use App\Models\Domain\DomainInfo;
13 use App\Models\Manage\ManageHr; 14 use App\Models\Manage\ManageHr;
14 use App\Models\Project\DeployOptimize; 15 use App\Models\Project\DeployOptimize;
@@ -194,6 +195,7 @@ class OptimizeController extends BaseController @@ -194,6 +195,7 @@ class OptimizeController extends BaseController
194 'gl_project_deploy_optimize.design_mid AS design_mid', 195 'gl_project_deploy_optimize.design_mid AS design_mid',
195 'gl_project_deploy_optimize.start_date AS start_date', 196 'gl_project_deploy_optimize.start_date AS start_date',
196 'gl_project_deploy_optimize.backlink AS backlink', 197 'gl_project_deploy_optimize.backlink AS backlink',
  198 + 'gl_project_deploy_optimize.ai_video AS ai_video',
197 'gl_domain_info.amp_status AS amp_status', 199 'gl_domain_info.amp_status AS amp_status',
198 'gl_domain_info.domain AS domain', 200 'gl_domain_info.domain AS domain',
199 ]; 201 ];
@@ -329,6 +331,9 @@ class OptimizeController extends BaseController @@ -329,6 +331,9 @@ class OptimizeController extends BaseController
329 'project_id.required' => 'project_id不能为空', 331 'project_id.required' => 'project_id不能为空',
330 ]); 332 ]);
331 $projectModel = new Project(); 333 $projectModel = new Project();
  334 + if($this->param['robots'] != $projectModel::STATUS_ONE){
  335 + $this->response('robots只能开启不能关闭',Code::SYSTEM_ERROR);
  336 + }
332 $rs = $projectModel->edit(['robots'=>$this->param['robots']],['id'=>$this->param['project_id']]); 337 $rs = $projectModel->edit(['robots'=>$this->param['robots']],['id'=>$this->param['project_id']]);
333 if($rs === false){ 338 if($rs === false){
334 $this->response('执行错误,请联系开发人员',Code::SYSTEM_ERROR); 339 $this->response('执行错误,请联系开发人员',Code::SYSTEM_ERROR);
@@ -390,4 +395,30 @@ class OptimizeController extends BaseController @@ -390,4 +395,30 @@ class OptimizeController extends BaseController
390 $optimizeModel->edit(['backlink'=>$this->param['backlink']],['project_id'=>$this->param['project_id']]); 395 $optimizeModel->edit(['backlink'=>$this->param['backlink']],['project_id'=>$this->param['project_id']]);
391 $this->response('success'); 396 $this->response('success');
392 } 397 }
  398 +
  399 + /**
  400 + * @remark :开启视频模块
  401 + * @name :setAiVideo
  402 + * @author :lyh
  403 + * @method :post
  404 + * @time :2024/5/30 10:30
  405 + */
  406 + public function setAiVideo(){
  407 + $this->request->validate([
  408 + 'project_id'=>'required',
  409 + 'status'=>'required',
  410 + ],[
  411 + 'project_id.required' => 'project_id不能为空',
  412 + 'status.required' => '状态不能为空',
  413 + ]);
  414 + $keywordVideoModel = new KeywordVideoTask();
  415 + $info = $keywordVideoModel->read(['project_id'=>$this->param['project_id']]);
  416 + if($info === false){
  417 + $this->response('请先创建视频任务,才能开启',Code::SYSTEM_ERROR);
  418 + }
  419 + $keywordVideoModel->edit(['status'=>$this->param['status']],['project_id'=>$this->param['project_id']]);
  420 + $optimizeModel = new DeployOptimize();
  421 + $optimizeModel->edit(['ai_video'=>$this->param['status']],['project_id'=>$this->param['project_id']]);
  422 + $this->response('success');
  423 + }
393 } 424 }
@@ -18,6 +18,7 @@ use App\Models\Channel\Channel; @@ -18,6 +18,7 @@ use App\Models\Channel\Channel;
18 use App\Models\Channel\User; 18 use App\Models\Channel\User;
19 use App\Models\Channel\Zone; 19 use App\Models\Channel\Zone;
20 use App\Models\Com\City; 20 use App\Models\Com\City;
  21 +use App\Models\Com\UpdateLog;
21 use App\Models\Devops\ServerConfig; 22 use App\Models\Devops\ServerConfig;
22 use App\Models\Domain\DomainInfo; 23 use App\Models\Domain\DomainInfo;
23 use App\Models\HomeCount\Count; 24 use App\Models\HomeCount\Count;
@@ -366,6 +367,8 @@ class ProjectController extends BaseController @@ -366,6 +367,8 @@ class ProjectController extends BaseController
366 $item['article_num'] = ($data['blog'] ?? 0) + ($data['news'] ?? 0); 367 $item['article_num'] = ($data['blog'] ?? 0) + ($data['news'] ?? 0);
367 $item['task_finish_num'] = Task::getNumByProjectId($item['id'], Task::STATUS_DOWN); 368 $item['task_finish_num'] = Task::getNumByProjectId($item['id'], Task::STATUS_DOWN);
368 $item['task_pending_num'] = Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]); 369 $item['task_pending_num'] = Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]);
  370 + $item['collect_time'] = $item['is_upgrade'] ? UpdateLog::getProjectUpdate($item['id']) : '';
  371 +
369 return $item; 372 return $item;
370 } 373 }
371 374
  1 +<?php
  2 +/**
  3 + * Created by PhpStorm.
  4 + * User: zhl
  5 + * Date: 2024/5/28
  6 + * Time: 14:25
  7 + */
  8 +namespace App\Http\Controllers\Aside\Task;
  9 +
  10 +use App\Enums\Common\Code;
  11 +use App\Http\Controllers\Aside\BaseController;
  12 +use App\Models\Com\Notify;
  13 +use App\Models\Project\Project;
  14 +use App\Models\WebSetting\WebLanguage;
  15 +use Illuminate\Http\Request;
  16 +
  17 +/**
  18 + * 自动任务信息
  19 + * Class AutoTaskController
  20 + * @package App\Http\Controllers\Aside\Task
  21 + */
  22 +class AutoTaskController extends BaseController
  23 +{
  24 + /**
  25 + * 页面生成任务
  26 + * @param Request $request
  27 + * @return \Illuminate\Http\JsonResponse
  28 + */
  29 + public function createHtmlTask(Request $request)
  30 + {
  31 + // 接收信息
  32 + $project_id = intval($request->input('project_id'));
  33 + $status = intval($request->input('status'));
  34 + $route = intval($request->input('route'));
  35 + $type = intval($request->input('type'));
  36 + $row = intval($request->input('row', 20));
  37 + // 所有参数都有初始化数据, 无数据验证
  38 + // 查询初始数据
  39 + $where = compact('project_id', 'route', 'type');
  40 + $where = array_filter($where);
  41 + if ($status)
  42 + $where['status'] = $status - 1;
  43 + $result = Notify::select(['id','project_id', 'type', 'data', 'status', 'route', 'num', 'updated_at', 'created_at'])
  44 + ->where('id', '>', 84000) // 查询有效数据
  45 + ->where('server_id', '<>', 9) // 过滤测试环境数据
  46 + ->where('server_id', '>', 0) // 过滤测试环境数据
  47 + ->where($where)
  48 + ->orderBy('id', 'desc')
  49 + ->paginate($row);
  50 +
  51 + // 数据中需要处理项目信息
  52 + $project_ids = $result->pluck('project_id')->toArray();
  53 + $projects = Project::whereIN('id', $project_ids)->pluck('title', 'id')->toArray();
  54 + // 数据中需要处理的语种信息
  55 + $language = WebLanguage::pluck('chinese', 'id')->toArray();
  56 + // 数据中需要映射的参数信息
  57 + $type = Notify::typeMap();
  58 + $route = Notify::routeMap();
  59 + $status = Notify::statusMap();
  60 + // 转数组操作, 如果是对象, 添加字段会报错
  61 + $result = $result->toArray();
  62 + foreach ($result['list'] as &$val) {
  63 + // 解析data信息, 以后数据库尽量不要存需要处理的JSON信息, 拆分成指定字段
  64 + $data = json_decode($val['data'], true);
  65 + $val['language'] = [];
  66 + // 小语种 并且 有语种信息, 将语种转换成中文
  67 + if ($val['type'] == Notify::TYPE_MINOR && FALSE == empty($data['language'])) {
  68 + foreach ($data['language'] as $v) {
  69 + $val['language'][] = $language[$v];
  70 + }
  71 + }
  72 + // 映射信息 以及解析信息
  73 + $val['type'] = $type[$val['type']];
  74 + $val['route'] = $route[$val['route']];
  75 + $val['status'] = $status[$val['status']];
  76 + $val['project_title'] = $projects[$val['project_id']] ?? '';
  77 + $val['domain'] = $data['domain'] ?? '';
  78 + $val['url'] = FALSE == empty($data['url']) ? $data['url'] : [];
  79 +
  80 + }
  81 + return $this->response('success', Code::SUCCESS, $result);
  82 + }
  83 +
  84 + /**
  85 + * 页面生成任务参数
  86 + * @return \Illuminate\Http\JsonResponse
  87 + */
  88 + public function createHtmlTaskParam()
  89 + {
  90 + $status = Notify::statusMap();
  91 + $status_new = [];
  92 + foreach ($status as $key=>$val) {
  93 + $status_new[$key+1] = $val;
  94 + }
  95 + $result = [
  96 + 'status' => $status_new,
  97 + 'type' => Notify::typeMap(),
  98 + 'route' => Notify::routeMap()
  99 + ];
  100 + return $this->response('success', Code::SUCCESS, $result);
  101 + }
  102 +}
@@ -25,17 +25,14 @@ class ATemplateController extends BaseController @@ -25,17 +25,14 @@ class ATemplateController extends BaseController
25 * @method :post 25 * @method :post
26 * @time :2023/6/28 16:34 26 * @time :2023/6/28 16:34
27 */ 27 */
28 - public function lists(ATemplateLogic $aTemplateLogic,TemplateLabel $templateLabel){  
29 - if(isset($this->map['label_name']) && !empty($this->map['label_name'])){  
30 - $id_arr = $templateLabel->formatQuery(['name'=>['like','%'.$this->map['label_name'].'%']])->pluck('template_id')->toArray();  
31 - $this->map['id'] = ['in',$id_arr];  
32 - unset($this->map['label_name']);  
33 - } 28 + public function lists(ATemplateLogic $aTemplateLogic){
  29 + $templateLabel = new TemplateLabel();
  30 + $this->searchLabelName($templateLabel);
34 $filed = ['id','name','image','url','status','sort','deleted_status','test_model','created_at','project_id']; 31 $filed = ['id','name','image','url','status','sort','deleted_status','test_model','created_at','project_id'];
35 $lists = $aTemplateLogic->aTemplateList($this->map,$this->page,$this->row,$this->order,$filed); 32 $lists = $aTemplateLogic->aTemplateList($this->map,$this->page,$this->row,$this->order,$filed);
36 if(!empty($lists) && !empty($lists['list'])){ 33 if(!empty($lists) && !empty($lists['list'])){
37 foreach ($lists['list'] as $k => $v){ 34 foreach ($lists['list'] as $k => $v){
38 - $v['label'] = $templateLabel->list(['template_id'=>$v['id']],'id',['id','name'],'desc',5); 35 + $v['label'] = $templateLabel->list(['template_id'=>$v['id'],'type'=>1],'id',['id','name'],'desc',5);
39 $v['image_link'] = getImageUrl($v['image']); 36 $v['image_link'] = getImageUrl($v['image']);
40 $lists['list'][$k] = $v; 37 $lists['list'][$k] = $v;
41 } 38 }
@@ -44,6 +41,22 @@ class ATemplateController extends BaseController @@ -44,6 +41,22 @@ class ATemplateController extends BaseController
44 } 41 }
45 42
46 /** 43 /**
  44 + * @remark :搜索label
  45 + * @name :searchLabelName
  46 + * @author :lyh
  47 + * @method :post
  48 + * @time :2024/6/3 11:11
  49 + */
  50 + public function searchLabelName($templateLabel){
  51 + if(isset($this->map['label_name']) && !empty($this->map['label_name'])){
  52 + $id_arr = $templateLabel->formatQuery(['name'=>['like','%'.$this->map['label_name'].'%'],'type'=>1])->pluck('template_id')->toArray();
  53 + $this->map['id'] = ['in',$id_arr];
  54 + unset($this->map['label_name']);
  55 + }
  56 + return true;
  57 + }
  58 +
  59 + /**
47 * @remark :获取选择的模版 60 * @remark :获取选择的模版
48 * @name :getTemplateInfo 61 * @name :getTemplateInfo
49 * @author :lyh 62 * @author :lyh
@@ -8,6 +8,8 @@ use App\Http\Logic\Aside\Template\ATemplateLogic; @@ -8,6 +8,8 @@ use App\Http\Logic\Aside\Template\ATemplateLogic;
8 use App\Http\Logic\Aside\Template\ATemplateModuleLogic; 8 use App\Http\Logic\Aside\Template\ATemplateModuleLogic;
9 use App\Http\Requests\Aside\Template\ATemplateModuleRequest; 9 use App\Http\Requests\Aside\Template\ATemplateModuleRequest;
10 use App\Models\Project\Project; 10 use App\Models\Project\Project;
  11 +use App\Models\Template\TemplateLabel;
  12 +use App\Models\Template\TemplateModule;
11 13
12 /** 14 /**
13 * @remark :左侧模块管理 15 * @remark :左侧模块管理
@@ -24,12 +26,38 @@ class ATemplateModuleController extends BaseController @@ -24,12 +26,38 @@ class ATemplateModuleController extends BaseController
24 * @method :post 26 * @method :post
25 * @time :2023/6/28 16:54 27 * @time :2023/6/28 16:54
26 */ 28 */
27 - public function lists(ATemplateModuleLogic $ATemplateModuleLogic){  
28 - $lists = $ATemplateModuleLogic->aTemplateModuleLists($this->map,$this->page,$this->row,$this->order); 29 + public function lists(TemplateModule $templateModule){
  30 + $templateLabel = new TemplateLabel();
  31 + $this->map['deleted_status'] = 0;
  32 + $this->searchLabelName($templateLabel);
  33 + $lists = $templateModule->lists($this->map,$this->page,$this->row,$this->order);
  34 + if(!empty($lists) && !empty($lists['list'])){
  35 + foreach ($lists['list'] as $k => $v){
  36 + $v['label'] = $templateLabel->list(['template_id'=>$v['id'],'type'=>2],'id',['id','name'],'desc',5);
  37 + $lists['list'][$k] = $v;
  38 + }
  39 + }
29 $this->response('success',Code::SUCCESS,$lists); 40 $this->response('success',Code::SUCCESS,$lists);
30 } 41 }
31 42
32 /** 43 /**
  44 + * @remark :搜索label
  45 + * @name :searchLabelName
  46 + * @author :lyh
  47 + * @method :post
  48 + * @time :2024/6/3 11:11
  49 + */
  50 + public function searchLabelName($templateLabel){
  51 + if(isset($this->map['label_name']) && !empty($this->map['label_name'])){
  52 + $id_arr = $templateLabel->formatQuery(['name'=>['like','%'.$this->map['label_name'].'%'],'type'=>2])->pluck('template_id')->toArray();
  53 + $this->map['id'] = ['in',$id_arr];
  54 + unset($this->map['label_name']);
  55 + }
  56 + return true;
  57 + }
  58 +
  59 +
  60 + /**
33 * @remark :左侧模块保存 61 * @remark :左侧模块保存
34 * @name :save 62 * @name :save
35 * @author :lyh 63 * @author :lyh
@@ -34,8 +34,10 @@ class TemplateLabelController extends BaseController @@ -34,8 +34,10 @@ class TemplateLabelController extends BaseController
34 public function getUserLists(TemplateLabel $templateLabel){ 34 public function getUserLists(TemplateLabel $templateLabel){
35 $this->request->validate([ 35 $this->request->validate([
36 'template_id'=>'required', 36 'template_id'=>'required',
  37 + 'type'=>'required',
37 ],[ 38 ],[
38 'template_id.required' => '模版id不能为空', 39 'template_id.required' => '模版id不能为空',
  40 + 'type.required' => '模版类型不能为空不能为空',
39 ]); 41 ]);
40 $data = $templateLabel->list($this->map); 42 $data = $templateLabel->list($this->map);
41 $this->response('success',Code::SUCCESS,$data); 43 $this->response('success',Code::SUCCESS,$data);
@@ -6,10 +6,7 @@ use App\Enums\Common\Code; @@ -6,10 +6,7 @@ use App\Enums\Common\Code;
6 use App\Helper\Arr; 6 use App\Helper\Arr;
7 use App\Helper\Common; 7 use App\Helper\Common;
8 use App\Http\Controllers\Bside\BaseController; 8 use App\Http\Controllers\Bside\BaseController;
9 -use App\Http\Logic\Aside\Project\ProjectLogic;  
10 -use App\Http\Logic\Bside\User\UserLogic;  
11 use App\Jobs\PurchaserJob; 9 use App\Jobs\PurchaserJob;
12 -use App\Models\Com\Purchaser;  
13 use App\Models\CustomModule\CustomModule; 10 use App\Models\CustomModule\CustomModule;
14 use App\Models\Project\DeployBuild; 11 use App\Models\Project\DeployBuild;
15 use App\Models\Project\Project; 12 use App\Models\Project\Project;
@@ -18,7 +15,6 @@ use App\Models\User\ProjectMenu as ProjectMenuModel; @@ -18,7 +15,6 @@ use App\Models\User\ProjectMenu as ProjectMenuModel;
18 use App\Models\User\ProjectRole as ProjectRoleModel; 15 use App\Models\User\ProjectRole as ProjectRoleModel;
19 use App\Models\User\User; 16 use App\Models\User\User;
20 use Illuminate\Support\Facades\Cache; 17 use Illuminate\Support\Facades\Cache;
21 -use Illuminate\Support\Facades\Hash;  
22 18
23 /*** 19 /***
24 * 当前为公共类 20 * 当前为公共类
@@ -96,6 +96,7 @@ class FileManageController extends BaseController @@ -96,6 +96,7 @@ class FileManageController extends BaseController
96 $cosService = new CosService(); 96 $cosService = new CosService();
97 $cosService->uploadFile($file,$path,$fileName); 97 $cosService->uploadFile($file,$path,$fileName);
98 $data['project_id'] = $this->user['project_id']; 98 $data['project_id'] = $this->user['project_id'];
  99 + $data['en_name'] = $fileName;
99 $data['path'] = $path.'/'.$fileName; 100 $data['path'] = $path.'/'.$fileName;
100 $rs = $fileManage->add($data); 101 $rs = $fileManage->add($data);
101 if ($rs === false) { 102 if ($rs === false) {
@@ -113,14 +114,16 @@ class FileManageController extends BaseController @@ -113,14 +114,16 @@ class FileManageController extends BaseController
113 */ 114 */
114 public function getOnlyFilename($name,$project_id = 0){ 115 public function getOnlyFilename($name,$project_id = 0){
115 $nameArr = explode('.',$name); 116 $nameArr = explode('.',$name);
116 - $enName = generateRoute(Translate::tran($nameArr[0], 'en')); 117 + $suffix = array_pop($nameArr) ?? 'txt';
  118 + $nameStr = implode('-', $nameArr);
  119 + $enName = generateRoute(Translate::tran($nameStr, 'en'));
117 $fileName = $enName; 120 $fileName = $enName;
118 $i=1; 121 $i=1;
119 - while($this->onlyName($enName.'.'.$nameArr[1],$project_id)){ 122 + while($this->onlyName($enName.'.'.$suffix,$project_id)){
120 $enName = $fileName .'-'.$i; 123 $enName = $fileName .'-'.$i;
121 $i++; 124 $i++;
122 } 125 }
123 - return $enName.'.'.$nameArr[1]; 126 + return $enName.'.'.$suffix;
124 } 127 }
125 128
126 /** 129 /**
@@ -154,7 +157,7 @@ class FileManageController extends BaseController @@ -154,7 +157,7 @@ class FileManageController extends BaseController
154 if(!in_array($extension, explode(',', $this->upload_config['allow_file_type']))){ 157 if(!in_array($extension, explode(',', $this->upload_config['allow_file_type']))){
155 $this->fail('不允许上传的文件类型'); 158 $this->fail('不允许上传的文件类型');
156 } 159 }
157 - $hash = hash_file('md5', $file->getPathname()); 160 + $hash = hash_file('sha256', $file->getPathname());
158 $info = FileManage::where('hash', $hash)->first(); 161 $info = FileManage::where('hash', $hash)->first();
159 if($info){ 162 if($info){
160 $this->fail('文件已上传,文件名称.'.$info['name']); 163 $this->fail('文件已上传,文件名称.'.$info['name']);
@@ -201,4 +201,26 @@ class KeywordController extends BaseController @@ -201,4 +201,26 @@ class KeywordController extends BaseController
201 } 201 }
202 $this->response('success'); 202 $this->response('success');
203 } 203 }
  204 +
  205 + /**
  206 + * @remark :批量操作关键字是否展示视频
  207 + * @name :batchKeywordIsVideo
  208 + * @author :lyh
  209 + * @method :post
  210 + * @time :2024/5/30 14:29
  211 + */
  212 + public function batchKeywordIsVideo(){
  213 + $this->request->validate([
  214 + 'title'=>['required','array', 'max:500']
  215 + ],[
  216 + 'title.required' => 'title不能为空',
  217 + 'title.array' => 'title为数组',
  218 + 'title.max' => '批量操作不能超过500条数据'
  219 + ]);
  220 + $keywordModel = new Keyword();
  221 + foreach ($this->param['title'] as $v){
  222 + $keywordModel->edit(['is_video_keyword'=>$this->param['is_video_keyword']],['title'=>$v]);
  223 + }
  224 + $this->response('success');
  225 + }
204 } 226 }
@@ -55,12 +55,12 @@ class ProductController extends BaseController @@ -55,12 +55,12 @@ class ProductController extends BaseController
55 if(!empty($lists)){ 55 if(!empty($lists)){
56 $lists = $lists->toArray(); 56 $lists = $lists->toArray();
57 $cate_data = $this->getCategoryList();//分类 57 $cate_data = $this->getCategoryList();//分类
58 - $key_data = $this->getKeywordsList();//关键字 58 + $key_data = $this->keywordNameLists($lists['list']);//关键字
59 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id 59 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id
60 $userModel = new User(); 60 $userModel = new User();
61 foreach ($lists['list'] as $k=>$v){ 61 foreach ($lists['list'] as $k=>$v){
62 $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']);; 62 $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']);;
63 - $v['category_id_text'] = $this->categoryName($v['category_id'],$cate_data); 63 + $v['category_id_text'] = $this->categoryName($v['id'],$cate_data);
64 $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data); 64 $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data);
65 $v['created_uid_text'] = $userModel->getName($v['created_uid']); 65 $v['created_uid_text'] = $userModel->getName($v['created_uid']);
66 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']); 66 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']);
@@ -72,6 +72,30 @@ class ProductController extends BaseController @@ -72,6 +72,30 @@ class ProductController extends BaseController
72 } 72 }
73 73
74 /** 74 /**
  75 + * @remark :获取当前页的所有关键字名称
  76 + * @name :keywordNameLists
  77 + * @author :lyh
  78 + * @method :post
  79 + * @time :2024/6/3 14:24
  80 + */
  81 + public function keywordNameLists($lists){
  82 + $keywordId = [];
  83 + foreach ($lists as $v){
  84 + $keywordId = array_merge($keywordId,$v['keyword_id']);
  85 + }
  86 + $keywordId = array_values(array_unique($keywordId));
  87 + $keywordModel = new Keyword();
  88 + $data = [];
  89 + $cateList = $keywordModel->list(['id' => ['in',$keywordId]], ['id', 'title']);
  90 + if (!empty($cateList)) {
  91 + foreach ($cateList as $value) {
  92 + $data[$value['id']] = $value['title'];
  93 + }
  94 + }
  95 + return $data;
  96 + }
  97 +
  98 + /**
75 * @remark :不分页产品列表 99 * @remark :不分页产品列表
76 * @name :productNoPage 100 * @name :productNoPage
77 * @author :lyh 101 * @author :lyh
@@ -220,7 +244,9 @@ class ProductController extends BaseController @@ -220,7 +244,9 @@ class ProductController extends BaseController
220 * @method :post 244 * @method :post
221 * @time :2023/9/14 13:58 245 * @time :2023/9/14 13:58
222 */ 246 */
223 - public function categoryName($category_id,$data){ 247 + public function categoryName($product_id,$data){
  248 + $cateRelatedModel = new CategoryRelated();
  249 + $category_id = $cateRelatedModel->where('product_id',$product_id)->pluck('cate_id')->toArray();
224 $category_name = ''; 250 $category_name = '';
225 if(!empty($category_id) && !empty($data)){ 251 if(!empty($category_id) && !empty($data)){
226 foreach ($category_id as $v){ 252 foreach ($category_id as $v){
@@ -11,7 +11,7 @@ namespace App\Http\Controllers\Bside\Suppliers; @@ -11,7 +11,7 @@ namespace App\Http\Controllers\Bside\Suppliers;
11 11
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
13 use App\Http\Controllers\Bside\BaseController; 13 use App\Http\Controllers\Bside\BaseController;
14 -use App\Models\Com\Purchaser; 14 +use App\Models\Purchaser\Purchaser;
15 15
16 /** 16 /**
17 * @remark :推荐采购商 17 * @remark :推荐采购商
@@ -38,11 +38,13 @@ class SuppliersController extends BaseController @@ -38,11 +38,13 @@ class SuppliersController extends BaseController
38 $lists = $purchaserModel->list($this->map); 38 $lists = $purchaserModel->list($this->map);
39 if(!empty($lists)){ 39 if(!empty($lists)){
40 foreach ($lists as $v){ 40 foreach ($lists as $v){
41 - $resultData = json_decode($v['data']);  
42 - foreach ($resultData as $value){  
43 - $value = (array)$value;  
44 - $value['keyword'] = $v['keyword'];  
45 - $data[] = $value; 41 + if(!empty($v['data'])){
  42 + $resultData = json_decode($v['data'],true);
  43 + foreach ($resultData as $value){
  44 + $value = (array)$value;
  45 + $value['keyword'] = $v['keyword'];
  46 + $data[] = $value;
  47 + }
46 } 48 }
47 } 49 }
48 } 50 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :TemplateLabelController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/5/16 9:51
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Bside\Template;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Bside\BaseController;
  14 +use App\Http\Logic\Bside\BTemplate\BTemplateLabelLogic;
  15 +use App\Models\Template\TemplateLabel;
  16 +
  17 +/**
  18 + * @remark :
  19 + * @name :TemplateLabelController
  20 + * @author :lyh
  21 + * @method :post
  22 + * @time :2024/5/16 9:51
  23 + */
  24 +class BTemplateLabelController extends BaseController
  25 +{
  26 + /**
  27 + * @remark :获取模版的标签
  28 + * @name :lists
  29 + * @author :lyh
  30 + * @method :post
  31 + * @time :2024/5/16 10:15
  32 + */
  33 + public function getUserLists(TemplateLabel $templateLabel){
  34 + $this->request->validate([
  35 + 'template_id'=>'required',
  36 + 'type'=>'required',
  37 + ],[
  38 + 'template_id.required' => '模版id不能为空',
  39 + 'type.required' => '模版类型不能为空不能为空',
  40 + ]);
  41 + $data = $templateLabel->list($this->map);
  42 + $this->response('success',Code::SUCCESS,$data);
  43 + }
  44 +
  45 + /**
  46 + * @remark :保存标签
  47 + * @name :save
  48 + * @author :lyh
  49 + * @method :post
  50 + * @time :2024/5/16 9:53
  51 + */
  52 + public function save(BTemplateLabelLogic $labelLogic){
  53 + $this->request->validate([
  54 + 'name'=>'required | max:200',
  55 + 'type'=>'required',
  56 + 'template_id'=>'required',
  57 + ],[
  58 + 'name.required' => '标签名称不能为空',
  59 + 'type.required' => '模版类型不能为空不能为空',
  60 + 'template_id.required' => '模版ID不能为空不能为空',
  61 + ]);
  62 + $data = $labelLogic->saveLabel();
  63 + $this->response('success',Code::SUCCESS,$data);
  64 + }
  65 +
  66 + /**
  67 + * @remark :删除数据
  68 + * @name :del
  69 + * @author :lyh
  70 + * @method :post
  71 + * @time :2024/5/16 10:08
  72 + */
  73 + public function del(BTemplateLabelLogic $labelLogic){
  74 + $this->request->validate([
  75 + 'id'=>'required',
  76 + ],[
  77 + 'id.required' => '主键不能为空',
  78 + ]);
  79 + $data = $labelLogic->delLabel();
  80 + $this->response('success',Code::SUCCESS,$data);
  81 + }
  82 +}
@@ -7,6 +7,7 @@ use App\Http\Controllers\Bside\BaseController; @@ -7,6 +7,7 @@ use App\Http\Controllers\Bside\BaseController;
7 use App\Http\Logic\Bside\BTemplate\BTemplateModuleLogic; 7 use App\Http\Logic\Bside\BTemplate\BTemplateModuleLogic;
8 use App\Http\Logic\Bside\BTemplate\BTemplateModuleProjectLogic; 8 use App\Http\Logic\Bside\BTemplate\BTemplateModuleProjectLogic;
9 use App\Models\Template\BModuleProject; 9 use App\Models\Template\BModuleProject;
  10 +use App\Models\Template\TemplateLabel;
10 11
11 /** 12 /**
12 * @remark :左侧模块管理 13 * @remark :左侧模块管理
@@ -62,4 +63,21 @@ class BTemplateModuleController extends BaseController @@ -62,4 +63,21 @@ class BTemplateModuleController extends BaseController
62 $list = $BTemplateModuleLogic->ModuleType($this->map); 63 $list = $BTemplateModuleLogic->ModuleType($this->map);
63 $this->response('success',Code::SUCCESS,$list); 64 $this->response('success',Code::SUCCESS,$list);
64 } 65 }
  66 +
  67 + /**
  68 + * @remark :设置数量
  69 + * @name :setModuleNumber
  70 + * @author :lyh
  71 + * @method :post
  72 + * @time :2024/6/3 16:50
  73 + */
  74 + public function setModuleNumber(){
  75 + $this->request->validate([
  76 + 'id'=>'required',
  77 + ],[
  78 + 'id.required' => 'id不能为空',
  79 + ]);
  80 + $this->model->where('id', $this->param['id'])->increment('number');
  81 + $this->response('success');
  82 + }
65 } 83 }
@@ -110,7 +110,7 @@ class FileController @@ -110,7 +110,7 @@ class FileController
110 * @time :2023/6/17 16:32 110 * @time :2023/6/17 16:32
111 */ 111 */
112 public function single(&$files){ 112 public function single(&$files){
113 - $hash = hash_file('md5', $files->getPathname()); 113 + $hash = hash_file('sha256', $files->getPathname());
114 $name = $files->getClientOriginalName(); 114 $name = $files->getClientOriginalName();
115 //查看文件是否存在 115 //查看文件是否存在
116 $fileModel = new File(); 116 $fileModel = new File();
@@ -195,7 +195,7 @@ class FileController @@ -195,7 +195,7 @@ class FileController
195 */ 195 */
196 public function api_upload_single(&$files) 196 public function api_upload_single(&$files)
197 { 197 {
198 - $hash = hash_file('md5', $files->getPathname()); 198 + $hash = hash_file('sha256', $files->getPathname());
199 $name = $files->getFilename(); 199 $name = $files->getFilename();
200 //查看文件是否存在 200 //查看文件是否存在
201 $fileModel = new File(); 201 $fileModel = new File();
@@ -277,7 +277,7 @@ class FileController @@ -277,7 +277,7 @@ class FileController
277 foreach ($files as $file) { 277 foreach ($files as $file) {
278 $fileModel = new File(); 278 $fileModel = new File();
279 $name = $file->getClientOriginalName(); 279 $name = $file->getClientOriginalName();
280 - $hash = hash_file('md5', $file->getPathname()); 280 + $hash = hash_file('sha256', $file->getPathname());
281 $param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0,'is_cos'=>(($this->upload_location == 0) ? 1 : 0)]; 281 $param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0,'is_cos'=>(($this->upload_location == 0) ? 1 : 0)];
282 if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){ 282 if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){
283 $param['project_id'] = $this->cache['project_id']; 283 $param['project_id'] = $this->cache['project_id'];
@@ -347,7 +347,7 @@ class FileController @@ -347,7 +347,7 @@ class FileController
347 // 设置响应头 347 // 设置响应头
348 header('Content-Description: File Transfer'); 348 header('Content-Description: File Transfer');
349 header('Content-Type: application/octet-stream'); 349 header('Content-Type: application/octet-stream');
350 - header('Content-Disposition: attachment; filename="' . $info['name'] . '"'); 350 + header('Content-Disposition: attachment; filename="' . !empty($info['name']) ? $info['name'] : '未命名'.basename($info['path']) . '"');
351 // 下载文件 351 // 下载文件
352 readfile($fileUrl); 352 readfile($fileUrl);
353 } 353 }
@@ -184,7 +184,7 @@ class ImageController extends Controller @@ -184,7 +184,7 @@ class ImageController extends Controller
184 * @time :2023/6/17 16:30 184 * @time :2023/6/17 16:30
185 */ 185 */
186 public function single(&$files){ 186 public function single(&$files){
187 - $hash = hash_file('md5', $files->getPathname()); 187 + $hash = hash_file('sha256', $files->getPathname());
188 $name = $files->getClientOriginalName(); 188 $name = $files->getClientOriginalName();
189 //查看文件是否存在 189 //查看文件是否存在
190 $imageModel = new ImageModel(); 190 $imageModel = new ImageModel();
@@ -326,7 +326,7 @@ class ImageController extends Controller @@ -326,7 +326,7 @@ class ImageController extends Controller
326 $data = []; 326 $data = [];
327 foreach ($files as $file) { 327 foreach ($files as $file) {
328 $imageModel = new ImageModel(); 328 $imageModel = new ImageModel();
329 - $hash = hash_file('md5', $file->getPathname()); 329 + $hash = hash_file('sha256', $file->getPathname());
330 $name = $file->getClientOriginalName(); 330 $name = $file->getClientOriginalName();
331 //查看图片是否已上传 331 //查看图片是否已上传
332 $param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0,'is_cos'=>(($this->upload_location == 0) ? 1 : 0)]; 332 $param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0,'is_cos'=>(($this->upload_location == 0) ? 1 : 0)];
@@ -267,6 +267,7 @@ class DomainInfoLogic extends BaseLogic @@ -267,6 +267,7 @@ class DomainInfoLogic extends BaseLogic
267 $this->fail('请切换服务器,生成站点不能使用测试服务器'); 267 $this->fail('请切换服务器,生成站点不能使用测试服务器');
268 } 268 }
269 if($project_info['serve_id'] == ServerConfig::SELF_SITE_ID){ 269 if($project_info['serve_id'] == ServerConfig::SELF_SITE_ID){
  270 + $this->model->edit(['amp_status' => $this->param['amp_status'] ?? 0,],['id'=>$this->param['id']]);
270 $this->fail('自建站服务器无法生成站点'); 271 $this->fail('自建站服务器无法生成站点');
271 } 272 }
272 //域名是否都已经解析 273 //域名是否都已经解析
@@ -100,17 +100,7 @@ class ProjectLogic extends BaseLogic @@ -100,17 +100,7 @@ class ProjectLogic extends BaseLogic
100 $info['deploy_build']['other_project']= json_decode($info['deploy_build']['other_project']); 100 $info['deploy_build']['other_project']= json_decode($info['deploy_build']['other_project']);
101 } 101 }
102 //升级项目采集完成时间 102 //升级项目采集完成时间
103 - $collect_time = '';  
104 - if($info['is_upgrade'] == 1){  
105 - $collect_un_count = UpdateLog::where('project_id',$id)->where('collect_status',0)->count();  
106 - if($collect_un_count > 0){  
107 - $collect_time = '采集中';  
108 - }else{  
109 - $collect_info = UpdateLog::where('project_id',$id)->orderBy('updated_at','desc')->first();  
110 - $collect_time = $collect_info->updated_at->format('Y-m-d H:i:s');  
111 - }  
112 - }  
113 - $info['collect_time'] = $collect_time; 103 + $info['collect_time'] = $info['is_upgrade'] ? UpdateLog::getProjectUpdate($id) : '';
114 return $this->success($info); 104 return $this->success($info);
115 } 105 }
116 106
@@ -186,9 +176,6 @@ class ProjectLogic extends BaseLogic @@ -186,9 +176,6 @@ class ProjectLogic extends BaseLogic
186 * @time :2023/8/30 12:14 176 * @time :2023/8/30 12:14
187 */ 177 */
188 public function saveProject($param){ 178 public function saveProject($param){
189 - if($param['type'] == Project::TYPE_ONE){  
190 - $param['serve_id'] = 9;  
191 - }  
192 if((($param['type'] == Project::TYPE_TWO) || ($param['type'] == Project::TYPE_THREE)) && empty($param['uptime'])){ 179 if((($param['type'] == Project::TYPE_TWO) || ($param['type'] == Project::TYPE_THREE)) && empty($param['uptime'])){
193 $param['uptime'] = date('Y-m-d H:i:s'); 180 $param['uptime'] = date('Y-m-d H:i:s');
194 } 181 }
@@ -274,8 +261,6 @@ class ProjectLogic extends BaseLogic @@ -274,8 +261,6 @@ class ProjectLogic extends BaseLogic
274 protected function saveProjectDeployBuild($deploy_build){ 261 protected function saveProjectDeployBuild($deploy_build){
275 $deployBuildModel = new DeployBuild(); 262 $deployBuildModel = new DeployBuild();
276 $deploy_build['configuration'] = Arr::a2s(!empty($deploy_build['configuration']) ? $deploy_build['configuration'] : []); 263 $deploy_build['configuration'] = Arr::a2s(!empty($deploy_build['configuration']) ? $deploy_build['configuration'] : []);
277 - $deploy_build['main_verify_file'] = $deploy_build['main_verify_file'] ?? '';  
278 - $deploy_build['amp_verify_file'] = $deploy_build['amp_verify_file'] ?? '';  
279 $deployBuildModel->edit($deploy_build,['id'=>$deploy_build['id']]); 264 $deployBuildModel->edit($deploy_build,['id'=>$deploy_build['id']]);
280 return $this->success(); 265 return $this->success();
281 } 266 }
@@ -22,19 +22,6 @@ class ATemplateModuleLogic extends BaseLogic @@ -22,19 +22,6 @@ class ATemplateModuleLogic extends BaseLogic
22 } 22 }
23 23
24 /** 24 /**
25 - * @remark :左侧模块列表  
26 - * @name :aTemplateModuleLists  
27 - * @author :lyh  
28 - * @method :post  
29 - * @time :2023/6/28 18:01  
30 - */  
31 - public function aTemplateModuleLists($map,$page,$row,$order = 'created_at',$filed = ['*']){  
32 - $map['deleted_status'] = 0;  
33 - $lists = $this->model->lists($map,$page,$row,$order,$filed);  
34 - return $this->success($lists);  
35 - }  
36 -  
37 - /**  
38 * @remark :保存左侧模块 25 * @remark :保存左侧模块
39 * @name :aTemplateModuleSave 26 * @name :aTemplateModuleSave
40 * @author :lyh 27 * @author :lyh
@@ -60,7 +60,7 @@ class UserLogic extends BaseLogic @@ -60,7 +60,7 @@ class UserLogic extends BaseLogic
60 } 60 }
61 $this->param = $this->editPassword($this->param); 61 $this->param = $this->editPassword($this->param);
62 $rs = $this->model->edit($this->param, ['id' => $this->param['id']]); 62 $rs = $this->model->edit($this->param, ['id' => $this->param['id']]);
63 - DB::table('gl_user_edit_log')->insert(['message'=>json_encode($this->param),'user_id'=>$this->manager['id'],'project_id'=>$this->user['project_id'],'created_at'=>date('Y-m-d H:i:s'),'updated_at'=>date('Y-m-d H:i:s')]); 63 + DB::table('gl_user_edit_log')->insert(['message'=>json_encode($this->param),'user_id'=>$this->manager['id'],'project_id'=>$info['project_id'],'created_at'=>date('Y-m-d H:i:s'),'updated_at'=>date('Y-m-d H:i:s')]);
64 } else { 64 } else {
65 $this->param['password'] = base64_encode(md5($this->param['password'])); 65 $this->param['password'] = base64_encode(md5($this->param['password']));
66 $rs = $this->model->add($this->param); 66 $rs = $this->model->add($this->param);
@@ -45,9 +45,12 @@ class AyrReleaseLogic extends BaseLogic @@ -45,9 +45,12 @@ class AyrReleaseLogic extends BaseLogic
45 } 45 }
46 $this->param['result_data'] = $res; 46 $this->param['result_data'] = $res;
47 $this->param['platforms'] = json_encode($this->param['platforms']); 47 $this->param['platforms'] = json_encode($this->param['platforms']);
48 - $rs = $this->model->add($this->param);  
49 - if($rs === false){  
50 - $this->fail('error'); 48 + $info = $this->model->read(['platforms'=>$this->param['platforms'],'operator_id'=>$this->param['operator_id'],'project_id'=>$this->param['project_id'],'title'=>$this->param['title']]);
  49 + if($info === false){
  50 + $rs = $this->model->add($this->param);
  51 + if($rs === false){
  52 + $this->fail('error');
  53 + }
51 } 54 }
52 return $this->success(); 55 return $this->success();
53 } 56 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :TemplateLabelLogic.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/5/16 9:54
  8 + */
  9 +
  10 +namespace App\Http\Logic\Bside\BTemplate;
  11 +
  12 +use App\Http\Logic\Aside\BaseLogic;
  13 +use App\Models\Template\TemplateLabel;
  14 +
  15 +/**
  16 + * @remark :模版标签
  17 + * @name :TemplateLabelLogic
  18 + * @author :lyh
  19 + * @method :post
  20 + * @time :2024/5/16 9:54
  21 + */
  22 +class BTemplateLabelLogic extends BaseLogic
  23 +{
  24 + /**
  25 + * 初始化数据
  26 + */
  27 + public function __construct()
  28 + {
  29 + parent::__construct();
  30 + $this->model = new TemplateLabel();
  31 + $this->param = $this->requestAll;
  32 + }
  33 +
  34 +
  35 + /**
  36 + * @remark :保存标签
  37 + * @name :saveLabel
  38 + * @author :lyh
  39 + * @method :post
  40 + * @time :2024/5/16 9:55
  41 + */
  42 + public function saveLabel(){
  43 + if(isset($this->param['id']) && !empty($this->param['id'])){
  44 + $id = $this->param['id'];
  45 + $info = $this->model->read(['name'=>$this->param['name'],'template_id'=>$this->param['template_id'],'id'=>['!=',$id]],['id']);
  46 + if($info === false){
  47 + $this->model->edit($this->param,['id'=>$id]);
  48 + }
  49 + }else{
  50 + $info = $this->model->read(['name'=>$this->param['name'],'template_id'=>$this->param['template_id']],['id']);
  51 + if($info === false){
  52 + $this->param['manager_id'] = $this->manager['id'];
  53 + $id = $this->model->addReturnId($this->param);
  54 + }else{
  55 + $id = $info['id'];
  56 + }
  57 + }
  58 + return $this->success(['id'=>$id]);
  59 + }
  60 +
  61 + /**
  62 + * @remark :删除标签
  63 + * @name :delLabel
  64 + * @author :lyh
  65 + * @method :post
  66 + * @time :2024/5/16 10:03
  67 + */
  68 + public function delLabel(){
  69 + $rs = $this->model->del($this->param);
  70 + if($rs === false){
  71 + $this->fail('删除失败,请联系管理员');
  72 + }
  73 + return $this->success();
  74 + }
  75 +}
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Http\Logic\Bside\BTemplate; 3 namespace App\Http\Logic\Bside\BTemplate;
4 4
5 use App\Http\Logic\Bside\BaseLogic; 5 use App\Http\Logic\Bside\BaseLogic;
  6 +use App\Models\Template\TemplateLabel;
6 use App\Models\Template\TemplateModule; 7 use App\Models\Template\TemplateModule;
7 use App\Models\Template\TemplateType; 8 use App\Models\Template\TemplateType;
8 9
@@ -25,8 +26,13 @@ class BTemplateModuleLogic extends BaseLogic @@ -25,8 +26,13 @@ class BTemplateModuleLogic extends BaseLogic
25 public function ModuleList($map,$order = 'created_at',$filed = ['id','name','type','sort','status','image','test_model']){ 26 public function ModuleList($map,$order = 'created_at',$filed = ['id','name','type','sort','status','image','test_model']){
26 $map['deleted_status'] = 0; 27 $map['deleted_status'] = 0;
27 $map['status'] = 0; 28 $map['status'] = 0;
28 - $lists = $this->model->list($map,$order,$filed);  
29 - return $this->success($lists); 29 + $list = $this->model->list($map,$order,$filed);
  30 + $templateLabel = new TemplateLabel();
  31 + foreach ($list as $k => $v){
  32 + $v['label'] = $templateLabel->list(['template_id'=>$v['id'],'type'=>2],'id',['id','name'],'desc',5);
  33 + $list[$k] = $v;
  34 + }
  35 + return $this->success($list);
30 } 36 }
31 37
32 /** 38 /**
@@ -9,6 +9,7 @@ use App\Models\Service\Service as ServiceSettingModel; @@ -9,6 +9,7 @@ use App\Models\Service\Service as ServiceSettingModel;
9 use App\Models\Template\BCustomTemplate; 9 use App\Models\Template\BCustomTemplate;
10 use App\Models\Template\BTemplateCommon; 10 use App\Models\Template\BTemplateCommon;
11 use App\Models\Template\BTemplateLog; 11 use App\Models\Template\BTemplateLog;
  12 +use App\Models\Template\BTemplateMain;
12 use App\Models\Template\Setting; 13 use App\Models\Template\Setting;
13 use App\Models\Template\BTemplate; 14 use App\Models\Template\BTemplate;
14 15
@@ -83,6 +84,13 @@ class CustomTemplateLogic extends BaseLogic @@ -83,6 +84,13 @@ class CustomTemplateLogic extends BaseLogic
83 if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){ 84 if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){
84 $this->fail('404页面已存在'); 85 $this->fail('404页面已存在');
85 } 86 }
  87 + if($this->param['url'] == 'search'){
  88 + $bTemplateMainModel = new BTemplateMain();
  89 + $mainInfo = $bTemplateMainModel->read(['type'=>8]);
  90 + if($mainInfo !== false){
  91 + $this->param['html'] = $mainInfo['main_html'];
  92 + }
  93 + }
86 $this->param['project_id'] = $this->user['project_id']; 94 $this->param['project_id'] = $this->user['project_id'];
87 $id = $this->model->addReturnId($this->param); 95 $id = $this->model->addReturnId($this->param);
88 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']); 96 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
@@ -331,6 +331,16 @@ class BlogLogic extends BaseLogic @@ -331,6 +331,16 @@ class BlogLogic extends BaseLogic
331 $seo_description = substr(strip_tags($data[8]),0,200); 331 $seo_description = substr(strip_tags($data[8]),0,200);
332 } 332 }
333 333
  334 + $release_at = date('Y-m-d H:i:s');
  335 + if($data[9]??''){
  336 + $release_at = date('Y-m-d H:i:s',strtotime($data[9]));
  337 + }
  338 +
  339 + $sort = 10;
  340 + if($data[10]??''){
  341 + $sort = $data[10];
  342 + }
  343 +
334 $id = $this->model->addReturnId( 344 $id = $this->model->addReturnId(
335 [ 345 [
336 'name' => $data[0], 346 'name' => $data[0],
@@ -345,7 +355,9 @@ class BlogLogic extends BaseLogic @@ -345,7 +355,9 @@ class BlogLogic extends BaseLogic
345 'operator_id' => $user_id, 355 'operator_id' => $user_id,
346 'create_id' => $user_id, 356 'create_id' => $user_id,
347 'status' => Blog::STATUS_ONE, 357 'status' => Blog::STATUS_ONE,
348 - 'url' => '' 358 + 'url' => '',
  359 + 'release_at' => $release_at,
  360 + 'sort' => $sort
349 ] 361 ]
350 ); 362 );
351 //更新路由 363 //更新路由
@@ -354,7 +366,7 @@ class BlogLogic extends BaseLogic @@ -354,7 +366,7 @@ class BlogLogic extends BaseLogic
354 if (!$route_map) { 366 if (!$route_map) {
355 $route_map = new RouteMap(); 367 $route_map = new RouteMap();
356 $route_map->project_id = $project_id; 368 $route_map->project_id = $project_id;
357 - $route_map->path = RouteMap::SOURCE_BLOG.'s'; 369 + $route_map->path = RouteMap::SOURCE_BLOG;
358 $route_map->source = RouteMap::SOURCE_BLOG; 370 $route_map->source = RouteMap::SOURCE_BLOG;
359 $route_map->source_id = $id; 371 $route_map->source_id = $id;
360 $route_map->route = $route; 372 $route_map->route = $route;
@@ -372,6 +372,16 @@ class NewsLogic extends BaseLogic @@ -372,6 +372,16 @@ class NewsLogic extends BaseLogic
372 $seo_description = substr(strip_tags($data[8]),0,200); 372 $seo_description = substr(strip_tags($data[8]),0,200);
373 } 373 }
374 374
  375 + $release_at = date('Y-m-d H:i:s');
  376 + if($data[9]??''){
  377 + $release_at = date('Y-m-d H:i:s',strtotime($data[9]));
  378 + }
  379 +
  380 + $sort = 10;
  381 + if($data[10]??''){
  382 + $sort = $data[10];
  383 + }
  384 +
375 $id = $this->model->addReturnId( 385 $id = $this->model->addReturnId(
376 [ 386 [
377 'name' => $data[0], 387 'name' => $data[0],
@@ -386,7 +396,9 @@ class NewsLogic extends BaseLogic @@ -386,7 +396,9 @@ class NewsLogic extends BaseLogic
386 'operator_id' => $user_id, 396 'operator_id' => $user_id,
387 'create_id' => $user_id, 397 'create_id' => $user_id,
388 'status' => News::STATUS_ONE, 398 'status' => News::STATUS_ONE,
389 - 'url' => '' 399 + 'url' => '',
  400 + 'release_at' => $release_at,
  401 + 'sort' => $sort
390 ] 402 ]
391 ); 403 );
392 //更新路由 404 //更新路由
@@ -244,12 +244,6 @@ class CategoryLogic extends BaseLogic @@ -244,12 +244,6 @@ class CategoryLogic extends BaseLogic
244 $str = ','.implode(',',$category).','; 244 $str = ','.implode(',',$category).',';
245 } 245 }
246 return $str; 246 return $str;
247 -// if(isset($category) && !empty($category)){  
248 -// foreach ($category as $v){  
249 -// $str .= $v.',';  
250 -// }  
251 -// }  
252 -// return !empty(trim($str,',')) ? ','.$str.',' : '';  
253 } 247 }
254 248
255 /** 249 /**
@@ -165,10 +165,15 @@ class KeywordLogic extends BaseLogic @@ -165,10 +165,15 @@ class KeywordLogic extends BaseLogic
165 $ids = $this->param['ids']; 165 $ids = $this->param['ids'];
166 $productModel = new Product(); 166 $productModel = new Product();
167 foreach ($ids as $id){ 167 foreach ($ids as $id){
168 - $product_info = $productModel->read(['keyword_id'=>['like','%,'.$id.',%']]);  
169 - if($product_info !== false){  
170 - $this->fail('当前关键词拥有产品不允许删除');  
171 - } 168 + $replace_id = ','.$id.',';
  169 + $productModel->where('keyword_id', 'like', '%,' . $id . ',%')
  170 + ->update([
  171 + 'keyword_id' => DB::raw("REPLACE(keyword_id, '$replace_id' , ',')")
  172 + ]);
  173 + $productModel->where('keyword_id', ',')
  174 + ->update([
  175 + 'keyword_id' => DB::raw("REPLACE(keyword_id, ',' , '')")
  176 + ]);
172 $this->delRoute($id); 177 $this->delRoute($id);
173 $this->model->del(['id'=>$id]); 178 $this->model->del(['id'=>$id]);
174 } 179 }
@@ -303,7 +303,7 @@ class TranslateLogic extends BaseLogic @@ -303,7 +303,7 @@ class TranslateLogic extends BaseLogic
303 if(strtolower($route) == 'all'){ 303 if(strtolower($route) == 'all'){
304 return $this->success($data); 304 return $this->success($data);
305 } 305 }
306 - if($route == '/'){ 306 + if($route == 'index'){
307 $data['source'] = 1; 307 $data['source'] = 1;
308 return $this->success($data); 308 return $this->success($data);
309 } 309 }
@@ -56,6 +56,10 @@ class UserLoginLogic @@ -56,6 +56,10 @@ class UserLoginLogic
56 } 56 }
57 $projectModel = new Project(); 57 $projectModel = new Project();
58 $project_list = $projectModel->list(['id'=>['in',$projectArr],'delete_status'=>0],'id',['id','title']); 58 $project_list = $projectModel->list(['id'=>['in',$projectArr],'delete_status'=>0],'id',['id','title']);
  59 + foreach ($project_list as $k => $v){
  60 + $v['domain'] = (new DomainInfo())->getProjectIdDomain($v['id']);
  61 + $project_list[$k] = $v;
  62 + }
59 return $this->success($project_list); 63 return $this->success($project_list);
60 } 64 }
61 65
@@ -25,7 +25,7 @@ class BlogRequest extends FormRequest @@ -25,7 +25,7 @@ class BlogRequest extends FormRequest
25 { 25 {
26 return [ 26 return [
27 'name'=>'required|max:200', 27 'name'=>'required|max:200',
28 -// 'remark'=>'max:500', 28 + 'seo_keywords'=>'max:1000',
29 'url'=>'required', 29 'url'=>'required',
30 ]; 30 ];
31 } 31 }
@@ -36,7 +36,7 @@ class BlogRequest extends FormRequest @@ -36,7 +36,7 @@ class BlogRequest extends FormRequest
36 'name.required'=>'请填写名称', 36 'name.required'=>'请填写名称',
37 'name.max'=>'名称超过最长长度200', 37 'name.max'=>'名称超过最长长度200',
38 'url.required'=>'链接不能为空', 38 'url.required'=>'链接不能为空',
39 -// 'remark.max'=>'描述超过最长长度500' 39 + 'seo_keywords.max'=>'seo_keywords太长,请重新编辑'
40 ]; 40 ];
41 } 41 }
42 } 42 }
@@ -69,10 +69,11 @@ class CopyProjectJob implements ShouldQueue @@ -69,10 +69,11 @@ class CopyProjectJob implements ShouldQueue
69 $settingTemplateModel = new Setting(); 69 $settingTemplateModel = new Setting();
70 $settingData = $settingTemplateModel::where('project_id', $this->param['project_id'])->first(); 70 $settingData = $settingTemplateModel::where('project_id', $this->param['project_id'])->first();
71 if(!empty($settingData)){ 71 if(!empty($settingData)){
72 - $settingData = $settingData->getAttributes();  
73 - unset($settingData['id']);  
74 - $settingData['project_id'] = $project_id;  
75 - $settingTemplateModel->insert($settingData); 72 + $data = [
  73 + 'template_id' =>$settingData['template_id'],
  74 + 'project_id' => $project_id
  75 + ];
  76 + $settingTemplateModel->add($data);
76 } 77 }
77 //复制部署表 78 //复制部署表
78 $buildModel = new DeployBuild(); 79 $buildModel = new DeployBuild();
@@ -13,6 +13,8 @@ class Notify extends Base @@ -13,6 +13,8 @@ class Notify extends Base
13 const STATUS_INIT = 0; 13 const STATUS_INIT = 0;
14 const STATUS_FINISH_ROUTE = 1; 14 const STATUS_FINISH_ROUTE = 1;
15 const STATUS_FINISH_PAGE = 2; 15 const STATUS_FINISH_PAGE = 2;
  16 + const STATUS_FINISH_SITEMAP = 3;
  17 + const STATUS_ERROR = 9;
16 18
17 /** 19 /**
18 * 类型 1:主站, 2:小语种, 3:amp 20 * 类型 1:主站, 2:小语种, 3:amp
@@ -36,4 +38,48 @@ class Notify extends Base @@ -36,4 +38,48 @@ class Notify extends Base
36 const ROUTE_PRODUCT_KEYWORD = 4; 38 const ROUTE_PRODUCT_KEYWORD = 4;
37 const ROUTE_NOT_TRANSLATE = 5; 39 const ROUTE_NOT_TRANSLATE = 5;
38 const ROUTE_PRODUCT_VIDEO_KEYWORD = 6; 40 const ROUTE_PRODUCT_VIDEO_KEYWORD = 6;
  41 +
  42 + /**
  43 + * 类型
  44 + * @return array
  45 + */
  46 + public static function typeMap()
  47 + {
  48 + return [
  49 + self::TYPE_MASTER => '主站',
  50 + self::TYPE_MINOR => '小语种',
  51 + self::TYPE_AMP => 'AMP',
  52 + ];
  53 + }
  54 +
  55 + /**
  56 + * 生成目标页面
  57 + * @return array
  58 + */
  59 + public static function routeMap()
  60 + {
  61 + return [
  62 + self::ROUTE_ALL => '主站页面',
  63 + self::ROUTE_NEED => '更新页面',
  64 + self::ROUTE_URL => '指定路由',
  65 + self::ROUTE_PRODUCT_KEYWORD => '聚合页面',
  66 + self::ROUTE_NOT_TRANSLATE => '漏翻检查',
  67 + self::ROUTE_PRODUCT_VIDEO_KEYWORD => '视频聚合页'
  68 + ];
  69 + }
  70 +
  71 + /**
  72 + * 状态
  73 + * @return array
  74 + */
  75 + public static function statusMap()
  76 + {
  77 + return [
  78 + self::STATUS_INIT => '排队中',
  79 + self::STATUS_FINISH_ROUTE => '页面生成中',
  80 + self::STATUS_FINISH_PAGE => 'sitemap生成中',
  81 + self::STATUS_FINISH_SITEMAP => '完成',
  82 + self::STATUS_ERROR => 'sitemap生成失败',
  83 + ];
  84 + }
39 } 85 }
@@ -61,4 +61,26 @@ class UpdateLog extends Model @@ -61,4 +61,26 @@ class UpdateLog extends Model
61 61
62 return true; 62 return true;
63 } 63 }
  64 +
  65 + /**
  66 + * 获取项目当前采集情况
  67 + * @param $project_id
  68 + * @return string
  69 + * @author Akun
  70 + * @date 2024/05/27 17:04
  71 + */
  72 + public static function getProjectUpdate($project_id)
  73 + {
  74 + $collect_time = '';
  75 + $collect_un_count = UpdateLog::where('project_id', $project_id)->where('collect_status', 0)->count();
  76 + if ($collect_un_count > 0) {
  77 + $collect_time = '采集中';
  78 + } else {
  79 + $collect_info = UpdateLog::where('project_id', $project_id)->orderBy('updated_at', 'desc')->first();
  80 + if(!empty($collect_info)){
  81 + $collect_time = $collect_info->updated_at->format('Y-m-d H:i:s');
  82 + }
  83 + }
  84 + return $collect_time;
  85 + }
64 } 86 }
@@ -68,6 +68,21 @@ class DomainInfo extends Base @@ -68,6 +68,21 @@ class DomainInfo extends Base
68 } 68 }
69 69
70 /** 70 /**
  71 + * @remark :根据项目id获取域名
  72 + * @name :getProjectIdDomain
  73 + * @author :lyh
  74 + * @method :post
  75 + * @time :2024/5/29 9:28
  76 + */
  77 + public function getProjectIdDomain($project_id){
  78 + $info = $this->read(['project_id'=>$project_id],['domain']);
  79 + if($info === false){
  80 + return '';
  81 + }
  82 + return 'https://'.$info['domain'].'/';
  83 + }
  84 +
  85 + /**
71 * @remark :301跳转扩展字段 86 * @remark :301跳转扩展字段
72 * @name :getExtendConfigAttribute 87 * @name :getExtendConfigAttribute
73 * @author :lyh 88 * @author :lyh
@@ -87,6 +87,7 @@ class Project extends Base @@ -87,6 +87,7 @@ class Project extends Base
87 9 => '星链网站(2年版)', 87 9 => '星链网站(2年版)',
88 11 => '俄语标准版', 88 11 => '俄语标准版',
89 12 => '俄语商务版', 89 12 => '俄语商务版',
  90 + 14 => '俄语旗舰版',
90 13 => '体验版' 91 13 => '体验版'
91 ]; 92 ];
92 } 93 }
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 * @time :2024/3/4 14:39 7 * @time :2024/3/4 14:39
8 */ 8 */
9 9
10 -namespace App\Models\Com; 10 +namespace App\Models\Purchaser;
11 11
12 use App\Models\Base; 12 use App\Models\Base;
13 13
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :PurchaserInfo.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/5/29 16:57
  8 + */
  9 +
  10 +namespace App\Models\Purchaser;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class PurchaserInfo extends Base
  15 +{
  16 + protected $table = 'gl_purchaser_info';
  17 +}
@@ -58,6 +58,7 @@ class RouteMap extends Base @@ -58,6 +58,7 @@ class RouteMap extends Base
58 }elseif(preg_match('/^[\x{0400}-\x{04FF}]+$/u', $title)){ 58 }elseif(preg_match('/^[\x{0400}-\x{04FF}]+$/u', $title)){
59 $title = Translate::tran($title, 'en'); 59 $title = Translate::tran($title, 'en');
60 } 60 }
  61 +
61 $i=1; 62 $i=1;
62 $sign = generateRoute($title); 63 $sign = generateRoute($title);
63 $length = strlen($sign); 64 $length = strlen($sign);
@@ -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://v6-file.globalso.com' 54 + 'cdn'=>'https://globalso-v6.s3.us-west-2.amazonaws.com'
55 ], 55 ],
56 56
57 'upload' => [ 57 'upload' => [
@@ -38,5 +38,6 @@ Route::any('getAutoToken', [\App\Http\Controllers\Api\PrivateController::class, @@ -38,5 +38,6 @@ Route::any('getAutoToken', [\App\Http\Controllers\Api\PrivateController::class,
38 //自建站接口转接 38 //自建站接口转接
39 Route::post('selfSiteApi', [\App\Http\Controllers\Api\SelfSiteController::class, 'selfSiteApi']); 39 Route::post('selfSiteApi', [\App\Http\Controllers\Api\SelfSiteController::class, 'selfSiteApi']);
40 Route::post('selfSiteNotify', [\App\Http\Controllers\Api\SelfSiteController::class, 'selfSiteNotify']); 40 Route::post('selfSiteNotify', [\App\Http\Controllers\Api\SelfSiteController::class, 'selfSiteNotify']);
  41 +Route::post('selfSiteVerify', [\App\Http\Controllers\Api\SelfSiteController::class, 'selfSiteVerify']);
41 42
42 43
@@ -276,6 +276,7 @@ Route::middleware(['aloginauth'])->group(function () { @@ -276,6 +276,7 @@ Route::middleware(['aloginauth'])->group(function () {
276 Route::any('/saveAiPrefix', [Aside\Optimize\OptimizeController::class, 'saveAiPrefix'])->name('admin.optimize_saveAiPrefix');//保存Ai前后缀 276 Route::any('/saveAiPrefix', [Aside\Optimize\OptimizeController::class, 'saveAiPrefix'])->name('admin.optimize_saveAiPrefix');//保存Ai前后缀
277 Route::any('/setRobots', [Aside\Optimize\OptimizeController::class, 'setRobots'])->name('admin.optimize_setRobots');//设置robots开关 277 Route::any('/setRobots', [Aside\Optimize\OptimizeController::class, 'setRobots'])->name('admin.optimize_setRobots');//设置robots开关
278 Route::any('/editBacklink', [Aside\Optimize\OptimizeController::class, 'editBacklink'])->name('admin.optimize_editBacklink');//设置backlink开关 278 Route::any('/editBacklink', [Aside\Optimize\OptimizeController::class, 'editBacklink'])->name('admin.optimize_editBacklink');//设置backlink开关
  279 + Route::any('/setAiVideo', [Aside\Optimize\OptimizeController::class, 'setAiVideo'])->name('admin.optimize_setAiVideo');//设置backlink开关
279 Route::any('/editTranslateStatus', [Aside\Optimize\OptimizeController::class, 'editTranslateStatus'])->name('admin.optimize_editTranslateStatus');//设置robots开关 280 Route::any('/editTranslateStatus', [Aside\Optimize\OptimizeController::class, 'editTranslateStatus'])->name('admin.optimize_editTranslateStatus');//设置robots开关
280 }); 281 });
281 //生成关键字 282 //生成关键字
@@ -411,6 +412,10 @@ Route::middleware(['aloginauth'])->group(function () { @@ -411,6 +412,10 @@ Route::middleware(['aloginauth'])->group(function () {
411 412
412 Route::any('/generate_aicc_token', [Aside\Com\IndexController::class, 'generateAiCCToken'])->name('admin.generate_aicc_token'); 413 Route::any('/generate_aicc_token', [Aside\Com\IndexController::class, 'generateAiCCToken'])->name('admin.generate_aicc_token');
413 Route::any('/getAutoToken', [Aside\Com\IndexController::class, 'getAutoToken'])->name('admin.getAutoToken'); 414 Route::any('/getAutoToken', [Aside\Com\IndexController::class, 'getAutoToken'])->name('admin.getAutoToken');
  415 +
  416 + // 生成页面任务
  417 + Route::any('/create_html_task', [Aside\Task\AutoTaskController::class, 'createHtmlTask'])->name('admin.create_html_task');
  418 + Route::any('/create_html_param', [Aside\Task\AutoTaskController::class, 'createHtmlTaskParam'])->name('admin.create_html_param');
414 }); 419 });
415 420
416 //无需登录验证的路由组 421 //无需登录验证的路由组
@@ -266,6 +266,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -266,6 +266,7 @@ Route::middleware(['bloginauth'])->group(function () {
266 Route::post('keyword/batchAdd', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchAdd'])->name('product_keyword_batchAdd'); 266 Route::post('keyword/batchAdd', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchAdd'])->name('product_keyword_batchAdd');
267 Route::post('keyword/batchDel', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchDel'])->name('product_keyword_batchDel'); 267 Route::post('keyword/batchDel', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchDel'])->name('product_keyword_batchDel');
268 Route::any('keyword/delete', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'delete'])->name('product_keyword_delete'); 268 Route::any('keyword/delete', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'delete'])->name('product_keyword_delete');
  269 + Route::any('keyword/batchKeywordIsVideo', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchKeywordIsVideo'])->name('product_keyword_batchKeywordIsVideo');
269 Route::any('keyword/batchKeywordFiled', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchKeywordFiled'])->name('product_keyword_batchKeywordFiled'); 270 Route::any('keyword/batchKeywordFiled', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchKeywordFiled'])->name('product_keyword_batchKeywordFiled');
270 //产品参数 271 //产品参数
271 Route::get('attr', [\App\Http\Controllers\Bside\Product\AttrController::class, 'index'])->name('product_attr'); 272 Route::get('attr', [\App\Http\Controllers\Bside\Product\AttrController::class, 'index'])->name('product_attr');
@@ -368,6 +369,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -368,6 +369,7 @@ Route::middleware(['bloginauth'])->group(function () {
368 Route::any('/', [\App\Http\Controllers\Bside\Template\BTemplateModuleController::class, 'lists'])->name('template_module_lists'); 369 Route::any('/', [\App\Http\Controllers\Bside\Template\BTemplateModuleController::class, 'lists'])->name('template_module_lists');
369 Route::any('/read', [\App\Http\Controllers\Bside\Template\BTemplateModuleController::class, 'read'])->name('template_module_read'); 370 Route::any('/read', [\App\Http\Controllers\Bside\Template\BTemplateModuleController::class, 'read'])->name('template_module_read');
370 Route::any('/type', [\App\Http\Controllers\Bside\Template\BTemplateModuleController::class, 'getType'])->name('template_module_getType'); 371 Route::any('/type', [\App\Http\Controllers\Bside\Template\BTemplateModuleController::class, 'getType'])->name('template_module_getType');
  372 + Route::any('/setModuleNumber', [\App\Http\Controllers\Bside\Template\BTemplateModuleController::class, 'setModuleNumber'])->name('template_module_setModuleNumber');
371 }); 373 });
372 374
373 // 保存私有模块 375 // 保存私有模块
@@ -536,6 +538,12 @@ Route::middleware(['bloginauth'])->group(function () { @@ -536,6 +538,12 @@ Route::middleware(['bloginauth'])->group(function () {
536 Route::prefix('tutorial')->group(function () { 538 Route::prefix('tutorial')->group(function () {
537 Route::any('/', [\App\Http\Controllers\Bside\BCom\TutorialController::class, 'lists'])->name('tutorial_lists'); 539 Route::any('/', [\App\Http\Controllers\Bside\BCom\TutorialController::class, 'lists'])->name('tutorial_lists');
538 }); 540 });
  541 + //oa教程
  542 + Route::prefix('template_label')->group(function () {
  543 + Route::any('/getUserLists', [\App\Http\Controllers\Bside\Template\BTemplateLabelController::class, 'getUserLists'])->name('template_label_getUserLists');
  544 + Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateLabelController::class, 'save'])->name('template_label_save');
  545 + Route::any('/del', [\App\Http\Controllers\Bside\Template\BTemplateLabelController::class, 'del'])->name('template_label_del');
  546 + });
539 }); 547 });
540 //无需登录验证的路由组 548 //无需登录验证的路由组
541 Route::group([], function () { 549 Route::group([], function () {