diff --git a/app/Controller/v3/OrderOnlineController.php b/app/Controller/v3/OrderOnlineController.php index ca7a593..f1e5c2c 100644 --- a/app/Controller/v3/OrderOnlineController.php +++ b/app/Controller/v3/OrderOnlineController.php @@ -142,7 +142,7 @@ class OrderOnlineController extends BaseController $res['store_list'] = $this->shopCartService->getGoodsByShopcartId($shopcartIds); //获取用户优惠券 - $coupons = $this->couponRecService->allForOnlineOrderAvailable($userId, $marketId, $shopcartIds); + $coupons = $this->couponRecService->allForOnlineOrderAvailable($userId, $marketId, explode(',', $shopcartIds)); $res['coupon'] = [ 'available' => [], 'not_available' => [], diff --git a/app/Service/v3/Implementations/CouponRecService.php b/app/Service/v3/Implementations/CouponRecService.php index ceeb4e5..9919078 100644 --- a/app/Service/v3/Implementations/CouponRecService.php +++ b/app/Service/v3/Implementations/CouponRecService.php @@ -147,7 +147,7 @@ class CouponRecService implements CouponRecServiceInterface * @param $shopcartIds * @return array */ - public function allForOnlineOrderAvailable($userId, $marketId, $shopcartIds) + public function allForOnlineOrderAvailable($userId, $marketId, $shopcartIds = []) { // 获取购物车数据 $carts = $this->shopCartService->allForUser($userId, $marketId, $shopcartIds); diff --git a/app/Service/v3/Interfaces/CouponRecServiceInterface.php b/app/Service/v3/Interfaces/CouponRecServiceInterface.php index 771824f..83c5131 100644 --- a/app/Service/v3/Interfaces/CouponRecServiceInterface.php +++ b/app/Service/v3/Interfaces/CouponRecServiceInterface.php @@ -9,7 +9,7 @@ interface CouponRecServiceInterface public function undo(); public function allForOrderOlAvailable($totalAmount,$userId,$marketId,$type,$storeTypeId); public function getListByUser($userId,$type,$page = 1,$pagesize = 5); - public function allForOnlineOrderAvailable($userId, $marketId, $shopcartIds); + public function allForOnlineOrderAvailable($userId, $marketId, $shopcartIds = []); /** * 统计用户可使用优惠券数量 * @param $userId