goCheck('voucher',[ 'user_id'=>$this->userId ]); $result = UserCouponLogic::userCouponList($params); if (false === $result) { return $this->fail(UserCouponLogic::getError()); } return $this->data($result); } /** * 一键领取优惠卷 * @return \think\response\Json */ public function add() { $params = (new UserCouponValidate())->post()->goCheck('add',[ 'user_id'=>$this->userId ]); $result = UserCouponLogic::add($params); if (false !== $result) { return $this->success('领取成功'.implode('\n',$result), [], 1, 1); } return $this->fail(UserCouponLogic::getError()); } public function categoryCouponLists() { $params = (new UserCouponValidate())->goCheck('category',[ 'user_id'=>$this->userId ]); $result = UserCouponLogic::categoryCouponLists($params); if (false === $result) { return $this->fail(UserCouponLogic::getError()); } return $this->data($result); } public function categoryWithAmountLists() { $params = (new UserCouponValidate())->goCheck('categoryWithAmountList',[ 'user_id'=>$this->userId ]); $result = UserCouponLogic::categoryWithAmountLists($params); if (false === $result) { return $this->fail(UserCouponLogic::getError()); } return $this->data($result); } }