|
...
|
...
|
@@ -37,19 +37,25 @@ class Temp extends Command |
|
|
|
*/
|
|
|
|
public function handle()
|
|
|
|
{
|
|
|
|
$projects = Project::select(['id'])->orderBy('id', 'asc')->get();
|
|
|
|
$projects = Project::where('id', '>', 52)->select(['id'])->orderBy('id', 'asc')->get();
|
|
|
|
foreach ($projects as $project) {
|
|
|
|
ProjectServer::useProject($project->id);
|
|
|
|
|
|
|
|
//处理关键词首字母
|
|
|
|
Keyword::select(['id', 'title', 'first_word'])->chunk(1000, function ($query) {
|
|
|
|
foreach ($query as $item) {
|
|
|
|
if ($item->first_word === null) {
|
|
|
|
$item->first_word = $this->getTitleFirstLetter($item->title);
|
|
|
|
$item->save();
|
|
|
|
try {
|
|
|
|
Keyword::select(['id', 'title', 'first_word'])->chunk(1000, function ($query) {
|
|
|
|
foreach ($query as $item) {
|
|
|
|
if ($item->first_word === null) {
|
|
|
|
$item->first_word = $this->getTitleFirstLetter($item->title);
|
|
|
|
$item->save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
$this->output($e->getMessage());
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$this->output('ID:' . $project->id . ',success');
|
|
|
|
}
|
...
|
...
|
|