stage_id = ActivityModel::where('signend_time', '<=', time()) ->where('close_time', '>=', time())->value('stage_id'); \DB::table('kdgx_partner_charge_pair')->where('stage_id', $this->stage_id) ->whereNotNull('assoc_id')->whereBetween('state', [100, 199])->increment('state', 300); \DB::table('kdgx_partner_charge_pair')->where('stage_id', $this->stage_id) ->whereNull('assoc_id')->whereBetween('state', [100, 199])->increment('state', 200); \DB::table('kdgx_partner_charge_pair')->where('stage_id', $this->stage_id) ->whereNull('assoc_id')->whereBetween('state', [0, 99])->increment('state', 900); $pairs = \DB::table('kdgx_partner_charge_pair') ->where('stage_id', $this->stage_id)->whereNull('assoc_id')->pluck('id'); \DB::table('kdgx_fpdx_deed')->where('type', 1)->whereIn('ack', $pairs)->update(['state' => -1]); $pairs = \DB::table('kdgx_partner_charge_pair') ->where('stage_id', $this->stage_id)->whereNotNull('assoc_id')->pluck('id'); \DB::table('kdgx_fpdx_deed')->where('type', 1)->where('state', 1)->whereIn('ack', $pairs)->update([ 'state' => 2, ]); } }