1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace App\Console\Commands;
- use App\Jobs\QappTikTokUser;
- use App\Jobs\QappTikTokUserCharge;
- use Illuminate\Console\Command;
- use App\Modules\User\Models\QappUser;
- use App\Modules\User\Models\User;
- class BookTest extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'book:test';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $client;
- protected $description = 'Command description';
- /**
- * Create a new command instance.
- *
- * @return void
- */
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * Execute the console command.
- *
- * @return mixed
- */
- public function handle()
- {
- $users = QappUser::join('orders', 'orders.uid', 'qapp_users.uid')
- ->where('qapp_users.created_at', '>=', '2020-08-01')
- ->where('orders.created_at', '>=', '2020-08-01')
- ->where('orders.status', 'PAID')
- ->select('orders.uid', 'orders.price', 'orders.created_at')
- ->get();
- foreach ($users as $user) {
- $this->notify($user);
- }
- }
- private function notify($model)
- {
- $job = new QappTikTokUserCharge($model->uid, $model->price, $model->created_at, QappTikTokUserCharge::REGISTER_24_CHARGE, '', '');
- print_r($model->toArray());
- $job->handle();
- }
- }
|