renderSuccess('数据返回成功',ZoneGoods::getList($param['zone_id'],true)); } /** * 刮奖专区启用禁用 * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function zoneGoodsChangeStatus() { $param = Request::param(); try { validate(ZoneValidate::class)->scene('changeStatus')->check($param); $id = $param['zone_goods_id']; $status = $param['status']; $ZoneGoods = new ZoneGoods(); $ZoneGoodsUp = $ZoneGoods->find($id); $ZoneGoodsUp->status = $status; $ZoneGoodsUp->save(); return $this->renderSuccess($status == 1 ? '已启用' : '已禁用'); } catch (ValidateException $validateException) { return $this->renderError($validateException->getMessage()); } } /** * 奖金设置列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function goodsParamList() { $param = Request::param(); try { validate(ZoneValidate::class)->scene('goodsParamList')->check($param); $zone_goods_id = $param['zone_goods_id']; $ZoneGoodsParam = new ZoneGoodsParam(); $list = $ZoneGoodsParam->where('zone_goods_id',$zone_goods_id) ->field('id,amount,image,probability') ->order('amount','desc') ->select() ->toArray(); foreach ($list as &$item) { $item['probability'] = ($item['probability'] * 100) .'%'; $item['amount_str'] = format_money($item['amount']); $item['image'] = get_image_url($item['image']); } return $this->renderSuccess('数据返回成功',['list' => $list]); } catch (ValidateException $validateException) { return $this->renderError($validateException->getMessage()); } } }