|
@@ -58,6 +58,7 @@ class Coupon
|
|
|
$data = Dever::db('shop/coupon')->getOne($shop_coupon_id);
|
|
|
|
|
|
if (!$data) {
|
|
|
+ Dever::alert('优惠券不存在');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -72,17 +73,21 @@ class Coupon
|
|
|
$data = Dever::db('shop/coupon_act')->getOne(array('shop_id' => $shop['id'], 'act_id' => $act_id, 'shop_coupon_id' => $shop_coupon_id));
|
|
|
|
|
|
if (!$data) {
|
|
|
+ Dever::alert('优惠券不存在');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
$state = Dever::load('shop/lib/share')->getOne($uid, $shop['id'], 1);
|
|
|
if (!$state) {
|
|
|
+ Dever::alert('您还完成分享');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- $user = Dever::db('shop/user_coupon')->find(array('uid' => $uid, 'shop_coupon_id' => $data['id'], 'status' => 1));
|
|
|
+ # 验证是否已经领取,一周内不能再次领取
|
|
|
+ $user = Dever::db('shop/user_coupon')->getOne(array('uid' => $uid, 'coupon_id' => $data['id']));
|
|
|
|
|
|
- if ($user) {
|
|
|
+ if ($user && time() - $user['cdate'] < 86400*7) {
|
|
|
+ Dever::alert('您已领取过该优惠劵');
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -92,6 +97,7 @@ class Coupon
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ Dever::alert('领取失败');
|
|
|
return false;
|
|
|
}
|
|
|
|