|
|
|
@ -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); |
|
|
|
} |
|
|
|
|
|
|
|
} |