From 7c4aadafc6539cffb41a5ec783b623e883cc698f Mon Sep 17 00:00:00 2001 From: Mike Date: Fri, 17 Jul 2020 09:57:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0mock=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/CouponController.php | 37 ++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/app/Controller/CouponController.php b/app/Controller/CouponController.php index d33db3a..922a189 100644 --- a/app/Controller/CouponController.php +++ b/app/Controller/CouponController.php @@ -59,8 +59,7 @@ class CouponController extends BaseController } /** - * 获取用户当前订单可用的优惠券列表 - * 按分类(1订单 等优惠)分组返回 + * 用户领取优惠卷 */ public function userReceiveCoupon() { @@ -68,7 +67,7 @@ class CouponController extends BaseController $userId = $this->request->input("user_id"); $receiveType = $this->request->input("receive_type"); $ids = $this->request->input("ids"); - $type = $this->request->input("test",0); + $test = $this->request->input("test",0); $ids = is_array($ids)?implode(',',$ids):$ids; @@ -93,11 +92,17 @@ class CouponController extends BaseController $cr->status = 0; $cr->update_time = $now; $cr->receive_type = $receiveType; - if($cr->save()){ - $success[] = $cp; - }else{ + + if($test){ $fail[] = $cp; + }else{ + if($cr->save()){ + $success[] = $cp; + }else{ + $fail[] = $cp; + } } + } return $this->success([ @@ -140,4 +145,24 @@ class CouponController extends BaseController return $this->success($ret); } + + /** + * 获取用户当前订单可用的优惠券列表 + * 按分类(1订单 等优惠)分组返回 + */ + public function getUserAvailableCoupons() + { + // 获取参数 + # 订单金额 + $orderAmount = $this->request->input('order_amount',0); + # 用户id + $userId = $this->request->input('user_id',0); + # 市场id + $marketId = $this->request->input('market_id',0); + # 类型,1全平台 2线上 3线下,20200718默认全平台 + $type = $this->request->input('type',1); + # 店铺类型id + $storetypeId = $this->request->input('storetype_id',0); + } + }