|
@@ -244,6 +244,28 @@ class UserService
|
|
|
throw new Exception($res['msg']);
|
|
|
}
|
|
|
}
|
|
|
+ $inviteGift = config('site.invite_gift');
|
|
|
+ if ($inviteGift > 0) {
|
|
|
+ $inviteGiftNum = config('site.invite_gift_num');
|
|
|
+ $giftWhere['id'] = $inviteGift;
|
|
|
+ $gift = model('Gift')->where($giftWhere)->find();
|
|
|
+ if (!empty($gift) && $inviteGiftNum > 0) {
|
|
|
+ $giftBack = [
|
|
|
+ 'user_id' => $userId,
|
|
|
+ 'gift_id' => $inviteGift,
|
|
|
+ 'name' => $gift['name'],
|
|
|
+ 'image' => $gift['image'],
|
|
|
+ 'gif_image' => $gift['special'],
|
|
|
+ 'value' => $gift['value'],
|
|
|
+ 'number' => $inviteGiftNum,
|
|
|
+ 'get_way' => 5,
|
|
|
+ ];
|
|
|
+ $giftBackRes = model()->insertGetId($giftBack);
|
|
|
+ if (!$giftBackRes) {
|
|
|
+ throw new Exception('赠送礼物失败');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|