You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;use App\Models\EsDict;
class GenEsDicts extends Command{ /** * The name and signature of the console command. * * @var string */ protected $signature = 'command:GenEsDicts';
/** * The console command description. * * @var string */ protected $description = 'Command 生成Es分词数据';
/** * Create a new command instance. * * @return void */ public function __construct() { parent::__construct(); }
/** * Execute the console command. * * @return int */ public function handle() {
$es = EsDict::whereNull('deleted_at')->pluck('title')->toArray(); //dd($es);
$es = implode("\n",$es); $file_path = public_path() . '/es_use_dicts.txt'; file_put_contents($file_path,$es);
$es = EsDict::whereNotNull('deleted_at')->pluck('title')->toArray(); $es = implode("\n",$es); $file_path = public_path() . '/es_unuse_dicts.txt'; file_put_contents($file_path,$es); return 0; }}
|