|
@@ -254,18 +254,21 @@ class UserService
|
|
|
$userGiftBackWhere['get_way'] = 5;
|
|
|
$userGiftBack = model('GiftBack')->where($userGiftBackWhere)->find();
|
|
|
if (empty($userGiftBack)) {
|
|
|
- $giftBack = [
|
|
|
- 'user_id' => $preUser['id'],
|
|
|
- 'gift_id' => $inviteGift,
|
|
|
- 'name' => $gift['name'],
|
|
|
- 'image' => $gift['image'],
|
|
|
- 'gif_image' => $gift['special'],
|
|
|
- 'value' => $gift['value'],
|
|
|
- 'number' => $inviteGiftNum,
|
|
|
- 'get_way' => 5,
|
|
|
- 'createtime' => time(),
|
|
|
- ];
|
|
|
- $giftBackRes = model('GiftBack')->insertGetId($giftBack);
|
|
|
+ for($i=1;$i<=$inviteGiftNum;$i++) {
|
|
|
+ $giftBack[] = [
|
|
|
+ 'user_id' => $preUser['id'],
|
|
|
+ 'gift_id' => $inviteGift,
|
|
|
+ 'name' => $gift['name'],
|
|
|
+ 'image' => $gift['image'],
|
|
|
+ 'gif_image' => $gift['special'],
|
|
|
+ 'value' => $gift['value'],
|
|
|
+ 'number' => 1,
|
|
|
+ 'get_way' => 5,
|
|
|
+ 'createtime' => time(),
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ $giftBackRes = model('GiftBack')->insertAll($giftBack);
|
|
|
if (!$giftBackRes) {
|
|
|
throw new Exception('赠送礼物失败');
|
|
|
}
|