作者 赵彬吉
正在显示 35 个修改的文件 包含 358 行增加138 行删除
@@ -50,11 +50,11 @@ class Count extends Command @@ -50,11 +50,11 @@ class Count extends Command
50 try { 50 try {
51 if(!empty($list)){ 51 if(!empty($list)){
52 $list = $list->toArray(); 52 $list = $list->toArray();
53 - $data = [];  
54 $yesterday = Carbon::yesterday()->toDateString(); 53 $yesterday = Carbon::yesterday()->toDateString();
55 $domainInfo = new DomainInfo(); 54 $domainInfo = new DomainInfo();
56 foreach ($list as $v){ 55 foreach ($list as $v){
57 $v = (array)$v; 56 $v = (array)$v;
  57 + echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
58 if($v['type'] == Project::TYPE_ZERO){ 58 if($v['type'] == Project::TYPE_ZERO){
59 continue; 59 continue;
60 } 60 }
@@ -76,7 +76,7 @@ class Count extends Command @@ -76,7 +76,7 @@ class Count extends Command
76 //服务达标天数 76 //服务达标天数
77 $arr['compliance_day'] = $v['finish_remain_day']; 77 $arr['compliance_day'] = $v['finish_remain_day'];
78 //剩余服务时常 78 //剩余服务时常
79 - $arr['service_day'] = $v['remain_day'] - 1; 79 + $arr['service_day'] = ($v['remain_day'] - 1) < 0 ? 0: $v['remain_day'] - 1;
80 //项目id 80 //项目id
81 $arr['project_id'] = $v['project_id']; 81 $arr['project_id'] = $v['project_id'];
82 $arr['created_at'] = date('Y-m-d H:i:s'); 82 $arr['created_at'] = date('Y-m-d H:i:s');
@@ -84,9 +84,16 @@ class Count extends Command @@ -84,9 +84,16 @@ class Count extends Command
84 //询盘统计 84 //询盘统计
85 $arr = $this->inquiry($arr,$v['test_domain'], $v['id']); 85 $arr = $this->inquiry($arr,$v['test_domain'], $v['id']);
86 if($arr === false){ 86 if($arr === false){
87 - $data[] = $v['test_domain']; 87 + continue;
  88 + }
  89 + //查询当天数据是否存在 存在则更新
  90 + $countModel = new \App\Models\HomeCount\Count();
  91 + $info = $countModel->read(['date'=>$arr['date'],'project_id'=>$v['id']]);
  92 + if($info === false){
  93 + DB::table('gl_count')->insert($arr);
  94 + }else{
  95 + $countModel->edit($arr,['id'=>$info['id']]);
88 } 96 }
89 - DB::table('gl_count')->insert($arr);  
90 Log::channel('day_count')->error('日期:'.$arr['created_at'].'success: ' .$v['test_domain']); 97 Log::channel('day_count')->error('日期:'.$arr['created_at'].'success: ' .$v['test_domain']);
91 } 98 }
92 } 99 }
1 <?php 1 <?php
2 /** 2 /**
3 * @remark : 3 * @remark :
4 - * @name :UpgradeProjectCount.php 4 + * @name :CountProject.php
5 * @author :lyh 5 * @author :lyh
6 * @method :post 6 * @method :post
7 * @time :2024/1/8 9:03 7 * @time :2024/1/8 9:03
@@ -18,15 +18,16 @@ use Illuminate\Console\Command; @@ -18,15 +18,16 @@ use Illuminate\Console\Command;
18 use Illuminate\Support\Facades\DB; 18 use Illuminate\Support\Facades\DB;
19 use App\Models\HomeCount\Count; 19 use App\Models\HomeCount\Count;
20 20
21 -class UpgradeCount extends Command 21 +class CountAll extends Command
22 { 22 {
23 - 23 + const STATUS_ERROR = 400;
  24 + public $error = 0;
24 /** 25 /**
25 * The name and signature of the console command. 26 * The name and signature of the console command.
26 * 27 *
27 * @var string 28 * @var string
28 */ 29 */
29 - protected $signature = 'upgrade_counts'; 30 + protected $signature = 'count_all';
30 31
31 /** 32 /**
32 * The console command description. 33 * The console command description.
@@ -37,7 +38,7 @@ class UpgradeCount extends Command @@ -37,7 +38,7 @@ class UpgradeCount extends Command
37 38
38 public function handle(){ 39 public function handle(){
39 $projectModel = new Project(); 40 $projectModel = new Project();
40 - $list = $projectModel->list(['is_upgrade'=>1,'delete_status'=>0]); 41 + $list = $projectModel->list(['delete_status'=>0]);
41 foreach ($list as $v) { 42 foreach ($list as $v) {
42 echo date('Y-m-d H:i:s') . '项目id:'.$v['id'] . PHP_EOL; 43 echo date('Y-m-d H:i:s') . '项目id:'.$v['id'] . PHP_EOL;
43 ProjectServer::useProject($v['id']); 44 ProjectServer::useProject($v['id']);
1 <?php 1 <?php
2 /** 2 /**
3 * @remark : 3 * @remark :
4 - * @name :UpgradeProjectCount.php 4 + * @name :CountProject.php
5 * @author :lyh 5 * @author :lyh
6 * @method :post 6 * @method :post
7 * @time :2024/1/8 9:03 7 * @time :2024/1/8 9:03
@@ -20,7 +20,7 @@ use Illuminate\Console\Command; @@ -20,7 +20,7 @@ use Illuminate\Console\Command;
20 use Illuminate\Support\Facades\DB; 20 use Illuminate\Support\Facades\DB;
21 use App\Models\HomeCount\Count; 21 use App\Models\HomeCount\Count;
22 22
23 -class UpgradeProjectCount extends Command 23 +class CountProject extends Command
24 { 24 {
25 const STATUS_ERROR = 400; 25 const STATUS_ERROR = 400;
26 public $error = 0; 26 public $error = 0;
@@ -29,7 +29,7 @@ class UpgradeProjectCount extends Command @@ -29,7 +29,7 @@ class UpgradeProjectCount extends Command
29 * 29 *
30 * @var string 30 * @var string
31 */ 31 */
32 - protected $signature = 'upgrade_count {project_id}'; 32 + protected $signature = 'count_project {project_id}';
33 33
34 /** 34 /**
35 * The console command description. 35 * The console command description.
@@ -61,10 +61,10 @@ class UpgradeProjectCount extends Command @@ -61,10 +61,10 @@ class UpgradeProjectCount extends Command
61 $optimizeInfo = $projectOptimizeModel->read(['project_id'=>$project_id]); 61 $optimizeInfo = $projectOptimizeModel->read(['project_id'=>$project_id]);
62 $domain = ''; 62 $domain = '';
63 if(!empty($optimizeInfo['domain'])){ 63 if(!empty($optimizeInfo['domain'])){
64 - $domainInfo = new DomainInfo();  
65 - $info = $domainInfo->read(['id'=>$optimizeInfo['domain']]);  
66 - if($info !== false){  
67 - $domain = $info['domain']; 64 + $domainInfoModel = new DomainInfo();
  65 + $domainInfo = $domainInfoModel->read(['id'=>$optimizeInfo['domain']]);
  66 + if($domainInfo !== false){
  67 + $domain = $domainInfo['domain'];
68 } 68 }
69 } 69 }
70 if(empty($domain)){ 70 if(empty($domain)){
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 namespace App\Console\Commands\Domain; 10 namespace App\Console\Commands\Domain;
11 11
12 use App\Models\Devops\ServerConfig; 12 use App\Models\Devops\ServerConfig;
  13 +use App\Models\Devops\ServersIp;
13 use App\Models\Project\CountryCustom; 14 use App\Models\Project\CountryCustom;
14 use App\Models\Project\Project; 15 use App\Models\Project\Project;
15 use Illuminate\Console\Command; 16 use Illuminate\Console\Command;
@@ -98,13 +99,18 @@ class DomainInfo extends Command @@ -98,13 +99,18 @@ class DomainInfo extends Command
98 $ssl['to'] && $data['certificate_end_time'] = $ssl['to']; 99 $ssl['to'] && $data['certificate_end_time'] = $ssl['to'];
99 100
100 $project_info = $projectModel->read(['id' => $v['project_id']], ['serve_id']); 101 $project_info = $projectModel->read(['id' => $v['project_id']], ['serve_id']);
101 - if ($v['type'] == 1 && $ssl['to'] < $end_day && $project_info && $project_info['serve_id'] != ServerConfig::SELF_SITE_ID) {  
102 - //非自建站项目,申请免费证书  
103 - $this->updatePrivate($v); 102 + if ($v['type'] == 1 && $ssl['to'] < $end_day && $project_info) {
  103 + $serverIpModel = new ServersIp();
  104 + $servers_ip_info = $serverIpModel->read(['id' => $project_info['serve_id']], ['servers_id']);
  105 + if ($servers_ip_info && $servers_ip_info['servers_id'] != ServerConfig::SELF_SITE_ID) {
  106 + //非自建站项目,申请免费证书
  107 + $this->updatePrivate($v);
  108 +
  109 + $ssl_new = $this->updateDomainSsl($v['domain']);
  110 + $ssl_new['from'] && $data['certificate_start_time'] = $ssl_new['from'];
  111 + $ssl_new['to'] && $data['certificate_end_time'] = $ssl_new['to'];
  112 + }
104 113
105 - $ssl_new = $this->updateDomainSsl($v['domain']);  
106 - $ssl_new['from'] && $data['certificate_start_time'] = $ssl_new['from'];  
107 - $ssl_new['to'] && $data['certificate_end_time'] = $ssl_new['to'];  
108 } 114 }
109 115
110 $domainModel->edit($data, ['id' => $v['id']]); 116 $domainModel->edit($data, ['id' => $v['id']]);
@@ -142,13 +148,17 @@ class DomainInfo extends Command @@ -142,13 +148,17 @@ class DomainInfo extends Command
142 $ssl['to'] && $data['amp_certificate_end_time'] = $ssl['to']; 148 $ssl['to'] && $data['amp_certificate_end_time'] = $ssl['to'];
143 149
144 $project_info = $projectModel->read(['id' => $v['project_id']], ['serve_id']); 150 $project_info = $projectModel->read(['id' => $v['project_id']], ['serve_id']);
145 - if ($v['amp_type'] == 1 && $ssl['to'] < $end_day && $project_info && $project_info['serve_id'] != ServerConfig::SELF_SITE_ID) {  
146 - //非自建站项目,申请免费证书  
147 - $this->updateAmpPrivate($v['domain']); 151 + if ($v['amp_type'] == 1 && $ssl['to'] < $end_day && $project_info) {
  152 + $serverIpModel = new ServersIp();
  153 + $servers_ip_info = $serverIpModel->read(['id' => $project_info['serve_id']], ['servers_id']);
  154 + if ($servers_ip_info && $servers_ip_info['servers_id'] != ServerConfig::SELF_SITE_ID) {
  155 + //非自建站项目,申请免费证书
  156 + $this->updateAmpPrivate($v['domain']);
148 157
149 - $ssl_new = $this->updateDomainSsl($v['domain']);  
150 - $ssl_new['from'] && $data['certificate_start_time'] = $ssl_new['from'];  
151 - $ssl_new['to'] && $data['certificate_end_time'] = $ssl_new['to']; 158 + $ssl_new = $this->updateDomainSsl($v['domain']);
  159 + $ssl_new['from'] && $data['certificate_start_time'] = $ssl_new['from'];
  160 + $ssl_new['to'] && $data['certificate_end_time'] = $ssl_new['to'];
  161 + }
152 } 162 }
153 163
154 $domainModel->edit($data, ['id' => $v['id']]); 164 $domainModel->edit($data, ['id' => $v['id']]);
1 <?php 1 <?php
2 /** 2 /**
3 * @remark : 3 * @remark :
4 - * @name :UpgradeProjectCount.php 4 + * @name :CountProject.php
5 * @author :lyh 5 * @author :lyh
6 * @method :post 6 * @method :post
7 * @time :2024/1/8 9:03 7 * @time :2024/1/8 9:03
@@ -21,14 +21,14 @@ use Illuminate\Console\Command; @@ -21,14 +21,14 @@ use Illuminate\Console\Command;
21 use Illuminate\Support\Facades\DB; 21 use Illuminate\Support\Facades\DB;
22 use App\Models\HomeCount\Count; 22 use App\Models\HomeCount\Count;
23 23
24 -class UpgradeCount extends Command 24 +class MonthAllCount extends Command
25 { 25 {
26 /** 26 /**
27 * The name and signature of the console command. 27 * The name and signature of the console command.
28 * 28 *
29 * @var string 29 * @var string
30 */ 30 */
31 - protected $signature = 'upgrade_month_counts'; 31 + protected $signature = 'month_all';
32 32
33 /** 33 /**
34 * The console command description. 34 * The console command description.
@@ -39,7 +39,7 @@ class UpgradeCount extends Command @@ -39,7 +39,7 @@ class UpgradeCount extends Command
39 39
40 public function handle(){ 40 public function handle(){
41 $projectModel = new Project(); 41 $projectModel = new Project();
42 - $list = $projectModel->list(['is_upgrade'=>1,'delete_status'=>0]); 42 + $list = $projectModel->list(['delete_status'=>0]);
43 foreach ($list as $v) { 43 foreach ($list as $v) {
44 if($v['is_upgrade'] == 1){ 44 if($v['is_upgrade'] == 1){
45 $oldModel = new UpdateOldInfo(); 45 $oldModel = new UpdateOldInfo();
@@ -77,9 +77,7 @@ class UpgradeCount extends Command @@ -77,9 +77,7 @@ class UpgradeCount extends Command
77 ->groupBy('month')->get()->toArray(); 77 ->groupBy('month')->get()->toArray();
78 foreach ($list as $k=>$v){ 78 foreach ($list as $k=>$v){
79 $v = (array)$v; 79 $v = (array)$v;
80 - if($v['month'] == date('Y-m')){  
81 - continue;  
82 - } 80 + $arr = [];
83 $monthCountModel = new MonthCount(); 81 $monthCountModel = new MonthCount();
84 $info = $monthCountModel->read(['month'=>$v['month'],'project_id'=>$project_id]); 82 $info = $monthCountModel->read(['month'=>$v['month'],'project_id'=>$project_id]);
85 // 获取当月开始时间 83 // 获取当月开始时间
@@ -88,7 +86,7 @@ class UpgradeCount extends Command @@ -88,7 +86,7 @@ class UpgradeCount extends Command
88 $end = date('Y-m-t', strtotime($v['month'])); 86 $end = date('Y-m-t', strtotime($v['month']));
89 $arr['project_id'] = $project_id; 87 $arr['project_id'] = $project_id;
90 $res = $this->inquiry($url,$v['month']); 88 $res = $this->inquiry($url,$v['month']);
91 -// $arr['month_total'] = 0; 89 + $arr['total'] = $arr['month_total'] = 0;
92 if(isset($res['data']['count'])){ 90 if(isset($res['data']['count'])){
93 echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL; 91 echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL;
94 $arr['month_total'] = $res['data']['count']; 92 $arr['month_total'] = $res['data']['count'];
1 <?php 1 <?php
2 /** 2 /**
3 * @remark : 3 * @remark :
4 - * @name :UpgradeProjectCount.php 4 + * @name :CountProject.php
5 * @author :lyh 5 * @author :lyh
6 * @method :post 6 * @method :post
7 * @time :2024/1/8 9:03 7 * @time :2024/1/8 9:03
@@ -99,6 +99,7 @@ class MonthCount extends Command @@ -99,6 +99,7 @@ class MonthCount extends Command
99 * @time :2024/1/8 9:05 99 * @time :2024/1/8 9:05
100 */ 100 */
101 public function count($project_id,$url){ 101 public function count($project_id,$url){
  102 + $arr = [];
102 $v = ['month'=>date('Y-m')]; 103 $v = ['month'=>date('Y-m')];
103 $monthCountModel = new MonthCountModel(); 104 $monthCountModel = new MonthCountModel();
104 $info = $monthCountModel->read(['month'=>$v['month'],'project_id'=>$project_id]); 105 $info = $monthCountModel->read(['month'=>$v['month'],'project_id'=>$project_id]);
@@ -108,7 +109,7 @@ class MonthCount extends Command @@ -108,7 +109,7 @@ class MonthCount extends Command
108 $end = date('Y-m-t', strtotime($v['month'])); 109 $end = date('Y-m-t', strtotime($v['month']));
109 $arr['project_id'] = $project_id; 110 $arr['project_id'] = $project_id;
110 $res = $this->inquiry($url,$v['month']); 111 $res = $this->inquiry($url,$v['month']);
111 -// $arr['month_total'] = 0; 112 + $arr['total'] = $arr['month_total'] = 0;
112 if(isset($res['data']['count'])){ 113 if(isset($res['data']['count'])){
113 echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL; 114 echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL;
114 $arr['month_total'] = $res['data']['count']; 115 $arr['month_total'] = $res['data']['count'];
1 <?php 1 <?php
2 /** 2 /**
3 * @remark : 3 * @remark :
4 - * @name :UpgradeProjectCount.php 4 + * @name :CountProject.php
5 * @author :lyh 5 * @author :lyh
6 * @method :post 6 * @method :post
7 * @time :2024/1/8 9:03 7 * @time :2024/1/8 9:03
@@ -21,14 +21,14 @@ use Illuminate\Console\Command; @@ -21,14 +21,14 @@ use Illuminate\Console\Command;
21 use Illuminate\Support\Facades\DB; 21 use Illuminate\Support\Facades\DB;
22 use App\Models\HomeCount\Count; 22 use App\Models\HomeCount\Count;
23 23
24 -class UpgradeProjectCount extends Command 24 +class MonthProjectCount extends Command
25 { 25 {
26 /** 26 /**
27 * The name and signature of the console command. 27 * The name and signature of the console command.
28 * 28 *
29 * @var string 29 * @var string
30 */ 30 */
31 - protected $signature = 'upgrade_month_count {project_id}'; 31 + protected $signature = 'month_project {project_id}';
32 32
33 /** 33 /**
34 * The console command description. 34 * The console command description.
@@ -65,10 +65,8 @@ class UpgradeProjectCount extends Command @@ -65,10 +65,8 @@ class UpgradeProjectCount extends Command
65 ->select(DB::raw('DATE_FORMAT(updated_date, "%Y-%m") as month')) 65 ->select(DB::raw('DATE_FORMAT(updated_date, "%Y-%m") as month'))
66 ->groupBy('month')->get()->toArray(); 66 ->groupBy('month')->get()->toArray();
67 foreach ($list as $k=>$v){ 67 foreach ($list as $k=>$v){
  68 + $arr = [];
68 $v = (array)$v; 69 $v = (array)$v;
69 -// if($v['month'] == date('Y-m')){  
70 -// continue;  
71 -// }  
72 $monthCountModel = new MonthCount(); 70 $monthCountModel = new MonthCount();
73 $info = $monthCountModel->read(['month'=>$v['month'],'project_id'=>$project_id]); 71 $info = $monthCountModel->read(['month'=>$v['month'],'project_id'=>$project_id]);
74 // 获取当月开始时间 72 // 获取当月开始时间
@@ -77,7 +75,7 @@ class UpgradeProjectCount extends Command @@ -77,7 +75,7 @@ class UpgradeProjectCount extends Command
77 $end = date('Y-m-t', strtotime($v['month'])); 75 $end = date('Y-m-t', strtotime($v['month']));
78 $arr['project_id'] = $project_id; 76 $arr['project_id'] = $project_id;
79 $res = $this->inquiry($url,$v['month']); 77 $res = $this->inquiry($url,$v['month']);
80 -// $arr['month_total'] = 0; 78 + $arr['total'] = $arr['month_total'] = 0;
81 if(isset($res['data']['count'])){ 79 if(isset($res['data']['count'])){
82 echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL; 80 echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL;
83 $arr['month_total'] = $res['data']['count']; 81 $arr['month_total'] = $res['data']['count'];
@@ -13,6 +13,7 @@ use App\Models\Com\KeywordVideoTaskLog; @@ -13,6 +13,7 @@ use App\Models\Com\KeywordVideoTaskLog;
13 use App\Models\Domain\DomainInfo; 13 use App\Models\Domain\DomainInfo;
14 use Illuminate\Console\Command; 14 use Illuminate\Console\Command;
15 use Illuminate\Support\Facades\DB; 15 use Illuminate\Support\Facades\DB;
  16 +use Illuminate\Support\Facades\Log;
16 17
17 /** 18 /**
18 * @remark :通知C端生成界面 19 * @remark :通知C端生成界面
@@ -65,6 +66,7 @@ class Notice extends Command @@ -65,6 +66,7 @@ class Notice extends Command
65 } 66 }
66 foreach ($domainList as $v1){ 67 foreach ($domainList as $v1){
67 //TODO::通知C端 68 //TODO::通知C端
  69 + @file_put_contents(storage_path('logs/notice_c'.'.log'), var_export($v1['domain'], true) . PHP_EOL, FILE_APPEND);
68 $this->curlDelRoute($v1['domain'],$v1['project_id']); 70 $this->curlDelRoute($v1['domain'],$v1['project_id']);
69 } 71 }
70 return true; 72 return true;
@@ -54,12 +54,13 @@ class UpdateRoute extends Command @@ -54,12 +54,13 @@ class UpdateRoute extends Command
54 */ 54 */
55 public function handle(){ 55 public function handle(){
56 $projectModel = new Project(); 56 $projectModel = new Project();
57 - $list = $projectModel->list(['id'=>['in',[1085]]]); 57 + $list = $projectModel->list(['id'=>['in',[664]]]);
58 $data = []; 58 $data = [];
59 foreach ($list as $v){ 59 foreach ($list as $v){
60 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;
61 ProjectServer::useProject($v['id']); 61 ProjectServer::useProject($v['id']);
62 - $this->getProduct(); 62 +// $this->getProduct();
  63 + $this->setProductKeyword();
63 DB::disconnect('custom_mysql'); 64 DB::disconnect('custom_mysql');
64 } 65 }
65 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 66 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
@@ -106,19 +107,8 @@ class UpdateRoute extends Command @@ -106,19 +107,8 @@ class UpdateRoute extends Command
106 if(!empty($lists)){ 107 if(!empty($lists)){
107 foreach ($lists as $v){ 108 foreach ($lists as $v){
108 if(!empty($v['route'])){ 109 if(!empty($v['route'])){
109 -// $tag = "-tag";  
110 -// if ((substr($v['route'], -strlen($tag)) === $tag)) {  
111 -// echo date('Y-m-d H:i:s') . '拼接 :'.$v['id'] . PHP_EOL;  
112 -// $route = Translate::tran($v['route'], 'en').$tag;  
113 -// // 如果不是以 '-tag' 结尾,则拼接上 '-tag'  
114 -// $route = trim($v['route'],'-tag');  
115 -// $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);  
116 -// $keywordModel->edit(['route'=>$route],['id'=>$v['id']]);  
117 -// }else{  
118 -// $route = Translate::tran($v['title'], 'en').$tag;  
119 -// $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);  
120 -// $keywordModel->edit(['route'=>$route],['id'=>$v['id']]);  
121 -// } 110 + echo date('Y-m-d H:i:s') . 'route :'.$v['id'] . PHP_EOL;
  111 + continue;
122 }else{ 112 }else{
123 echo date('Y-m-d H:i:s') . 'route :'.$v['id'] . PHP_EOL; 113 echo date('Y-m-d H:i:s') . 'route :'.$v['id'] . PHP_EOL;
124 $route = Translate::tran($v['title'], 'en'); 114 $route = Translate::tran($v['title'], 'en');
@@ -128,7 +118,6 @@ class UpdateRoute extends Command @@ -128,7 +118,6 @@ class UpdateRoute extends Command
128 $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); 118 $keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
129 } 119 }
130 } 120 }
131 - echo date('Y-m-d H:i:s') . 'end :' . PHP_EOL;  
132 } 121 }
133 } 122 }
134 } 123 }
@@ -224,7 +213,7 @@ class UpdateRoute extends Command @@ -224,7 +213,7 @@ class UpdateRoute extends Command
224 213
225 public function getProduct(){ 214 public function getProduct(){
226 $productModel = new Product(); 215 $productModel = new Product();
227 - $lists = $productModel->list(['status'=>1]); 216 + $lists = $productModel->list(['status'=>1,'id'=>['<=',501]]);
228 if(!empty($lists)){ 217 if(!empty($lists)){
229 foreach ($lists as $v){ 218 foreach ($lists as $v){
230 if(!empty($v['route'])){ 219 if(!empty($v['route'])){
@@ -240,9 +229,10 @@ class UpdateRoute extends Command @@ -240,9 +229,10 @@ class UpdateRoute extends Command
240 // $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); 229 // $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']);
241 // $productModel->edit(['route'=>$route],['id'=>$v['id']]); 230 // $productModel->edit(['route'=>$route],['id'=>$v['id']]);
242 } 231 }
  232 + continue;
243 }else{ 233 }else{
244 echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; 234 echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL;
245 -// $v['title'] = Translate::tran($v['title'], 'en'); 235 + $v['title'] = Translate::tran($v['title'], 'en');
246 $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); 236 $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']);
247 $productModel->edit(['route'=>$route],['id'=>$v['id']]); 237 $productModel->edit(['route'=>$route],['id'=>$v['id']]);
248 } 238 }
@@ -92,8 +92,6 @@ class HtmlCollect extends Command @@ -92,8 +92,6 @@ class HtmlCollect extends Command
92 try { 92 try {
93 $html = curl_c('https://' . $collect_info->domain . $collect_info->route, false); 93 $html = curl_c('https://' . $collect_info->domain . $collect_info->route, false);
94 if (strlen($html) < 4) { 94 if (strlen($html) < 4) {
95 - $collect_info->status = CollectTask::STATUS_FAIL;  
96 - $collect_info->save();  
97 95
98 if ($html == 404) { 96 if ($html == 404) {
99 //原数据页面404,需要将6.0数据存入草稿箱 97 //原数据页面404,需要将6.0数据存入草稿箱
@@ -124,6 +122,8 @@ class HtmlCollect extends Command @@ -124,6 +122,8 @@ class HtmlCollect extends Command
124 $status_draft = BCustomTemplate::STATUS_DRAFT; 122 $status_draft = BCustomTemplate::STATUS_DRAFT;
125 } 123 }
126 $model->edit(['status' => $status_draft], ['project_id' => $project_id, 'id' => $collect_info->source_id, 'six_read' => 1]); 124 $model->edit(['status' => $status_draft], ['project_id' => $project_id, 'id' => $collect_info->source_id, 'six_read' => 1]);
  125 +
  126 + CollectTask::where('source', $collect_info->source)->where('source_id', $collect_info->source_id)->delete();
127 } 127 }
128 128
129 echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', error: ' . $html . PHP_EOL; 129 echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', error: ' . $html . PHP_EOL;
@@ -347,6 +347,14 @@ class HtmlCollect extends Command @@ -347,6 +347,14 @@ class HtmlCollect extends Command
347 $source[] = $check_vv2; 347 $source[] = $check_vv2;
348 } 348 }
349 } 349 }
  350 + preg_match_all('/<iframe\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_video_3);
  351 + $video_3 = $result_video_3[2] ?? [];
  352 + foreach ($video_3 as $vv3) {
  353 + $check_vv3 = $this->url_check($vv3, $project_id, $domain, $web_url_domain, $home_url);
  354 + if ($check_vv3 && (!in_array($check_vv3, $source))) {
  355 + $source[] = $check_vv3;
  356 + }
  357 + }
350 358
351 //css 359 //css
352 preg_match_all('/<link\s+[^>]*?href\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_css); 360 preg_match_all('/<link\s+[^>]*?href\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_css);
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :UpdateKeyword.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/7/3 9:23
  8 + */
  9 +
  10 +namespace App\Console\Commands\Update;
  11 +
  12 +use App\Models\Domain\DomainInfo;
  13 +use App\Models\Product\Keyword;
  14 +use App\Models\Product\KeywordPage;
  15 +use App\Services\ProjectServer;
  16 +use Illuminate\Console\Command;
  17 +use Illuminate\Support\Facades\DB;
  18 +
  19 +class UpdateKeyword extends Command
  20 +{
  21 + /**
  22 + * The name and signature of the console command.
  23 + *
  24 + * @var string
  25 + */
  26 + protected $signature = 'update_keyword_content';
  27 +
  28 + /**
  29 + * The console command description.
  30 + *
  31 + * @var string
  32 + */
  33 + protected $description = '批量更新关键词内容';
  34 +
  35 +
  36 + public function handle(){
  37 + while (true){
  38 + $keywordPageModel = new KeywordPage();
  39 + $lists = $keywordPageModel->list(['status'=>0]);
  40 + if(empty($lists)){
  41 + sleep(100);
  42 + continue;
  43 + }
  44 + $domainModel = new DomainInfo();
  45 + foreach ($lists as $v){
  46 + ProjectServer::useProject($v['project_id']);
  47 + $this->saveKeywordContent($v);
  48 + DB::disconnect('custom_mysql');
  49 + //获取当前项目的域名
  50 + $domainInfo = $domainModel->read(['project_id'=>$v['project_id']]);
  51 + if($domainInfo !== false){
  52 + $this->curlDelRoute($domainInfo['domain'],$v['project_id']);
  53 + }
  54 + $keywordPageModel->edit(['status'=>1],['id'=>$v['id']]);
  55 + }
  56 + sleep(10);
  57 + }
  58 +
  59 + }
  60 +
  61 + /**
  62 + * @remark :更新关键词内容
  63 + * @name :saveKeywordContent
  64 + * @author :lyh
  65 + * @method :post
  66 + * @time :2024/7/3 10:25
  67 + */
  68 + public function saveKeywordContent($info){
  69 + $keywordModel = new Keyword();
  70 + $updateObject = json_decode($info['update_object'],true);
  71 + $text = json_decode($info['text'],true);
  72 + if(empty($text)){
  73 + return false;
  74 + }
  75 + $number = count($text);
  76 + $randomNumber = rand(0, $number - 1);
  77 + if($updateObject['type'] == 0){//更新所有关键字
  78 + $keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['status'=>1]);
  79 + }else{
  80 + //按传递的关键字更新
  81 + if(!empty($updateObject['keyword'])){
  82 + $updateObject['keyword'] = (array)$updateObject['keyword'];
  83 + $keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['title'=>['in',$updateObject['keyword']]]);
  84 + }
  85 + //按给定的数量更新
  86 + if(!empty($updateObject['number']) && ($updateObject['number'] != 0)){
  87 + $keywordIdArr = $keywordModel->where("status",1)->inRandomOrder()->take($updateObject['number'])->pluck('id')->toArray();
  88 + $keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['id'=>['in',$keywordIdArr]]);
  89 + }
  90 + }
  91 + return true;
  92 + }
  93 +
  94 + /**
  95 + * @remark :删除路由通知C端
  96 + * @name :curlDelRoute
  97 + * @author :lyh
  98 + * @method :post
  99 + * @time :2023/11/30 14:43
  100 + */
  101 + public function curlDelRoute($domain,$project_id){
  102 + if (strpos($domain, 'https://') === false) {
  103 + $domain = 'https://' . $domain . '/';
  104 + }
  105 + $url = $domain.'api/update_page/?project_id='.$project_id.'&route=4';
  106 + shell_exec('curl -k "'.$url.'"');
  107 + return true;
  108 + }
  109 +}
@@ -48,6 +48,8 @@ class Kernel extends ConsoleKernel @@ -48,6 +48,8 @@ class Kernel extends ConsoleKernel
48 $schedule->command('sync_manager')->dailyAt('01:00')->withoutOverlapping(1); //TODO::手机号码同步 每天执行一次 48 $schedule->command('sync_manager')->dailyAt('01:00')->withoutOverlapping(1); //TODO::手机号码同步 每天执行一次
49 $schedule->command('update_keyword_route')->dailyAt('01:00')->withoutOverlapping(1); //升级项目--清除路由相同的关键字 49 $schedule->command('update_keyword_route')->dailyAt('01:00')->withoutOverlapping(1); //升级项目--清除路由相同的关键字
50 $schedule->command('recommended_suppliers')->dailyAt('03:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商 50 $schedule->command('recommended_suppliers')->dailyAt('03:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商
  51 +
  52 + $schedule->command('update_keyword_content')->hourly()->withoutOverlapping(1);
51 // 每日推送视频任务 53 // 每日推送视频任务
52 $schedule->command('video_task')->hourly()->withoutOverlapping(1); 54 $schedule->command('video_task')->hourly()->withoutOverlapping(1);
53 // 每日推送已完成视频任务项目生成对应界面 55 // 每日推送已完成视频任务项目生成对应界面
@@ -23,8 +23,7 @@ define('HTTP_OPENAI_URL', 'http://openai.waimaoq.com/'); @@ -23,8 +23,7 @@ define('HTTP_OPENAI_URL', 'http://openai.waimaoq.com/');
23 if (!function_exists('generateRoute')) { 23 if (!function_exists('generateRoute')) {
24 function generateRoute($string) 24 function generateRoute($string)
25 { 25 {
26 - //TODO::html结尾,htm结尾,只处理.htm前面的内容  
27 - return trim(strtolower(preg_replace('/[^\w.]+/', '-', trim($string))), '-'); 26 + return str_replace(".", "", trim(strtolower(preg_replace('/[^\w.]+/', '-', trim($string))), '-'));
28 } 27 }
29 } 28 }
30 29
@@ -28,6 +28,7 @@ class ServersController extends BaseController @@ -28,6 +28,7 @@ class ServersController extends BaseController
28 if(isset($this->map['server_name']) && !empty($this->map['server_name'])){ 28 if(isset($this->map['server_name']) && !empty($this->map['server_name'])){
29 $this->map['server_name'] = ['like','%'.$this->map['server_name'].'%']; 29 $this->map['server_name'] = ['like','%'.$this->map['server_name'].'%'];
30 } 30 }
  31 + $this->map['status'] = 0;
31 $serversModel = new ServersModel(); 32 $serversModel = new ServersModel();
32 $lists = $serversModel->list($this->map); 33 $lists = $serversModel->list($this->map);
33 $this->response('success',Code::SUCCESS,$lists); 34 $this->response('success',Code::SUCCESS,$lists);
@@ -101,15 +101,17 @@ class ServersIpController extends BaseController @@ -101,15 +101,17 @@ class ServersIpController extends BaseController
101 * @time :2024/6/24 16:24 101 * @time :2024/6/24 16:24
102 */ 102 */
103 public function save(ServersIpLogic $serversIpLogic){ 103 public function save(ServersIpLogic $serversIpLogic){
104 - $this->request->validate([  
105 - 'ip'=>'required',  
106 - 'servers_id'=>'required',  
107 - 'domain'=>'required'  
108 - ],[  
109 - 'ip.required' => 'ip不能为空',  
110 - 'servers_id.required' => '服务器servers_id不能为空',  
111 - 'domain.required' => 'cname域名不能为空',  
112 - ]); 104 + if(!isset($this->param['id'])){
  105 + $this->request->validate([
  106 + 'ip'=>'required',
  107 + 'servers_id'=>'required',
  108 + 'domain'=>'required'
  109 + ],[
  110 + 'ip.required' => 'ip不能为空',
  111 + 'servers_id.required' => '服务器servers_id不能为空',
  112 + 'domain.required' => 'cname域名不能为空',
  113 + ]);
  114 + }
113 $data = $serversIpLogic->saveServersIp(); 115 $data = $serversIpLogic->saveServersIp();
114 $this->response('success',Code::SUCCESS,$data); 116 $this->response('success',Code::SUCCESS,$data);
115 } 117 }
@@ -42,7 +42,7 @@ class AutoTaskController extends BaseController @@ -42,7 +42,7 @@ class AutoTaskController extends BaseController
42 $where['status'] = $status - 1; 42 $where['status'] = $status - 1;
43 $result = Notify::select(['id','project_id', 'type', 'data', 'status', 'route', 'num', 'updated_at', 'created_at']) 43 $result = Notify::select(['id','project_id', 'type', 'data', 'status', 'route', 'num', 'updated_at', 'created_at'])
44 ->where('id', '>', 84000) // 查询有效数据 44 ->where('id', '>', 84000) // 查询有效数据
45 - ->where('server_id', '<>', 9) // 过滤测试环境数据 45 + ->where('server_id', '<>', 7) // 过滤测试环境数据
46 ->where('server_id', '>', 0) // 过滤测试环境数据 46 ->where('server_id', '>', 0) // 过滤测试环境数据
47 ->where($where) 47 ->where($where)
48 ->orderBy('id', 'desc') 48 ->orderBy('id', 'desc')
@@ -99,4 +99,4 @@ class AutoTaskController extends BaseController @@ -99,4 +99,4 @@ class AutoTaskController extends BaseController
99 ]; 99 ];
100 return $this->response('success', Code::SUCCESS, $result); 100 return $this->response('success', Code::SUCCESS, $result);
101 } 101 }
102 -}  
  102 +}
