作者 lyh

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

@@ -150,6 +150,7 @@ class UpdateSeoTdk extends Command @@ -150,6 +150,7 @@ class UpdateSeoTdk extends Command
150 echo date('Y-m-d H:i:s') . 'line: '. $e->getLine() .' error: ' . $project_id . '->' . $e->getMessage() . PHP_EOL; 150 echo date('Y-m-d H:i:s') . 'line: '. $e->getLine() .' error: ' . $project_id . '->' . $e->getMessage() . PHP_EOL;
151 ProjectUpdateTdk::retry($task->id, $e->getMessage()); 151 ProjectUpdateTdk::retry($task->id, $e->getMessage());
152 } 152 }
  153 + Cache::forget('project_deploy_optimize_info_' . $project_id);
153 echo date('Y-m-d H:i:s') . ' end project_id: ' . $project_id . PHP_EOL; 154 echo date('Y-m-d H:i:s') . ' end project_id: ' . $project_id . PHP_EOL;
154 } 155 }
155 } 156 }
@@ -310,6 +311,18 @@ class UpdateSeoTdk extends Command @@ -310,6 +311,18 @@ class UpdateSeoTdk extends Command
310 return $prompt; 311 return $prompt;
311 } 312 }
312 313
  314 +
  315 + public function getDeployOptimize($project_id){
  316 + $cache_key = 'project_deploy_optimize_info_' . $project_id;
  317 + $info = Cache::get($cache_key);
  318 + if(!$info){
  319 + $projectOptimizeModel = new DeployOptimize();
  320 + $info = $projectOptimizeModel->read(['project_id' => $project_id], ['id', 'company_en_name', 'company_en_description', 'main_keywords']);
  321 + Cache::put($cache_key, $info, 600);
  322 + }
  323 + return $info;
  324 + }
  325 +
313 /** 326 /**
314 * @remark :获取公司英文名称 327 * @remark :获取公司英文名称
315 * @name :companyName 328 * @name :companyName
@@ -322,8 +335,7 @@ class UpdateSeoTdk extends Command @@ -322,8 +335,7 @@ class UpdateSeoTdk extends Command
322 $data = [ 335 $data = [
323 'product_long_description', 336 'product_long_description',
324 ]; 337 ];
325 - $projectOptimizeModel = new DeployOptimize();  
326 - $info = $projectOptimizeModel->read(['project_id' => $project_id], ['id', 'company_en_name', 'company_en_description']); 338 + $info = $this->getDeployOptimize($project_id);
327 if (in_array($key, $data)) { 339 if (in_array($key, $data)) {
328 return $info['company_en_description']; 340 return $info['company_en_description'];
329 } else { 341 } else {
@@ -341,8 +353,7 @@ class UpdateSeoTdk extends Command @@ -341,8 +353,7 @@ class UpdateSeoTdk extends Command
341 public function mainKeywords($project_id, $num) 353 public function mainKeywords($project_id, $num)
342 { 354 {
343 $str = ''; 355 $str = '';
344 - $projectOptimizeModel = new DeployOptimize();  
345 - $info = $projectOptimizeModel->read(['project_id' => $project_id], ['id', 'main_keywords']); 356 + $info = $this->getDeployOptimize($project_id);
346 if (!empty($info['main_keywords'])) { 357 if (!empty($info['main_keywords'])) {
347 $main_keywords = explode("\r\n", $info['main_keywords']); 358 $main_keywords = explode("\r\n", $info['main_keywords']);
348 //随机取 359 //随机取