UpgradeDictId.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. use Illuminate\Support\Facades\DB;
  5. use App\Http\Api\DictApi;
  6. class UpgradeDictId extends Command
  7. {
  8. /**
  9. * The name and signature of the console command.
  10. *
  11. * @var string
  12. */
  13. protected $signature = 'upgrade:wbw.dict.id';
  14. /**
  15. * The console command description.
  16. *
  17. * @var string
  18. */
  19. protected $description = '修改wbw字典id';
  20. /**
  21. * Create a new command instance.
  22. *
  23. * @return void
  24. */
  25. public function __construct()
  26. {
  27. parent::__construct();
  28. }
  29. /**
  30. * Execute the console command.
  31. *
  32. * @return int
  33. */
  34. public function handle()
  35. {
  36. if(\App\Tools\Tools::isStop()){
  37. return 0;
  38. }
  39. $this->info($this->description);
  40. $user_dict_id = DictApi::getSysDict('community');
  41. if($user_dict_id){
  42. $result = DB::select('UPDATE "user_dicts" set "dict_id"=? where "source"=? ',[$user_dict_id,'_USER_WBW_']);
  43. }else{
  44. $this->error('没有找到 community 字典');
  45. }
  46. $user_dict_extract_id = DictApi::getSysDict('community_extract');
  47. if($user_dict_extract_id){
  48. $result = DB::select('UPDATE "user_dicts" set "dict_id"=? where "source"=? ',[$user_dict_extract_id,'_SYS_USER_WBW_']);
  49. }else{
  50. $this->error('没有找到 community_extract 字典');
  51. }
  52. $this->info('all done');
  53. return 0;
  54. }
  55. }