field('amount,image,probability,awards')->select()->toArray(); $ZoneAmountParam = []; foreach ($list as &$item) { $item['image'] = get_image_url($item['image']); if ($item['awards'] != 1) { # 获取无奖项随机金额 $item['amount'] = ZoneAmountParam::getRandAmount($ZoneAmountParam); $ZoneAmountParam = $item['data']; } } return $list; } /** * 获取中奖金额 * @author whj * @date 2023-08-28 17:50 */ public static function getAwardsAmount($id) { $data = self::where(['id' => $id,'awards' => 1])->field('amount')->find(); return $data ?: false; } }