diff --git a/application/api/model/BlindBoxTurntableGift.php b/application/api/model/BlindBoxTurntableGift.php index 826db1c..0987cd7 100644 --- a/application/api/model/BlindBoxTurntableGift.php +++ b/application/api/model/BlindBoxTurntableGift.php @@ -90,19 +90,10 @@ class BlindBoxTurntableGift extends Model $FromUserInfo['icon'][1] = model('UserData')->user_charm_icon($blind_box_turntable['user_id']);//魅力图标 $FromUserInfo['chat_bubble'] = model('Decorate')->user_decorate_detail($blind_box_turntable['user_id'],9);//聊天气泡 $user_nickname = $FromUserInfo['nickname']; - $textMessage = $user_nickname; - $text_message = []; - $ToUserInfosList = []; - $ToUserInfos = []; - $play_image = []; - $gift_names = []; + $userGiftMap = []; foreach ($blind_box_turntable_log as $key => $value) { $ToUserInfo = Db::name('user')->where(['id' => $value['gift_user_id']])->field('id as user_id,nickname,avatar,sex')->find(); $draw_gift = Db::name('vs_gift')->where(['gid'=>$value['gift_id']])->find(); - $textMessage = $textMessage . ' 送给 ' . $ToUserInfo['nickname']. ' 盲盒转盘礼物 ' . $draw_gift['gift_name'].' x ' .$value['count']."\n"; - $play_image[] = $draw_gift['play_image']; - $gift_names[] = $draw_gift['gift_name']; - $text_message = $user_nickname . '在' . $room_name . '房间送给了' . $ToUserInfo['nickname'] . $draw_gift['gift_name'] . 'X' . $value['count']."\n"; if($draw_gift['is_public_server'] == 1) { $text_list_new[] = [ @@ -116,25 +107,18 @@ class BlindBoxTurntableGift extends Model 'number' => $value['count'], ]; } - $ToUserInfosList[$value['gift_user_id']] = $ToUserInfo; - } - // 按用户分组礼物信息 - $userGiftMap = []; - foreach ($blind_box_turntable_log as $value) { $userId = $value['gift_user_id']; if (!isset($userGiftMap[$userId])) { $userGiftMap[$userId] = [ - 'userInfo' => Db::name('user')->where(['id' => $userId])->field('id as user_id,nickname,avatar,sex')->find(), + 'userInfo' => $ToUserInfo, 'gifts' => [] ]; } - - $gift = Db::name('vs_gift')->where(['gid'=>$value['gift_id']])->find(); $userGiftMap[$userId]['gifts'][] = [ - 'gift_name' => $gift['gift_name'], + 'gift_name' => $draw_gift['gift_name'], 'count' => $value['count'], - 'play_image' => $gift['play_image'] + 'play_image' => $draw_gift['play_image'] ]; }