where('status', 0)->find(); if ($partake){ $uids = User::where('spread_uid', $item['uid'])->column('uid'); $money = StoreOrder::where('uid', 'in', $uids) ->where('paid', 1) ->where('is_participate', 0) ->sum('pay_price'); $out = Out::where('id', $partake['out_id'])->find(); if ($money >= $out['number']){ User::where('uid', $item['uid'])->dec('pay_price', $money)->update(); User::where('uid', $item['uid'])->inc('use_price', $money)->update(); $partake['status'] = 1; $partake['money'] = $money; $partake->save(); StoreOrder::where('uid', 'in', $uids)->where('paid', 1)->where('is_participate', 0)->update(['is_participate' => 1]); } } } } }