CallbackCommand.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace App\Console\Commands\MeiTu;
  3. use App\Jobs\PartnerCallbackJob;
  4. use App\Models\Partner\PartnerBeautyUser;
  5. use Illuminate\Console\Command;
  6. class CallbackCommand extends Command
  7. {
  8. /**
  9. * The name and signature of the console command.
  10. *
  11. * @var string
  12. */
  13. protected $signature = 'meitu:callback';
  14. /**
  15. * The console command description.
  16. *
  17. * @var string
  18. */
  19. protected $description = '美图优化的回滚';
  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 mixed
  33. */
  34. public function handle()
  35. {
  36. $partners = PartnerBeautyUser::where('replaced_at', '>', 0)
  37. ->where('callback_at', 0)
  38. ->where('original_photo', '<>', '')
  39. ->where('new_photo', '<>', '')
  40. ->pluck('id');
  41. foreach ($partners as $id) {
  42. PartnerCallbackJob::dispatch($id)->onQueue("{meitu:callback}");
  43. }
  44. }
  45. }