作者 张关杰

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

@@ -45,7 +45,12 @@ class RankData extends BaseCommands @@ -45,7 +45,12 @@ class RankData extends BaseCommands
45 { 45 {
46 Log::channel('rank_data')->info('开始-排名数据'); 46 Log::channel('rank_data')->info('开始-排名数据');
47 //同步api_no 47 //同步api_no
48 - $this->SyncApiNo(); 48 + try {
  49 + $this->SyncApiNo();
  50 + }catch (\Exception $e){
  51 + Log::channel('rank_data')->error('同步api_no失败:' . $e->getMessage());
  52 + }
  53 +
49 54
50 //所有项目 今日是否达标 重置 55 //所有项目 今日是否达标 重置
51 //有失败会重跑任务,导致达标又被重置 加缓存一天只重置一次 56 //有失败会重跑任务,导致达标又被重置 加缓存一天只重置一次
@@ -167,7 +167,7 @@ class UpdateSeoTdk extends Command @@ -167,7 +167,7 @@ class UpdateSeoTdk extends Command
167 $ai_commands = AiCommand::where('is_batch', 1)->select('key', 'scene', 'ai')->get()->toArray(); 167 $ai_commands = AiCommand::where('is_batch', 1)->select('key', 'scene', 'ai')->get()->toArray();
168 $ai_commands = Arr::setValueToKey($ai_commands, 'key'); 168 $ai_commands = Arr::setValueToKey($ai_commands, 'key');
169 foreach ($this->maps as $table => $map) { 169 foreach ($this->maps as $table => $map) {
170 - $update[$table] = ['total_page'=>0, 'title'=>0, 'keyword'=>0, 'des'=>0]; 170 + $update[$table] = ['total_page'=>0, 'title'=>0, 'keyword'=>0, 'des'=>0,'keyword_title'=>0,'keyword_content'=>0];
171 echo date('Y-m-d H:i:s') . '更新--' . $table . ': 项目id' . $project_id . PHP_EOL; 171 echo date('Y-m-d H:i:s') . '更新--' . $table . ': 项目id' . $project_id . PHP_EOL;
172 $list = DB::connection('custom_mysql')->table($table)->select('id')->get(); 172 $list = DB::connection('custom_mysql')->table($table)->select('id')->get();
173 if (!empty($list)) { 173 if (!empty($list)) {
@@ -227,6 +227,12 @@ class UpdateSeoTdk extends Command @@ -227,6 +227,12 @@ class UpdateSeoTdk extends Command
227 if($field == 'seo_description' || $field == 'description' || $field == 'seo_des'){ 227 if($field == 'seo_description' || $field == 'description' || $field == 'seo_des'){
228 $update[$table]['des']++; 228 $update[$table]['des']++;
229 } 229 }
  230 + if($field == 'keyword_title'){
  231 + $update[$table]['keyword_title']++;
  232 + }
  233 + if($field == 'keyword_content'){
  234 + $update[$table]['keyword_content']++;
  235 + }
230 $data[$field] = $this->ai_send($prompt); 236 $data[$field] = $this->ai_send($prompt);
231 } 237 }
232 } else { 238 } else {
@@ -261,6 +267,12 @@ class UpdateSeoTdk extends Command @@ -261,6 +267,12 @@ class UpdateSeoTdk extends Command
261 if($field == 'seo_description' || $field == 'description' || $field == 'seo_des'){ 267 if($field == 'seo_description' || $field == 'description' || $field == 'seo_des'){
262 $update[$table]['des']++; 268 $update[$table]['des']++;
263 } 269 }
  270 + if($field == 'keyword_title'){
  271 + $update[$table]['keyword_title']++;
  272 + }
  273 + if($field == 'keyword_content'){
  274 + $update[$table]['keyword_content']++;
  275 + }
264 } 276 }
265 } 277 }
266 } 278 }
@@ -312,7 +312,7 @@ class WebTraffic extends Command @@ -312,7 +312,7 @@ class WebTraffic extends Command
312 $other = DB::connection('projects_mysql')->table('projects')->where('switch', 1)->pluck('domain')->toArray(); 312 $other = DB::connection('projects_mysql')->table('projects')->where('switch', 1)->pluck('domain')->toArray();
313 $data = []; 313 $data = [];
314 foreach ($list as $project) { 314 foreach ($list as $project) {
315 - $lang = WebLanguage::getLangById($this->project['main_lang_id']??1)['short']; 315 + $lang = WebLanguage::getLangById($project['main_lang_id']??1)['short'];
316 if(empty($project->domainInfo['domain'])){ 316 if(empty($project->domainInfo['domain'])){
317 continue; 317 continue;
318 } 318 }
@@ -802,11 +802,16 @@ class ProjectController extends BaseController @@ -802,11 +802,16 @@ class ProjectController extends BaseController
802 ]; 802 ];
803 foreach ($data as $k => $v){ 803 foreach ($data as $k => $v){
804 if(isset($item[$k])){ 804 if(isset($item[$k])){
805 - $item[$k] = Arr::s2a($item[$k]);  
806 - $item[$k] = $v.'总条数:'.$item[$k]['total_page'].  
807 - ', title更新数:'.$item[$k]['title'].  
808 - ',keyword更新数据:'.$item[$k]['keyword'].  
809 - ',des更新数据:'.$item[$k]['des']; 805 + $data = Arr::s2a($item[$k]);
  806 + //{"des": 3500, "title": 0, "keyword": 3501, "total_page": 8458, "keyword_title": 3500, "keyword_content": 3500}
  807 + $item[$k] = $v.'总条数:'.$data['total_page'].
  808 + ', title更新数:'.$data['title'].
  809 + ',keyword更新数:'.$data['keyword'].
  810 + ',des更新数:'.$data['des'];
  811 + if($k == 'gl_product_keyword'){
  812 + $item[$k] .= ',keyword_title更新数:'.($data['keyword_title']??0);
  813 + $item[$k] .= ',keyword_content更新数:'.($data['keyword_content']??0);
  814 + }
810 } 815 }
811 816
812 } 817 }
@@ -604,6 +604,9 @@ class ProjectLogic extends BaseLogic @@ -604,6 +604,9 @@ class ProjectLogic extends BaseLogic
604 if($rs === false){ 604 if($rs === false){
605 $this->fail('error'); 605 $this->fail('error');
606 } 606 }
  607 + //更新当前项目所有账号状态
  608 + $userModel = new UserModel();
  609 + $userModel->edit(['status'=>1],['project_id'=>$this->param['id']]);
607 return $this->success(); 610 return $this->success();
608 } 611 }
609 612
@@ -55,7 +55,7 @@ class UserLoginLogic @@ -55,7 +55,7 @@ class UserLoginLogic
55 $projectArr[] = $v['project_id']; 55 $projectArr[] = $v['project_id'];
56 } 56 }
57 $projectModel = new Project(); 57 $projectModel = new Project();
58 - $project_list = $projectModel->list(['id'=>['in',$projectArr]],'id',['id','title']); 58 + $project_list = $projectModel->list(['id'=>['in',$projectArr],['delete_status'=>0]],'id',['id','title']);
59 //登录选择项目的有效时间 59 //登录选择项目的有效时间
60 Cache::add('login-project-'.$this->param['mobile'],1,300); 60 Cache::add('login-project-'.$this->param['mobile'],1,300);
61 return $this->success($project_list); 61 return $this->success($project_list);