request->input('user_id'); $page = $this->request->input('page'); $pagesize = $this->request->input('pagesize'); $type = $this->request->input('type','1'); /** * $type unused 未使用 used 已使用 expired已失效 */ $res['coupon_list'] = $this->couponRecService->getListByUser($userId,$type,$page,$pagesize); $res['statistics'] = $this->couponRecService->statistics($userId); return $this->success($res); } public function getAvailableListByNewUser() { $userId = $this->request->input("user_id", 0); $receiveType = $this->request->input("receive_type", 0); $newUserCheck = OrderMain::query() ->where('user_id',$userId) ->whereIn('state',OrderState::CAN_DEL) ->whereIn('state',OrderState::REFUND) ->exists(); if($newUserCheck){ return $this->result( ErrorCode::COUPON_IS_NOT_NEW_USER, [ 'text'=>'关注懒族菜市微信公众号,更多精彩活动一手掌握!' ], '不是新用户无法领券' ); } $res = $this->couponRecService->getAvailableList($userId,$receiveType); return $this->success($res); } /** * 用户领取优惠卷 */ public function Receive(CouponReceiveRequest $request) { $userId = $this->request->input("user_id", 0); $receiveType = $this->request->input("receive_type", 0); $ids = $this->request->input("ids", ''); $res = $this->couponRecService->receive($userId,$receiveType,$ids); return $this->success($res); } }