|
@@ -250,19 +250,24 @@ class UserService
|
|
$giftWhere['id'] = $inviteGift;
|
|
$giftWhere['id'] = $inviteGift;
|
|
$gift = model('Gift')->where($giftWhere)->find();
|
|
$gift = model('Gift')->where($giftWhere)->find();
|
|
if (!empty($gift) && $inviteGiftNum > 0) {
|
|
if (!empty($gift) && $inviteGiftNum > 0) {
|
|
- $giftBack = [
|
|
+ $userGiftBackWhere['user_id'] = $preUser['id'];
|
|
- 'user_id' => $preUser['id'],
|
|
+ $userGiftBackWhere['get_way'] = 5;
|
|
- 'gift_id' => $inviteGift,
|
|
+ $userGiftBack = model('GiftBack')->where($userGiftBackWhere)->find();
|
|
- 'name' => $gift['name'],
|
|
+ if (empty($userGiftBack)) {
|
|
- 'image' => $gift['image'],
|
|
+ $giftBack = [
|
|
- 'gif_image' => $gift['special'],
|
|
+ 'user_id' => $preUser['id'],
|
|
- 'value' => $gift['value'],
|
|
+ 'gift_id' => $inviteGift,
|
|
- 'number' => $inviteGiftNum,
|
|
+ 'name' => $gift['name'],
|
|
- 'get_way' => 5,
|
|
+ 'image' => $gift['image'],
|
|
- ];
|
|
+ 'gif_image' => $gift['special'],
|
|
- $giftBackRes = model('GiftBack')->insertGetId($giftBack);
|
|
+ 'value' => $gift['value'],
|
|
- if (!$giftBackRes) {
|
|
+ 'number' => $inviteGiftNum,
|
|
- throw new Exception('赠送礼物失败');
|
|
+ 'get_way' => 5,
|
|
|
|
+ ];
|
|
|
|
+ $giftBackRes = model('GiftBack')->insertGetId($giftBack);
|
|
|
|
+ if (!$giftBackRes) {
|
|
|
|
+ throw new Exception('赠送礼物失败');
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|