table = $table; $this->delay = $delay; } public function handle() { info(__CLASS__.' 开始处理 '.$this->table); $count = (new Log())->setTable($this->table) ->whereHas('coupon', function ($q) { $q->whereNull('pa_order_id'); }) ->where('path', 'http://api.pingan.com.cn/open/vassPartner/appsvr/property/api/new/partner/redemption') ->where('out_source->code', 200) ->count(); if ($count > 0) { (new Log())->setTable($this->table) ->whereHas('coupon', function ($q) { $q->whereNull('pa_order_id'); }) ->where('path', 'http://api.pingan.com.cn/open/vassPartner/appsvr/property/api/new/partner/redemption') ->where('out_source->code', 200) ->chunkById(1000, function ($logs) { foreach ($logs as $log) { $log->coupon->update([ 'pa_order_id' => $log->out_source['data']['orderId'], 'pa_sub_order_id' => $log->out_source['data']['subOrderId'], ]); } }); } info(__CLASS__.' '.$this->table.' 成功处理 '.$count); } }