services = $services; } /** * 获取优惠商品列表 * @param Request $request * @return mixed */ public function index(Request $request) { [$product_id] = $request->postMore([ ['product_id', 0] ], true); $uid = (int)$request->uid(); if (!$product_id) return app('json')->fail('参数错误'); $list = $this->services->getDiscounts((int)$product_id, $uid); return $list ? app('json')->successful($list) : app('json')->successful([]); } public function getList(Request $request){ [$vip_type] = $request->postMore([ ['vip_type', 0] ], true); if (!$vip_type) return app('json')->fail('参数错误'); $list = $this->services->getList(['vip_type'=>$vip_type]); foreach($list['list'] as $key => &$v){ $v['attr_value'] = $this->services->getInfo($v['id']); } return $list ? app('json')->successful($list) : app('json')->fail('无商品礼包'); } }