作者 刘锟

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

@@ -20,7 +20,8 @@ use App\Models\HomeCount\Count; @@ -20,7 +20,8 @@ use App\Models\HomeCount\Count;
20 20
21 class CountAll 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 *
@@ -77,9 +77,7 @@ class MonthAllCount extends Command @@ -77,9 +77,7 @@ class MonthAllCount 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 MonthAllCount extends Command @@ -88,7 +86,7 @@ class MonthAllCount 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['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'];
@@ -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'];
@@ -65,10 +65,8 @@ class MonthProjectCount extends Command @@ -65,10 +65,8 @@ class MonthProjectCount 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 MonthProjectCount extends Command @@ -77,7 +75,7 @@ class MonthProjectCount 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;
@@ -23,7 +23,7 @@ class UpdateKeyword extends Command @@ -23,7 +23,7 @@ class UpdateKeyword extends Command
23 * 23 *
24 * @var string 24 * @var string
25 */ 25 */
26 - protected $signature = 'update_keyword'; 26 + protected $signature = 'update_keyword_content';
27 27
28 /** 28 /**
29 * The console command description. 29 * The console command description.
@@ -51,6 +51,7 @@ class UpdateKeyword extends Command @@ -51,6 +51,7 @@ class UpdateKeyword extends Command
51 if($domainInfo !== false){ 51 if($domainInfo !== false){
52 $this->curlDelRoute($domainInfo['domain'],$v['project_id']); 52 $this->curlDelRoute($domainInfo['domain'],$v['project_id']);
53 } 53 }
  54 + $keywordPageModel->edit(['status'=>1],['id'=>$v['id']]);
54 } 55 }
55 sleep(10); 56 sleep(10);
56 } 57 }
@@ -71,7 +72,7 @@ class UpdateKeyword extends Command @@ -71,7 +72,7 @@ class UpdateKeyword extends Command
71 if(empty($text)){ 72 if(empty($text)){
72 return false; 73 return false;
73 } 74 }
74 - $number = count($info['text']); 75 + $number = count($text);
75 $randomNumber = rand(0, $number - 1); 76 $randomNumber = rand(0, $number - 1);
76 if($updateObject['type'] == 0){//更新所有关键字 77 if($updateObject['type'] == 0){//更新所有关键字
77 $keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['status'=>1]); 78 $keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['status'=>1]);
@@ -48,8 +48,8 @@ class Kernel extends ConsoleKernel @@ -48,8 +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')->hourly()->withoutOverlapping(1); 51 +
  52 + $schedule->command('update_keyword_content')->hourly()->withoutOverlapping(1);
53 // 每日推送视频任务 53 // 每日推送视频任务
54 $schedule->command('video_task')->hourly()->withoutOverlapping(1); 54 $schedule->command('video_task')->hourly()->withoutOverlapping(1);
55 // 每日推送已完成视频任务项目生成对应界面 55 // 每日推送已完成视频任务项目生成对应界面
@@ -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');
@@ -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){
@@ -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 }
@@ -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,