Browse Source

双十一活动

gorden 4 months ago
parent
commit
2300c1fc71
1 changed files with 14 additions and 4 deletions
  1. 14 4
      app/admin/controller/coupon/CouponDetailController.php

+ 14 - 4
app/admin/controller/coupon/CouponDetailController.php

@@ -313,6 +313,14 @@ class CouponDetailController extends Curd
         return json_success('', $data);
     }
 
+    /**
+     * @Desc 推广的优惠券
+     * @Author Gorden
+     * @Date 2024/11/5 13:39
+     *
+     * @param Request $request
+     * @return Response
+     */
     public function promotionCoupon(Request $request)
     {
         $goods = $request->get('goods', []);
@@ -340,14 +348,16 @@ class CouponDetailController extends Curd
                     $moneyGoodsIds[] = $couponGood['join_coupon_goods_id'];
                 }
             }
-
+            if ($money <= 0){
+                continue;
+            }
             $promotionCoupon = Coupon::where('coupon_id', $coupon['coupon_id'])
                 ->where(function ($query) use ($money) {
                     $query->where('coupon_minimum_limit', 0)
                         ->orWhere('coupon_minimum_limit', '<=', $money);
-                })->select('coupon_id', 'coupon_name', 'coupon_minimum_limit', 'coupon_classify', 'coupon_value', 'coupon_category')
+                })->select('coupon_id', 'coupon_name', 'coupon_minimum_limit', 'coupon_classify', 'coupon_value', 'coupon_category', 'coupon_priority')
                 ->first();
-            if (empty($promotionCoupon)){
+            if (empty($promotionCoupon)) {
                 continue;
             }
             $promotionCoupon = $promotionCoupon->toArray();
@@ -360,8 +370,8 @@ class CouponDetailController extends Curd
                 'coupon_classify' => $promotionCoupon['coupon_classify'],
                 'coupon_value' => $promotionCoupon['coupon_value'] ?? '',
                 'coupon_minimum_limit' => $promotionCoupon['coupon_minimum_limit'] ?? '',
+                'priority' => $promotionCoupon['coupon_priority']
             ];
-
         }
 
         return json_success('', $data);