dever 3 years ago
parent
commit
06206356c0
1 changed files with 6 additions and 4 deletions
  1. 6 4
      app/shop/src/Buy.php

+ 6 - 4
app/shop/src/Buy.php

@@ -198,10 +198,6 @@ class Buy extends Core
     # 优惠券
     public function coupon($price, $method, $type = 1)
     {
-        if ($price <= 0) {
-            Dever::alert('付款价格错误');
-        }
-
         $user_coupon_id = Dever::input('user_coupon_id');
 
         $this->data['user_coupon_id'] = 0;
@@ -209,6 +205,9 @@ class Buy extends Core
         $this->data['coupon_cash'] = 0;
 
         if ($type == 1) {
+            if ($price <= 0) {
+                Dever::alert('付款价格错误');
+            }
             # 查找符合要求的优惠券
             $coupon = Dever::db('shop/user_coupon')->getAll(array('uid' => $this->uid, 'city' => $this->shop['city'], 'status' => 1, 'edate' => time()));
 
@@ -251,6 +250,9 @@ class Buy extends Core
         }
 
         if ($user_coupon_id) {
+            if ($price <= 0) {
+                Dever::alert('付款价格错误');
+            }
             $coupon = Dever::db('shop/user_coupon')->find(array('uid' => $this->uid, 'id' => $user_coupon_id, 'status' => 1));
             if (!$coupon) {
                 Dever::alert('优惠券不可用');