@@ -121,4 +121,21 @@ class ATemplateModuleController extends BaseController @@ -121,4 +121,21 @@ class ATemplateModuleController extends BaseController
121 $list = $project->list($this->map,'id',['id','title']); 121 $list = $project->list($this->map,'id',['id','title']);
122 $this->response('success',Code::SUCCESS,$list); 122 $this->response('success',Code::SUCCESS,$list);
123 } 123 }
  124 +
  125 + /**
  126 + * @remark :修改审核状态
  127 + * @name :auditingStatus
  128 + * @author :lyh
  129 + * @method :post
  130 + * @time :2024/5/23 16:42
  131 + */
  132 + public function auditingStatus(ATemplateModuleLogic $ATemplateModuleLogic){
  133 + $this->request->validate([
  134 + 'id'=>'required'
  135 + ],[
  136 + 'id.required' => 'ID不能为空'
  137 + ]);
  138 + $data = $ATemplateModuleLogic->auditingStatus();
  139 + $this->response('success',Code::SUCCESS,$data);
  140 + }
124 } 141 }
@@ -139,9 +139,12 @@ class CategoryController extends BaseController @@ -139,9 +139,12 @@ class CategoryController extends BaseController
139 */ 139 */
140 public function sort(CategoryLogic $logic){ 140 public function sort(CategoryLogic $logic){
141 $this->request->validate([ 141 $this->request->validate([
142 - 'id'=>['required'], 142 + 'id'=>'required',
  143 + 'sort'=>'numeric|min:0',
143 ],[ 144 ],[
144 'id.required' => 'ID不能为空', 145 'id.required' => 'ID不能为空',
  146 + 'sort.numeric' => 'sort位数字',
  147 + 'sort.min' => 'sort最小值为0',
145 ]); 148 ]);
146 $logic->categorySort(); 149 $logic->categorySort();
147 $this->response('success'); 150 $this->response('success');
@@ -9,6 +9,7 @@ use App\Http\Logic\Bside\Product\KeywordLogic; @@ -9,6 +9,7 @@ use App\Http\Logic\Bside\Product\KeywordLogic;
9 use App\Http\Requests\Bside\Product\KeywordRequest; 9 use App\Http\Requests\Bside\Product\KeywordRequest;
10 use App\Models\Com\NoticeLog; 10 use App\Models\Com\NoticeLog;
11 use App\Models\Product\Keyword; 11 use App\Models\Product\Keyword;
  12 +use App\Models\Product\KeywordPage;
12 use App\Models\Product\KeywordRelated; 13 use App\Models\Product\KeywordRelated;
13 use App\Models\Product\Product; 14 use App\Models\Product\Product;
14 use App\Models\RouteMap\RouteMap; 15 use App\Models\RouteMap\RouteMap;
@@ -242,6 +243,21 @@ class KeywordController extends BaseController @@ -242,6 +243,21 @@ class KeywordController extends BaseController
242 * @time :2024/7/2 10:14 243 * @time :2024/7/2 10:14
243 */ 244 */
244 public function batchUpdateKeyword(){ 245 public function batchUpdateKeyword(){
245 - $noticeLogModel = new NoticeLog(); 246 + $this->request->validate([
  247 + 'text'=>'required|array',
  248 + 'update_object'=>'required|array',
  249 + 'update_method'=>'required'
  250 + ],[
  251 + 'text.required' => '文件内容不能为空',
  252 + 'update_object.required' => '更新对象不为空',
  253 + 'update_object.array' => '更新对象为数组',
  254 + 'update_method.required' => '请求方式不为空'
  255 + ]);
  256 + $keywordPageModel = new KeywordPage();
  257 + $this->param['text'] = json_encode($this->param['text']);
  258 + $this->param['update_object'] = json_encode($this->param['update_object']);
  259 + $this->param['project_id'] = $this->user['project_id'];
  260 + $id = $keywordPageModel->addReturnId($this->param);
  261 + $this->response('success',Code::SUCCESS,['id'=>$id]);
246 } 262 }
247 } 263 }
@@ -49,9 +49,11 @@ class ServersIpLogic extends BaseLogic @@ -49,9 +49,11 @@ class ServersIpLogic extends BaseLogic
49 */ 49 */
50 public function saveServersIp(){ 50 public function saveServersIp(){
51 //验证域名是否唯一 51 //验证域名是否唯一
52 - $info = $this->model->read(['domain'=>$this->param['domain']]);  
53 - if($info !== false){  
54 - $this->fail('当前初始域名已存在'); 52 + if(!isset($this->param['id'])){
  53 + $info = $this->model->read(['domain'=>$this->param['domain']]);
  54 + if($info !== false){
  55 + $this->fail('当前初始域名已存在');
  56 + }
55 } 57 }
56 if(isset($this->param['id']) && !empty($this->param['id'])){ 58 if(isset($this->param['id']) && !empty($this->param['id'])){
57 $id = $this->param['id']; 59 $id = $this->param['id'];
@@ -268,10 +268,10 @@ class DomainInfoLogic extends BaseLogic @@ -268,10 +268,10 @@ class DomainInfoLogic extends BaseLogic
268 $serverModel = new Servers(); 268 $serverModel = new Servers();
269 $serverInfo = $serverModel->read(['id'=>$serversIpInfo['servers_id']],['init_domain']); 269 $serverInfo = $serverModel->read(['id'=>$serversIpInfo['servers_id']],['init_domain']);
270 $server_info = ['domain'=>$serverInfo['init_domain'],'ip'=>$serversIpInfo['ip']]; 270 $server_info = ['domain'=>$serverInfo['init_domain'],'ip'=>$serversIpInfo['ip']];
271 - if($project_info['serve_id'] == 9){ 271 + if($serversIpInfo['servers_id'] == 7){
272 $this->fail('请切换服务器,生成站点不能使用测试服务器'); 272 $this->fail('请切换服务器,生成站点不能使用测试服务器');
273 } 273 }
274 - if($project_info['serve_id'] == ServerConfig::SELF_SITE_ID){ 274 + if($serversIpInfo['servers_id'] == ServerConfig::SELF_SITE_ID){
275 $this->model->edit(['amp_status' => $this->param['amp_status'] ?? 0,],['id'=>$this->param['id']]); 275 $this->model->edit(['amp_status' => $this->param['amp_status'] ?? 0,],['id'=>$this->param['id']]);
276 $this->fail('自建站服务器无法生成站点'); 276 $this->fail('自建站服务器无法生成站点');
277 } 277 }
@@ -391,6 +391,12 @@ class DomainInfoLogic extends BaseLogic @@ -391,6 +391,12 @@ class DomainInfoLogic extends BaseLogic
391 $serverModel = new Servers(); 391 $serverModel = new Servers();
392 $serverInfo = $serverModel->read(['id'=>$serversIpInfo['servers_id']],['init_domain']); 392 $serverInfo = $serverModel->read(['id'=>$serversIpInfo['servers_id']],['init_domain']);
393 $server_info = ['domain'=>$serverInfo['init_domain'],'ip'=>$serversIpInfo['ip']]; 393 $server_info = ['domain'=>$serverInfo['init_domain'],'ip'=>$serversIpInfo['ip']];
  394 + if($serversIpInfo['servers_id'] == 7){
  395 + $this->fail('请切换服务器,生成站点不能使用测试服务器');
  396 + }
  397 + if($serversIpInfo['servers_id'] == ServerConfig::SELF_SITE_ID){
  398 + $this->fail('自建站服务器无法生成站点');
  399 + }
394 //域名是否都已经解析 400 //域名是否都已经解析
395 if(strpos($this->param['custom_domain'],'//') === false){ 401 if(strpos($this->param['custom_domain'],'//') === false){
396 $this->param['custom_domain'] = '//'.$this->param['custom_domain']; 402 $this->param['custom_domain'] = '//'.$this->param['custom_domain'];
@@ -148,7 +148,7 @@ class ProjectLogic extends BaseLogic @@ -148,7 +148,7 @@ class ProjectLogic extends BaseLogic
148 //初始化项目 148 //初始化项目
149 $this->createProjectData($this->param); 149 $this->createProjectData($this->param);
150 //双向绑定服务器,需放到保存项目的上方 150 //双向绑定服务器,需放到保存项目的上方
151 - $this->setServers($this->param['serve_id'],$this->param['id']); 151 + $this->setServers($this->param['serve_id'] ?? 0,$this->param['id']);
152 //保存项目信息 152 //保存项目信息
153 $this->saveProject($this->param); 153 $this->saveProject($this->param);
154 //保存建站部署信息 154 //保存建站部署信息
@@ -192,6 +192,9 @@ class ProjectLogic extends BaseLogic @@ -192,6 +192,9 @@ class ProjectLogic extends BaseLogic
192 $serversModel->where(['id'=>$oldServerIpInfo['servers_id']])->decrement('being_number',1); 192 $serversModel->where(['id'=>$oldServerIpInfo['servers_id']])->decrement('being_number',1);
193 } 193 }
194 } 194 }
  195 + if(empty($servers_id)){
  196 + return $this->success();
  197 + }
195 $serversIpInfo = $serversIpModel->read(['id'=>$servers_id]); 198 $serversIpInfo = $serversIpModel->read(['id'=>$servers_id]);
196 $serversInfo = $serversModel->read(['id'=>$serversIpInfo['servers_id']]); 199 $serversInfo = $serversModel->read(['id'=>$serversIpInfo['servers_id']]);
197 if($serversIpInfo['total'] >= $serversInfo['ip_total']){ 200 if($serversIpInfo['total'] >= $serversInfo['ip_total']){
@@ -124,11 +124,11 @@ class ATemplateLogic extends BaseLogic @@ -124,11 +124,11 @@ class ATemplateLogic extends BaseLogic
124 if(!empty($info['image'])){ 124 if(!empty($info['image'])){
125 $info['image_link'] = getImageUrl($info['image']); 125 $info['image_link'] = getImageUrl($info['image']);
126 } 126 }
127 - if(!empty($info['design_manager'])){  
128 - $info['design_manager'] = (new Manage())->getName($info['design_manager']); 127 + if(!empty($info['design_msg'])){
  128 + $info['design_msg'] = json_decode($info['design_msg']);
129 } 129 }
130 - if(!empty($info['front_manager'])){  
131 - $info['front_manager'] = (new Manage())->getName($info['front_manager']); 130 + if(!empty($info['front_msg'])){
  131 + $info['front_msg'] = json_decode($info['front_msg']);
132 } 132 }
133 return $this->success($info); 133 return $this->success($info);
134 } 134 }
@@ -261,15 +261,11 @@ class ATemplateLogic extends BaseLogic @@ -261,15 +261,11 @@ class ATemplateLogic extends BaseLogic
261 */ 261 */
262 public function auditingStatus(){ 262 public function auditingStatus(){
263 //获取当前数据详情 263 //获取当前数据详情
264 - $info = $this->model->read(['id'=>$this->param['id']]);  
265 - if(isset($this->param['front_status']) && $this->param['front_status'] == 1){  
266 - if($info['design_status'] == 0){  
267 - $this->fail('请先提交设计审核');  
268 - }  
269 - $this->param['design_manager'] = $this->manager['id'];  
270 - $this->param['test_model'] = 0;  
271 - }else{  
272 - $this->param['front_manager'] = $this->manager['id']; 264 + if(isset($this->param['design_msg']) && !empty($this->param['design_msg'])){
  265 + $this->param['design_msg'] = json_encode($this->param['design_msg']);
  266 + }
  267 + if(isset($this->param['front_msg']) && !empty($this->param['front_msg'])){
  268 + $this->param['front_msg'] = json_encode($this->param['front_msg']);
273 } 269 }
274 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); 270 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
275 if($rs === false){ 271 if($rs === false){
@@ -100,4 +100,19 @@ class ATemplateModuleLogic extends BaseLogic @@ -100,4 +100,19 @@ class ATemplateModuleLogic extends BaseLogic
100 return $this->success(); 100 return $this->success();
101 } 101 }
102 102
  103 + /**
  104 + * @remark :修改状态
  105 + * @name :auditingStatus
  106 + * @author :lyh
  107 + * @method :post
  108 + * @time :2024/5/23 16:44
  109 + */
  110 + public function auditingStatus(){
  111 + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
  112 + if($rs === false){
  113 + $this->fail('修改失败,请联系管理员');
  114 + }
  115 + return $this->success(['id'=>$this->param['id']]);
  116 + }
  117 +
103 } 118 }
@@ -68,7 +68,7 @@ class UserLogic extends BaseLogic @@ -68,7 +68,7 @@ class UserLogic extends BaseLogic
68 $this->param = $this->editPassword($this->param); 68 $this->param = $this->editPassword($this->param);
69 $rs = $this->model->edit($this->param, ['id' => $this->param['id']]); 69 $rs = $this->model->edit($this->param, ['id' => $this->param['id']]);
70 } else { 70 } else {
71 - $this->param['password'] = base64_encode(md5($this->param['password'])); 71 + $this->param['password'] = base64_encode(md5($this->param['password'] ?? '123456'));
72 $rs = $this->model->add($this->param); 72 $rs = $this->model->add($this->param);
73 } 73 }
74 if ($rs === false) { 74 if ($rs === false) {
@@ -8,6 +8,7 @@ use App\Exceptions\BsideGlobalException; @@ -8,6 +8,7 @@ use App\Exceptions\BsideGlobalException;
8 use App\Http\Logic\Logic; 8 use App\Http\Logic\Logic;
9 use App\Models\Com\UpdateNotify; 9 use App\Models\Com\UpdateNotify;
10 use App\Models\Devops\ServerConfig; 10 use App\Models\Devops\ServerConfig;
  11 +use App\Models\Devops\ServersIp;
11 use App\Models\Project\Project; 12 use App\Models\Project\Project;
12 use App\Models\RouteMap\RouteDelete; 13 use App\Models\RouteMap\RouteDelete;
13 use App\Models\Service\Service; 14 use App\Models\Service\Service;
@@ -175,11 +176,13 @@ class BaseLogic extends Logic @@ -175,11 +176,13 @@ class BaseLogic extends Logic
175 $data['project_id'] = $this->user['project_id']; 176 $data['project_id'] = $this->user['project_id'];
176 $str = http_build_query($data); 177 $str = http_build_query($data);
177 $url = $this->user['domain'].'api/delHtml/?'.$str; 178 $url = $this->user['domain'].'api/delHtml/?'.$str;
178 - if(isset($this->project['serve_id']) && ($this->project['serve_id'] == ServerConfig::SELF_SITE_ID)){ 179 + $serverIpModel = new ServersIp();
  180 + $serversIpInfo = $serverIpModel->read(['id'=>$this->project['serve_id']],['servers_id']);
  181 + if($serversIpInfo && ($serversIpInfo['servers_id'] == ServerConfig::SELF_SITE_ID)){
179 //自建站服务器直接返回 182 //自建站服务器直接返回
180 return $this->success(); 183 return $this->success();
181 } 184 }
182 - if(isset($this->project['serve_id']) && ($this->project['serve_id'] != 1)){//TODO::当前项目通知不过 ,跳过自动更新 185 + if($serversIpInfo && ($serversIpInfo['servers_id'] != 1)){//TODO::当前项目通知不过 ,跳过自动更新
183 exec('curl -k "'.$url.'" > /dev/null 2>&1 &'); 186 exec('curl -k "'.$url.'" > /dev/null 2>&1 &');
184 }else{ 187 }else{
185 shell_exec('curl -k "'.$url.'"'); 188 shell_exec('curl -k "'.$url.'"');
@@ -203,7 +203,7 @@ class BlogLogic extends BaseLogic @@ -203,7 +203,7 @@ class BlogLogic extends BaseLogic
203 public function getCategory($category){ 203 public function getCategory($category){
204 $str = ''; 204 $str = '';
205 foreach ($category as $v){ 205 foreach ($category as $v){
206 - $str .= $v.','; 206 + $str .= $v.',';
207 } 207 }
208 return !empty(trim($str,',')) ? ','.$str.',' : ''; 208 return !empty(trim($str,',')) ? ','.$str.',' : '';
209 } 209 }
@@ -59,32 +59,23 @@ class NewsLogic extends BaseLogic @@ -59,32 +59,23 @@ class NewsLogic extends BaseLogic
59 */ 59 */
60 public function newsSave() 60 public function newsSave()
61 { 61 {
62 - //拼接参数  
63 -// DB::beginTransaction();  
64 -// try {  
65 - $this->param = $this->paramProcessing($this->param);  
66 - if (isset($this->param['id']) && !empty($this->param['id'])) {  
67 - $id = $this->param['id'];  
68 - $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0  
69 - $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示  
70 - if($is_upgrade == 0 || $six_read == 1) {  
71 - $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);  
72 - }  
73 - //是否更新路由  
74 - $route = $this->param['url'];  
75 - $this->edit($this->param, ['id' => $id]);  
76 - } else {  
77 - $this->param['sort'] = $this->setNewsSort();  
78 - $id = $this->model->addReturnId($this->param);  
79 - $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);  
80 - $this->edit(['url' => $route], ['id' => $id]); 62 + $this->param = $this->paramProcessing($this->param);
  63 + if (isset($this->param['id']) && !empty($this->param['id'])) {
  64 + $id = $this->param['id'];
  65 + $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0
  66 + $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示
  67 + if($is_upgrade == 0 || $six_read == 1) {
  68 + $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
81 } 69 }
82 -// //更新路由  
83 -// DB::commit();  
84 -// } catch (\Exception $e) {  
85 -// DB::rollBack();  
86 -// $this->fail('系统错误,请联系管理员');  
87 -// } 70 + //是否更新路由
  71 + $route = $this->param['url'];
  72 + $this->edit($this->param, ['id' => $id]);
  73 + } else {
  74 + $this->param['sort'] = $this->setNewsSort();
  75 + $id = $this->model->addReturnId($this->param);
  76 + $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
  77 + $this->edit(['url' => $route], ['id' => $id]);
  78 + }
88 $this->addUpdateNotify(RouteMap::SOURCE_NEWS,$route); 79 $this->addUpdateNotify(RouteMap::SOURCE_NEWS,$route);
89 $this->curlDelRoute(['new_route'=>$route]); 80 $this->curlDelRoute(['new_route'=>$route]);
90 return $this->success(['id'=>$id]); 81 return $this->success(['id'=>$id]);
@@ -223,10 +214,10 @@ class NewsLogic extends BaseLogic @@ -223,10 +214,10 @@ class NewsLogic extends BaseLogic
223 */ 214 */
224 public function getCategory($category){ 215 public function getCategory($category){
225 $str = ''; 216 $str = '';
226 - if(is_array($category) && $category){  
227 - $str = ','.implode(',',$category).','; 217 + foreach ($category as $v){
  218 + $str .= $v.',';
228 } 219 }
229 - return $str; 220 + return !empty(trim($str,',')) ? ','.$str.',' : '';
230 } 221 }
231 222
232 /** 223 /**
@@ -20,6 +20,7 @@ use Illuminate\Foundation\Bus\Dispatchable; @@ -20,6 +20,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
20 use Illuminate\Queue\InteractsWithQueue; 20 use Illuminate\Queue\InteractsWithQueue;
21 use Illuminate\Queue\SerializesModels; 21 use Illuminate\Queue\SerializesModels;
22 use Illuminate\Support\Facades\DB; 22 use Illuminate\Support\Facades\DB;
  23 +use Illuminate\Support\Facades\Log;
23 use Illuminate\Support\Facades\Schema; 24 use Illuminate\Support\Facades\Schema;
24 25
25 class CopyProjectJob implements ShouldQueue 26 class CopyProjectJob implements ShouldQueue
@@ -52,6 +53,7 @@ class CopyProjectJob implements ShouldQueue @@ -52,6 +53,7 @@ class CopyProjectJob implements ShouldQueue
52 $projectModel = new Project(); 53 $projectModel = new Project();
53 DB::beginTransaction(); 54 DB::beginTransaction();
54 try { 55 try {
  56 + $this->output('CopyProjectJob start, project_id: ' . $this->param['project_id']);
55 //复制初始项目 57 //复制初始项目
56 $data = $projectModel::where('id', $this->param['project_id'])->first(); 58 $data = $projectModel::where('id', $this->param['project_id'])->first();
57 $data = $data->getAttributes(); 59 $data = $data->getAttributes();
@@ -61,6 +63,7 @@ class CopyProjectJob implements ShouldQueue @@ -61,6 +63,7 @@ class CopyProjectJob implements ShouldQueue
61 $data['finish_remain_day'] = 0; 63 $data['finish_remain_day'] = 0;
62 $data['title'] = $data['title'].'-copy'; 64 $data['title'] = $data['title'].'-copy';
63 $data['delete_status'] = 1; 65 $data['delete_status'] = 1;
  66 + $data['uptime'] = null;
64 unset($data['id']); 67 unset($data['id']);
65 $project_id = $projectModel->insertGetId($data); 68 $project_id = $projectModel->insertGetId($data);
66 $hashids = new Hashids($data['from_order_id'], 13, 'abcdefghjkmnpqrstuvwxyz1234567890'); 69 $hashids = new Hashids($data['from_order_id'], 13, 'abcdefghjkmnpqrstuvwxyz1234567890');
@@ -95,7 +98,6 @@ class CopyProjectJob implements ShouldQueue @@ -95,7 +98,6 @@ class CopyProjectJob implements ShouldQueue
95 unset($optimizeData['id'],$optimizeData['domain']); 98 unset($optimizeData['id'],$optimizeData['domain']);
96 $optimizeData['project_id'] = $project_id; 99 $optimizeData['project_id'] = $project_id;
97 $optimizeData['api_no'] = 0; 100 $optimizeData['api_no'] = 0;
98 - $optimizeData['minor_languages'] = json_encode([]);  
99 $optimizeModel->insert($optimizeData); 101 $optimizeModel->insert($optimizeData);
100 } 102 }
101 //复制付费表 103 //复制付费表
@@ -128,6 +130,7 @@ class CopyProjectJob implements ShouldQueue @@ -128,6 +130,7 @@ class CopyProjectJob implements ShouldQueue
128 DB::commit(); 130 DB::commit();
129 }catch (\Exception $e){ 131 }catch (\Exception $e){
130 DB::rollBack(); 132 DB::rollBack();
  133 + $this->output('CopyProjectJob error, error message: ' . $e->getMessage());
131 $this->fail('error'); 134 $this->fail('error');
132 } 135 }
133 if($type != 0){ 136 if($type != 0){
@@ -135,6 +138,7 @@ class CopyProjectJob implements ShouldQueue @@ -135,6 +138,7 @@ class CopyProjectJob implements ShouldQueue
135 } 138 }
136 //修改项目状态 139 //修改项目状态
137 $projectModel->edit(['delete_status'=>0],['id'=>$project_id]); 140 $projectModel->edit(['delete_status'=>0],['id'=>$project_id]);
  141 + $this->output('CopyProjectJob end, old project_id: ' . $this->param['project_id'] . ', new project_id: ' . $project_id);
138 return true; 142 return true;
139 } 143 }
140 144
@@ -170,7 +174,7 @@ class CopyProjectJob implements ShouldQueue @@ -170,7 +174,7 @@ class CopyProjectJob implements ShouldQueue
170 if($table == 'gl_customer_visit' || $table == 'gl_customer_visit_item' || $table == 'gl_inquiry_other' || $table == 'gl_inquiry_form_data' || $table == 'gl_inquiry_form'){ 174 if($table == 'gl_customer_visit' || $table == 'gl_customer_visit_item' || $table == 'gl_inquiry_other' || $table == 'gl_inquiry_form_data' || $table == 'gl_inquiry_form'){
171 continue; 175 continue;
172 } 176 }
173 -// DB::connection('custom_mysql')->table($table)->truncate(); // 清空目标表数据 177 + DB::connection('custom_mysql')->table($table)->truncate(); // 清空目标表数据
174 DB::connection('custom_mysql')->table($table)->insertUsing( 178 DB::connection('custom_mysql')->table($table)->insertUsing(
175 [], // 列名数组,留空表示插入所有列 179 [], // 列名数组,留空表示插入所有列
176 function ($query) use ($table,$project_id) { 180 function ($query) use ($table,$project_id) {
@@ -184,4 +188,17 @@ class CopyProjectJob implements ShouldQueue @@ -184,4 +188,17 @@ class CopyProjectJob implements ShouldQueue
184 } 188 }
185 return true; 189 return true;
186 } 190 }
  191 +
  192 + /**
  193 + * @param $message
  194 + * @return bool
  195 + */
  196 + public function output($message)
  197 + {
  198 + $date = date('Y-m-d H:i:s');
  199 + $output = $date . ', ' . $message . PHP_EOL;
  200 + echo $output;
  201 + Log::info($output);
  202 + return true;
  203 + }
187 } 204 }
@@ -15,7 +15,6 @@ use App\Utils\EncryptUtils; @@ -15,7 +15,6 @@ use App\Utils\EncryptUtils;
15 class Servers extends Base 15 class Servers extends Base
16 { 16 {
17 protected $table = 'gl_servers'; 17 protected $table = 'gl_servers';
18 - const SELF_SITE_ID = 8;//自建站服务器ID  
19 18
20 /** 19 /**
21 * @remark :获取数据用户名解密 20 * @remark :获取数据用户名解密
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :KeywordPage.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/7/2 15:26
  8 + */
  9 +
  10 +namespace App\Models\Product;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class KeywordPage extends Base
  15 +{
  16 + protected $table = 'gl_product_keyword_page';
  17 +}
@@ -55,10 +55,9 @@ class RouteMap extends Base @@ -55,10 +55,9 @@ class RouteMap extends Base
55 public static function generateRoute($title, $source, $source_id, $project_id){ 55 public static function generateRoute($title, $source, $source_id, $project_id){
56 if(preg_match('/[\x{4e00}-\x{9fa5}]/u', $title)){ 56 if(preg_match('/[\x{4e00}-\x{9fa5}]/u', $title)){
57 $title = Translate::tran($title, 'en'); 57 $title = Translate::tran($title, 'en');
58 - }else{  
59 - if(contains_russian($title)){  
60 - $title = Translate::tran($title, 'en');  
61 - } 58 + }
  59 + if(contains_russian($title)){
  60 + $title = Translate::tran($title, 'en');
62 } 61 }
63 $i=1; 62 $i=1;
64 $sign = generateRoute($title); 63 $sign = generateRoute($title);
@@ -79,6 +79,12 @@ return [ @@ -79,6 +79,12 @@ return [
79 'prefix' => 'test', 79 'prefix' => 'test',
80 ], 80 ],
81 //日记录日志 81 //日记录日志
  82 + 'copy_project' => [
  83 + 'driver' => 'custom',
  84 + 'via' => \App\Factory\LogFormatterFactory::class,
  85 + 'prefix' => 'copy_project',
  86 + ],
  87 + //日记录日志
82 'day_count' => [ 88 'day_count' => [
83 'driver' => 'custom', 89 'driver' => 'custom',
84 'via' => \App\Factory\LogFormatterFactory::class, 90 'via' => \App\Factory\LogFormatterFactory::class,
@@ -373,6 +373,7 @@ Route::middleware(['aloginauth'])->group(function () { @@ -373,6 +373,7 @@ Route::middleware(['aloginauth'])->group(function () {
373 Route::any('/status', [Aside\Template\ATemplateModuleController::class, 'status'])->name('admin.ATemplateModule_status'); 373 Route::any('/status', [Aside\Template\ATemplateModuleController::class, 'status'])->name('admin.ATemplateModule_status');
374 Route::any('/del', [Aside\Template\ATemplateModuleController::class, 'del'])->name('admin.ATemplateModule_del'); 374 Route::any('/del', [Aside\Template\ATemplateModuleController::class, 'del'])->name('admin.ATemplateModule_del');
375 Route::any('/type', [Aside\Template\ATemplateModuleController::class, 'getType'])->name('admin.ATemplateModule_getType'); 375 Route::any('/type', [Aside\Template\ATemplateModuleController::class, 'getType'])->name('admin.ATemplateModule_getType');
  376 + Route::any('/auditingStatus', [Aside\Template\ATemplateModuleController::class, 'auditingStatus'])->name('admin.ATemplateModule_auditingStatus');
376 Route::any('/getProjectList', [Aside\Template\ATemplateModuleController::class, 'getProjectList'])->name('admin.ATemplateModule_getProjectList'); 377 Route::any('/getProjectList', [Aside\Template\ATemplateModuleController::class, 'getProjectList'])->name('admin.ATemplateModule_getProjectList');
377 }); 378 });
378 //设置类型 379 //设置类型
@@ -271,6 +271,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -271,6 +271,7 @@ Route::middleware(['bloginauth'])->group(function () {
271 Route::post('keyword/batchAdd', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchAdd'])->name('product_keyword_batchAdd'); 271 Route::post('keyword/batchAdd', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchAdd'])->name('product_keyword_batchAdd');
272 Route::post('keyword/batchDel', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchDel'])->name('product_keyword_batchDel'); 272 Route::post('keyword/batchDel', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchDel'])->name('product_keyword_batchDel');
273 Route::any('keyword/delete', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'delete'])->name('product_keyword_delete'); 273 Route::any('keyword/delete', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'delete'])->name('product_keyword_delete');
  274 + Route::any('keyword/batchUpdateKeyword', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchUpdateKeyword'])->name('product_keyword_batchUpdateKeyword');
274 Route::any('keyword/batchKeywordIsVideo', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchKeywordIsVideo'])->name('product_keyword_batchKeywordIsVideo'); 275 Route::any('keyword/batchKeywordIsVideo', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchKeywordIsVideo'])->name('product_keyword_batchKeywordIsVideo');
275 Route::any('keyword/batchKeywordFiled', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchKeywordFiled'])->name('product_keyword_batchKeywordFiled'); 276 Route::any('keyword/batchKeywordFiled', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchKeywordFiled'])->name('product_keyword_batchKeywordFiled');
276 //产品参数 277 //产品参数