作者 张关杰

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

@@ -126,11 +126,11 @@ class DomainInfo extends Command @@ -126,11 +126,11 @@ class DomainInfo extends Command
126 $data = []; 126 $data = [];
127 $ssl = $this->updateDomainSsl($amp_domain); 127 $ssl = $this->updateDomainSsl($amp_domain);
128 $ssl['from'] && $data['amp_certificate_start_time'] = $ssl['from']; 128 $ssl['from'] && $data['amp_certificate_start_time'] = $ssl['from'];
129 - $ssl['to'] && $data['amp_certificate_start_time'] = $ssl['to']; 129 + $ssl['to'] && $data['amp_certificate_end_time'] = $ssl['to'];
130 130
131 $domainModel->edit($data, ['id' => $v['id']]); 131 $domainModel->edit($data, ['id' => $v['id']]);
132 132
133 - if ($v['amp_type'] == 1 && ($data['amp_certificate_start_time'] ?? '') < $end_day) { 133 + if ($v['amp_type'] == 1 && ($data['amp_certificate_end_time'] ?? '') < $end_day) {
134 //申请免费证书 134 //申请免费证书
135 $this->updateAmpPrivate($v['domain']); 135 $this->updateAmpPrivate($v['domain']);
136 } 136 }
@@ -58,6 +58,7 @@ class VideoTask extends Command @@ -58,6 +58,7 @@ class VideoTask extends Command
58 */ 58 */
59 public function handle() 59 public function handle()
60 { 60 {
  61 + echo '开始:'.PHP_EOL;
61 Log::info('开始视频推广任务'); 62 Log::info('开始视频推广任务');
62 $this->createSubTask(); 63 $this->createSubTask();
63 $this->sendSubTask(); 64 $this->sendSubTask();
@@ -91,7 +92,7 @@ class VideoTask extends Command @@ -91,7 +92,7 @@ class VideoTask extends Command
91 ProjectServer::useProject($task_project->project_id); 92 ProjectServer::useProject($task_project->project_id);
92 $keyword = $this->getProjectKeyword(); 93 $keyword = $this->getProjectKeyword();
93 // 已经没有需要生成视频的关键词 94 // 已经没有需要生成视频的关键词
94 - if (FALSE == $keyword->isEmpty()) { 95 + if (!$keyword) {
95 $task_project->status = KeywordVideoTask::STATUS_CLOSE; 96 $task_project->status = KeywordVideoTask::STATUS_CLOSE;
96 $task_project->save(); 97 $task_project->save();
97 continue; 98 continue;
@@ -130,7 +131,7 @@ class VideoTask extends Command @@ -130,7 +131,7 @@ class VideoTask extends Command
130 if ($subTask->isEmpty()) 131 if ($subTask->isEmpty())
131 return true; 132 return true;
132 foreach ($subTask as $val) { 133 foreach ($subTask as $val) {
133 - $valData = json_decode($val->data); 134 + $valData = (array)json_decode($val->data);
134 $task_id = 'v6-' . uniqid(); 135 $task_id = 'v6-' . uniqid();
135 $data = [ 136 $data = [
136 'project_data' => [ 137 'project_data' => [
@@ -146,7 +147,7 @@ class VideoTask extends Command @@ -146,7 +147,7 @@ class VideoTask extends Command
146 $result = Http::post('http://216.250.255.116:7866/create_task', $data); 147 $result = Http::post('http://216.250.255.116:7866/create_task', $data);
147 $val->task_id = $task_id; 148 $val->task_id = $task_id;
148 $val->status = KeywordVideoTaskLog::STATUS_RUNNING; 149 $val->status = KeywordVideoTaskLog::STATUS_RUNNING;
149 - $val->request_result = $result; 150 + $val->result_info = $result;
150 $val->save(); 151 $val->save();
151 } 152 }
152 return true; 153 return true;
@@ -158,7 +159,9 @@ class VideoTask extends Command @@ -158,7 +159,9 @@ class VideoTask extends Command
158 */ 159 */
159 public function getProjectKeyword() 160 public function getProjectKeyword()
160 { 161 {
161 - $keyword = Keyword::where('video', null)->whereNotNull('keyword_content')->inRandomOrder()->take(100)->get(); 162 + $keyword_arr_id = Keyword::where('video', null)->whereNotNull('keyword_content')->pluck('id')->toArray();
  163 + $keyword_id = array_rand($keyword_arr_id, 500);
  164 + $keyword = Keyword::whereIn("id", $keyword_id)->get();
162 return $keyword; 165 return $keyword;
163 } 166 }
164 167
@@ -119,7 +119,7 @@ class KeywordVideoController extends BaseController @@ -119,7 +119,7 @@ class KeywordVideoController extends BaseController
119 'id.required' => '主键标识不为空', 119 'id.required' => '主键标识不为空',
120 ]); 120 ]);
121 $keywordModel = new KeywordVideoTask(); 121 $keywordModel = new KeywordVideoTask();
122 - $rs = $keywordModel->edit(['sort'=>$this->param['sort']],['id'=>$this->param['id']]); 122 + $rs = $keywordModel->edit($this->param,['id'=>$this->param['id']]);
123 if($rs === false){ 123 if($rs === false){
124 $this->response('编辑失败',Code::SYSTEM_ERROR); 124 $this->response('编辑失败',Code::SYSTEM_ERROR);
125 } 125 }
@@ -389,19 +389,21 @@ class RankDataLogic extends BaseLogic @@ -389,19 +389,21 @@ class RankDataLogic extends BaseLogic
389 //有小语种的 389 //有小语种的
390 $lang_list = $api->getLangList(); 390 $lang_list = $api->getLangList();
391 if (!empty($lang_list[$api_no])) { 391 if (!empty($lang_list[$api_no])) {
392 - $model = RankData::where('project_id', $project_id)->where('lang', '<>', '')->first();  
393 - if (!$model || $model->updated_date != date('Y-m-d') || $force) {  
394 - $res = $api->getGoogleRank($api_no, $lang_list[$api_no], 7, $force);  
395 - if (!$res) {  
396 - throw new \Exception("接口数据获取失败,api_no:{$api_no},lang");  
397 - }  
398 - $data = [];  
399 - //不同的小语种取出来  
400 - foreach ($res as $keyword => $v) {  
401 - $data[Arr::last($v)['lang']][$keyword] = $v;  
402 - }  
403 - foreach ($data as $lang => $rank) {  
404 - $this->save_rank($project_id, $rank, 0, $lang); 392 + foreach ($lang_list[$api_no] as $lang){
  393 + $model = RankData::where('project_id', $project_id)->where('lang', $lang)->first();
  394 + if (!$model || $model->updated_date != date('Y-m-d') || $force) {
  395 + $res = $api->getGoogleRank($api_no, $lang, 7, $force);
  396 + if (!$res) {
  397 + throw new \Exception("接口数据获取失败,api_no:{$api_no},lang");
  398 + }
  399 + $data = [];
  400 + //不同的小语种取出来
  401 + foreach ($res as $keyword => $v) {
  402 + $data[Arr::last($v)['lang']][$keyword] = $v;
  403 + }
  404 + foreach ($data as $lang => $rank) {
  405 + $this->save_rank($project_id, $rank, 0, $lang);
  406 + }
405 } 407 }
406 } 408 }
407 } 409 }