链街Dcat后台
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.

61 lines
1.3 KiB

  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. use App\Models\ImsCjdcStore;
  5. use Carbon\Carbon;
  6. class TransSQTimeToAdd extends Command
  7. {
  8. /**
  9. * The name and signature of the console command.
  10. *
  11. * @var string
  12. */
  13. protected $signature = 'command:TransSQTimeToAdd';
  14. /**
  15. * The console command description.
  16. *
  17. * @var string
  18. */
  19. protected $description = 'Command 转换申请时间到time_add';
  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. $stores = ImsCjdcStore::all();
  37. foreach ($stores as $key => $store) {
  38. # code...
  39. $d = new Carbon($store->rzdq_time);
  40. //dd($d->subDays(1000));
  41. $nd = $d->subDays(1000)->toDateTimeString();
  42. $store->time_add = $nd;
  43. $store->save();
  44. }
  45. // $store = ImsCjdcStore::find(1);
  46. // $d = new Carbon($store->rzdq_time);
  47. // $nd = $d->subDays(1000)->toDateTimeString();
  48. // $store->time_add = $nd;
  49. // $store->save();
  50. return 0;
  51. }
  52. }