|
|
|
@ -0,0 +1,54 @@ |
|
|
|
<?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; |
|
|
|
} |
|
|
|
} |