123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- namespace App\Console\Commands;
- use Illuminate\Console\Command;
- use Illuminate\Support\Facades\DB;
- use App\Jobs\RechargeJob;
- class Plantaskrecharge extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'command:Plantaskrecharge';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = 'Command description';
- /**
- * Create a new command instance.
- *
- * @return void
- */
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * Execute the console command.
- *
- * @return int
- */
- public function handle()
- {
- $map = [
- ['table_name' ,'=', 'gold_recharge'],
- ['order_status' ,'=', 1],
- ['plantask_status' ,'=', 0],
- ];
- $list = DB::table('mt_pay_order')->where($map)->orderBy('id','asc')->get()->toArray();
- //dd($list);
- if(!empty($list)){
- foreach($list as $key => $val){
- $msg_id = $val->id;
- dispatch((new RechargeJob($msg_id))->delay(0));//加入队列
- }
- //更新
- $ids = array_column($list,'id');
- $update = [
- 'plantask_status' => 1,
- ];
- DB::table('mt_pay_order')->whereIn('id',$ids)->update($update);
- }
- return 0;
- }
- }
|