BookTest.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace App\Console\Commands;
  3. use App\Jobs\QappTikTokUser;
  4. use App\Jobs\QappTikTokUserCharge;
  5. use Illuminate\Console\Command;
  6. use App\Modules\User\Models\QappUser;
  7. use App\Modules\User\Models\User;
  8. class BookTest extends Command
  9. {
  10. /**
  11. * The name and signature of the console command.
  12. *
  13. * @var string
  14. */
  15. protected $signature = 'book:test';
  16. /**
  17. * The console command description.
  18. *
  19. * @var string
  20. */
  21. protected $client;
  22. protected $description = 'Command description';
  23. /**
  24. * Create a new command instance.
  25. *
  26. * @return void
  27. */
  28. public function __construct()
  29. {
  30. parent::__construct();
  31. }
  32. /**
  33. * Execute the console command.
  34. *
  35. * @return mixed
  36. */
  37. public function handle()
  38. {
  39. $users = QappUser::join('orders', 'orders.uid', 'qapp_users.uid')
  40. ->where('qapp_users.created_at', '>=', '2020-08-01')
  41. ->where('orders.created_at', '>=', '2020-08-01')
  42. ->where('orders.status', 'PAID')
  43. ->select('orders.uid', 'orders.price', 'orders.created_at')
  44. ->get();
  45. foreach ($users as $user) {
  46. $this->notify($user);
  47. }
  48. }
  49. private function notify($model)
  50. {
  51. $job = new QappTikTokUserCharge($model->uid, $model->price, $model->created_at, QappTikTokUserCharge::REGISTER_24_CHARGE, '', '');
  52. print_r($model->toArray());
  53. $job->handle();
  54. }
  55. }