正在显示
1 个修改的文件
包含
7 行增加
和
1 行删除
| @@ -37,11 +37,12 @@ class Temp extends Command | @@ -37,11 +37,12 @@ class Temp extends Command | ||
| 37 | */ | 37 | */ |
| 38 | public function handle() | 38 | public function handle() |
| 39 | { | 39 | { |
| 40 | - $projects = Project::select(['id'])->orderBy('id', 'asc')->get(); | 40 | + $projects = Project::where('id', '>', 52)->select(['id'])->orderBy('id', 'asc')->get(); |
| 41 | foreach ($projects as $project) { | 41 | foreach ($projects as $project) { |
| 42 | ProjectServer::useProject($project->id); | 42 | ProjectServer::useProject($project->id); |
| 43 | 43 | ||
| 44 | //处理关键词首字母 | 44 | //处理关键词首字母 |
| 45 | + try { | ||
| 45 | Keyword::select(['id', 'title', 'first_word'])->chunk(1000, function ($query) { | 46 | Keyword::select(['id', 'title', 'first_word'])->chunk(1000, function ($query) { |
| 46 | foreach ($query as $item) { | 47 | foreach ($query as $item) { |
| 47 | if ($item->first_word === null) { | 48 | if ($item->first_word === null) { |
| @@ -50,6 +51,11 @@ class Temp extends Command | @@ -50,6 +51,11 @@ class Temp extends Command | ||
| 50 | } | 51 | } |
| 51 | } | 52 | } |
| 52 | }); | 53 | }); |
| 54 | + } catch (\Exception $e) { | ||
| 55 | + $this->output($e->getMessage()); | ||
| 56 | + continue; | ||
| 57 | + } | ||
| 58 | + | ||
| 53 | 59 | ||
| 54 | $this->output('ID:' . $project->id . ',success'); | 60 | $this->output('ID:' . $project->id . ',success'); |
| 55 | } | 61 | } |
-
请 注册 或 登录 后发表评论