renderSuccess('数据返回成功',ZoneModel::getList()); } /** * 刮奖专区列表 * @param $zone_id * @return array */ public function zoneGoodsList($zone_id) { return $this->renderSuccess('数据返回成功',ZoneGoods::getList($zone_id)); } /** * 立即刮奖 * @param $zoneGoodsId * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function beginLottery($zoneGoodsId) { # 判断余额够不够 $userData = Session::get('login_user_data'); $judgeRes = ZoneLogic::judgeBalance($userData['id'],$zoneGoodsId); if (!$judgeRes) return $this->renderError('余额不足'); # 获取刮奖图片 $data = ZoneLogic::createOrder($userData['id'],$zoneGoodsId); return $this->renderSuccess('开始刮奖',['list' => $data['data'], 'c_r_id' => $data['c_r_id']]); } /** * 结束刮奖 * @param $zoneOrderId * @return array|void * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function endLottery($c_r_id) { $userData = Session::get('login_user_data'); $res = ZoneLogic::endOrder($userData['id'],$c_r_id); if (!$res['status']) return $this->renderError($res['msg']); return $this->renderSuccess($res['msg']); } }