dever há 3 anos atrás
pai
commit
4badc782fd
2 ficheiros alterados com 8 adições e 10 exclusões
  1. 2 10
      app/shop/lib/Coupon.php
  2. 6 0
      app/shop/src/Buy.php

+ 2 - 10
app/shop/lib/Coupon.php

@@ -88,12 +88,6 @@ class Coupon
                 return false;
             }
 
-            $state = Dever::load('shop/lib/share')->getOne($uid, $shop['id'], 1);
-            if (!$state) {
-                Dever::alert('您还完成分享');
-                return false;
-            }
-
             # 验证是否已经领取,一周内不能再次领取
             if ($coupon['method'] == 3) {
                 $user = Dever::db('shop/user_coupon')->getOne(array('uid' => $uid, 'shop_coupon_id' => $shop_coupon_id));
@@ -107,17 +101,15 @@ class Coupon
             }
         }
 
-        $state = Dever::load('shop/lib/coupon.take_commit', $uid, $shop, $data, $num);
+        $state = Dever::load('shop/lib/coupon.take', $uid, $shop, $data, $num);
         if ($state) {
             return true;
         }
-
-        Dever::alert('领取失败');
         return false;
     }
 
     # 领取
-    public function take_commit($uid, $shop, $shop_coupon, $num = 1)
+    public function take($uid, $shop, $shop_coupon, $num = 1)
     {
         $add_num = 0;
         for ($i = 0; $i < $num; $i++) {

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

@@ -63,6 +63,12 @@ class Buy extends Core
 		$coupon = explode(',', $shop_coupon_id);
 
 		$this->data['take'] = array();
+
+		$state = Dever::load('shop/lib/share')->getOne($this->uid, $this->shop['id'], 1);
+        if (!$state) {
+            Dever::alert('您还完成分享');
+            return false;
+        }
 		foreach ($coupon as $k => $v) {
 			$this->data['take']['shop_coupon_id'] = $v;
 			$this->data['take']['status'] = Dever::load('shop/lib/coupon')->getOne($this->uid, $this->shop, $v, $act_id);