| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace App\Console\Commands;
- use App\Models\UserDict;
- use App\Models\WordIndex;
- use App\Tools\Tools;
- use Illuminate\Console\Command;
- class UpgradeVocabulary extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'upgrade:vocabulary';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = '刷新词汇表完成情况';
- /**
- * Create a new command instance.
- *
- * @return void
- */
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * Execute the console command.
- *
- * @return int
- */
- public function handle()
- {
- if (Tools::isStop()) {
- return 0;
- }
- $words = UserDict::select('word')->groupBy('word')->cursor();
- $count = 0;
- foreach ($words as $word) {
- $update = WordIndex::where('word', $word->word)->update(['final' => 1]);
- if ($update == 1) {
- $this->info("{$count}. {$word->word}");
- $count++;
- }
- }
- return 0;
- }
- }
|