Просмотр исходного кода

优惠券使用去掉sku验证

gorden 1 месяц назад
Родитель
Сommit
0d58a22411
1 измененных файлов с 10 добавлено и 7 удалено
  1. 10 7
      app/admin/service/order/OrderService.php

+ 10 - 7
app/admin/service/order/OrderService.php

@@ -590,11 +590,11 @@ class OrderService
                     ->leftJoin('coupon', 'coupon.coupon_id', '=', 'coupon_detail.join_detail_coupon_id')
                     ->select('coupon_detail.coupon_detail_id', 'coupon_goods.coupon_goods_id', 'coupon_id', 'coupon_classify', 'coupon_value', 'coupon_minimum_limit', 'coupon_category')
                     ->where('coupon_goods.join_coupon_goods_id', $goodsId)
-                    ->where('coupon_goods.join_coupon_goods_sku_id', $good['sku_id'])
+//                    ->where('coupon_goods.join_coupon_goods_sku_id', $good['sku_id'])
                     ->where('join_goods_coupon_id', $couponId)
                     ->where('coupon_detail.join_coupon_detail_member_id', $memberId)
-                    ->where('coupon_detail.coupon_detail_gain_datetime','<',date('Y-m-d H:i:s'))
-                    ->where('coupon_detail.coupon_detail_deadline_datetime','>',date('Y-m-d H:i:s'));;
+                    ->where('coupon_detail.coupon_detail_gain_datetime', '<', date('Y-m-d H:i:s'))
+                    ->where('coupon_detail.coupon_detail_deadline_datetime', '>', date('Y-m-d H:i:s'));
                 if ($settlementNow == 'Y' && $type == 'pay') {
                     $couponDetail = $couponDetail->whereIn('coupon_detail.coupon_detail_status', ['ACTIVED']);
                 } else {
@@ -775,9 +775,11 @@ class OrderService
                     ->leftJoin('coupon', 'coupon.coupon_id', '=', 'coupon_detail.join_detail_coupon_id')
                     ->select('coupon_detail.coupon_detail_id', 'coupon_goods.coupon_goods_id', 'coupon_id', 'coupon_classify', 'coupon_value', 'coupon_minimum_limit', 'coupon_category')
                     ->where('coupon_goods.join_coupon_goods_id', $goodsId)
-                    ->where('coupon_goods.join_coupon_goods_sku_id', $good['sku_id'])
+//                    ->where('coupon_goods.join_coupon_goods_sku_id', $good['sku_id'])
                     ->where('join_goods_coupon_id', $couponId)
-                    ->where('coupon_detail.join_coupon_detail_member_id', $memberId);
+                    ->where('coupon_detail.join_coupon_detail_member_id', $memberId)
+                    ->where('coupon_detail.coupon_detail_gain_datetime', '<', date('Y-m-d H:i:s'))
+                    ->where('coupon_detail.coupon_detail_deadline_datetime', '>', date('Y-m-d H:i:s'));
                 if ($settlementNow == 'Y') {
                     $couponDetail = $couponDetail->whereIn('coupon_detail.coupon_detail_status', ['ACTIVED']);
                 } else {
@@ -875,14 +877,15 @@ class OrderService
             $goodsIds = array_column($goods, 'goods_id');
             $couponGoods = CouponGoods::whereIn('join_coupon_goods_id', $goodsIds)
                 ->where('join_goods_coupon_id', $couponId)
-                ->select('join_coupon_goods_id', 'join_coupon_goods_sku_id')
+//                ->select('join_coupon_goods_id', 'join_coupon_goods_sku_id')
                 ->get()
                 ->toArray();
             $count = 0;
             $amount = 0;
             foreach ($couponGoods as $couponGood) {
                 foreach ($goods as $good) {
-                    if ($good['goods_id'] == $couponGood['join_coupon_goods_id'] && $good['sku_id'] == $couponGood['join_coupon_goods_sku_id']) {
+//                    if ($good['goods_id'] == $couponGood['join_coupon_goods_id'] && $good['sku_id'] == $couponGood['join_coupon_goods_sku_id']) {
+                    if ($good['goods_id'] == $couponGood['join_coupon_goods_id']) {
                         $count += $good['nbr'];
                         $amount += $good['goods_sales_price'] * $good['nbr'];
                     }