正在显示
1 个修改的文件
包含
4 行增加
和
7 行删除
| @@ -72,16 +72,13 @@ class InitKeyword extends Command | @@ -72,16 +72,13 @@ class InitKeyword extends Command | ||
| 72 | public function bind($notice_id) | 72 | public function bind($notice_id) |
| 73 | { | 73 | { |
| 74 | $notice = NoticeLog::where(['id' => $notice_id])->first(); | 74 | $notice = NoticeLog::where(['id' => $notice_id])->first(); |
| 75 | - if (empty($notice) || $notice->type != NoticeLog::TYPE_INIT_KEYWORD || $notice->status != NoticeLog::STATUS_PENDING) | 75 | + if (empty($notice) || $notice->type != NoticeLog::TYPE_INIT_KEYWORD || $notice->status != NoticeLog::STATUS_PENDING){ |
| 76 | return true; | 76 | return true; |
| 77 | - | ||
| 78 | - | 77 | + } |
| 79 | ProjectServer::useProject($notice['data']['project_id']); | 78 | ProjectServer::useProject($notice['data']['project_id']); |
| 80 | - | ||
| 81 | $keyword = Keyword::whereNull('route')->get(); | 79 | $keyword = Keyword::whereNull('route')->get(); |
| 82 | foreach ($keyword as $val) { | 80 | foreach ($keyword as $val) { |
| 83 | $this->output(' keywordID: ' . $val->id . ', title: ' . $val->title); | 81 | $this->output(' keywordID: ' . $val->id . ', title: ' . $val->title); |
| 84 | - | ||
| 85 | try { | 82 | try { |
| 86 | $route = RouteMap::setRoute($val['title'],RouteMap::SOURCE_PRODUCT_KEYWORD, $val->id, $notice['data']['project_id']); | 83 | $route = RouteMap::setRoute($val['title'],RouteMap::SOURCE_PRODUCT_KEYWORD, $val->id, $notice['data']['project_id']); |
| 87 | $val->route = $route; | 84 | $val->route = $route; |
| @@ -93,7 +90,6 @@ class InitKeyword extends Command | @@ -93,7 +90,6 @@ class InitKeyword extends Command | ||
| 93 | 90 | ||
| 94 | $notice->status = NoticeLog::STATUS_SUCCESS; | 91 | $notice->status = NoticeLog::STATUS_SUCCESS; |
| 95 | $notice->save(); | 92 | $notice->save(); |
| 96 | - | ||
| 97 | DB::disconnect('custom_mysql'); | 93 | DB::disconnect('custom_mysql'); |
| 98 | return true; | 94 | return true; |
| 99 | } | 95 | } |
| @@ -106,8 +102,9 @@ class InitKeyword extends Command | @@ -106,8 +102,9 @@ class InitKeyword extends Command | ||
| 106 | { | 102 | { |
| 107 | $key = 'notice_log_type_keyword'; | 103 | $key = 'notice_log_type_keyword'; |
| 108 | $notice_id = Redis::rpop($key); | 104 | $notice_id = Redis::rpop($key); |
| 109 | - if ($notice_id) | 105 | + if ($notice_id){ |
| 110 | return $notice_id; | 106 | return $notice_id; |
| 107 | + } | ||
| 111 | $ids = NoticeLog::where('type', NoticeLog::TYPE_INIT_KEYWORD)->where('status', NoticeLog::STATUS_PENDING)->limit(100)->pluck('id'); | 108 | $ids = NoticeLog::where('type', NoticeLog::TYPE_INIT_KEYWORD)->where('status', NoticeLog::STATUS_PENDING)->limit(100)->pluck('id'); |
| 112 | foreach ($ids as $id) { | 109 | foreach ($ids as $id) { |
| 113 | Redis::lpush($key, $id); | 110 | Redis::lpush($key, $id); |
-
请 注册 或 登录 后发表评论