作者 lyh

gx

@@ -51,6 +51,7 @@ class InitKeyword extends Command @@ -51,6 +51,7 @@ class InitKeyword extends Command
51 { 51 {
52 while (true){ 52 while (true){
53 $list = NoticeLog::where('type', NoticeLog::TYPE_INIT_KEYWORD)->where('status', NoticeLog::STATUS_PENDING)->get(); 53 $list = NoticeLog::where('type', NoticeLog::TYPE_INIT_KEYWORD)->where('status', NoticeLog::STATUS_PENDING)->get();
  54 + if(!empty($list)){
54 foreach ($list as $item){ 55 foreach ($list as $item){
55 echo 'start:' . $item['id'] . PHP_EOL; 56 echo 'start:' . $item['id'] . PHP_EOL;
56 ProjectServer::useProject($item['data']['project_id']); 57 ProjectServer::useProject($item['data']['project_id']);
@@ -60,10 +61,15 @@ class InitKeyword extends Command @@ -60,10 +61,15 @@ class InitKeyword extends Command
60 $route = RouteMap::setRoute($v['title'],RouteMap::SOURCE_PRODUCT_KEYWORD,$v['id'],$item['data']['project_id']); 61 $route = RouteMap::setRoute($v['title'],RouteMap::SOURCE_PRODUCT_KEYWORD,$v['id'],$item['data']['project_id']);
61 if(empty($route)){ 62 if(empty($route)){
62 $keywordModel->del(['id'=>$v['id']]); 63 $keywordModel->del(['id'=>$v['id']]);
  64 + continue;
63 } 65 }
  66 + $keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
64 } 67 }
  68 + $item->status = NoticeLog::STATUS_SUCCESS;
  69 + $item->save();
65 DB::disconnect('custom_mysql'); 70 DB::disconnect('custom_mysql');
66 } 71 }
  72 + }
67 sleep(2); 73 sleep(2);
68 } 74 }
69 } 75 }