| 
					
				 | 
			
			
				@@ -66,6 +66,13 @@ class Coupon 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return false;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $coupon = Dever::db('goods/coupon')->find($data['coupon_id']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!$coupon) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Dever::alert('优惠券不存在');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return false;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if ($data['total'] <= 0) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return false;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -88,7 +95,11 @@ class Coupon 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             # 验证是否已经领取,一周内不能再次领取
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            $user = Dever::db('shop/user_coupon')->getOne(array('uid' => $uid, 'shop_coupon_id' => $shop_coupon_id));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if ($coupon['method'] == 3) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $user = Dever::db('shop/user_coupon')->getOne(array('uid' => $uid, 'shop_coupon_id' => $shop_coupon_id));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $user = Dever::db('shop/user_coupon')->getOne(array('uid' => $uid, 'coupon_id' => $coupon['id']));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if ($user && time() - $user['cdate'] < 86400*7) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Dever::alert('您已领取过该优惠劵');
 
			 |