first(); if (!$lottery) { dd('活动不存在'); } // 发奖品 $tickets = TicketModel::where('lottery_id', $lottery->id) ->whereNotIn('uid', [20000001, 20010000]) ->where('lucky', 1) ->get(); foreach ($tickets as $ticket) { PrizeModel::create([ 'uid' => $ticket->uid, 'title' => $lottery->title, 'cover_url' => $lottery->cover_url, 'cost' => $lottery->cost, ]); } $n = new NoticeService(); // 发碎片 $users = TicketModel::where('lottery_id', $lottery->id) ->whereNotIn('uid', [20000001, 20010000]) ->distinct() ->pluck('uid'); foreach ($users as $uid) { UserModel::where('uid', $uid)->increment('jigsaw_amount'); JigsawFlowModel::create([ 'uid' => $uid, 'source' => '参与抽奖获得', 'amount' => 1, 'remains_amount' => 1 ]); // 通知 $n->afterLottery($uid, $lottery->id); } } }