bug修改同步 推送修改
This commit is contained in:
@@ -86,6 +86,7 @@ class BlindBoxTurntableGift extends Model
|
||||
}
|
||||
$room_name = Db::name('vs_room')->where(['id' => $room_id, 'apply_status' => 2])->value('room_name');
|
||||
$FromUserInfo = Db::name('user')->where(['id'=>$blind_box_turntable['user_id']])->find();
|
||||
$FromUserInfo['user_id'] = $FromUserInfo['id'];
|
||||
$FromUserInfo['icon'][0] = model('UserData')->user_wealth_icon($blind_box_turntable['user_id']);//财富图标
|
||||
$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);//聊天气泡
|
||||
@@ -175,9 +176,6 @@ class BlindBoxTurntableGift extends Model
|
||||
model('Chat')->sendMsg(1005,$room_id,$effectData);
|
||||
}
|
||||
}
|
||||
// 循环推送每个礼物的特效消息
|
||||
|
||||
|
||||
$roomtype = Db::name('vs_room')->where(['id' => $room_id])->value('type_id');
|
||||
if($roomtype == 6){
|
||||
//推送消息
|
||||
|
||||
@@ -45,19 +45,15 @@ class RoomPan
|
||||
$room_name = Db::name('vs_room')->where(['id' => $room_id, 'apply_status' => 2])->value('room_name');
|
||||
$FromUserInfo = Db::name('user')->where(['id'=>$v['user_id']])->find();
|
||||
$FromUserInfo['user_id'] = $FromUserInfo['id'];
|
||||
$FromUserInfo['icon'][0] = model('UserData')->user_wealth_icon($v['user_id']);//财富图标
|
||||
$FromUserInfo['icon'][1] = model('UserData')->user_charm_icon($v['user_id']);//魅力图标
|
||||
$FromUserInfo['icon'][0] = model('api/UserData')->user_wealth_icon($v['user_id']);//财富图标
|
||||
$FromUserInfo['icon'][1] = model('api/UserData')->user_charm_icon($v['user_id']);//魅力图标
|
||||
$FromUserInfo['chat_bubble'] = model('api/Decorate')->user_decorate_detail($v['user_id'],9);//聊天气泡
|
||||
$user_nickname = $FromUserInfo['nickname'];
|
||||
$textMessage = $user_nickname;
|
||||
$text_message = $user_nickname;
|
||||
$userGiftMap = [];
|
||||
foreach ($blind_box_turntable_results_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 = $text_message . '在' . $room_name . '房间送给了' . $ToUserInfo['nickname'] . $draw_gift['gift_name'] . 'X' . $value['count']."\n";
|
||||
$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[] = [
|
||||
'text' => $text_message,
|
||||
@@ -70,25 +66,73 @@ class RoomPan
|
||||
'number' => $value['count'],
|
||||
];
|
||||
}
|
||||
$ToUserInfosList[$value['gift_user_id']] = $ToUserInfo;
|
||||
|
||||
$userId = $value['gift_user_id'];
|
||||
if (!isset($userGiftMap[$userId])) {
|
||||
$userGiftMap[$userId] = [
|
||||
'userInfo' => $ToUserInfo,
|
||||
'gifts' => []
|
||||
];
|
||||
}
|
||||
$userGiftMap[$userId]['gifts'][] = [
|
||||
'gift_id' => $draw_gift['gid'],
|
||||
'gift_name' => $draw_gift['gift_name'],
|
||||
'count' => $value['count'],
|
||||
'play_image' => $draw_gift['play_image'],
|
||||
'base_image' => $draw_gift['base_image']
|
||||
];
|
||||
}
|
||||
foreach($ToUserInfosList as &$userInfo) {
|
||||
$userInfo['icon'][0] = model('UserData')->user_wealth_icon($userInfo['user_id']);//财富图标
|
||||
$userInfo['icon'][1] = model('UserData')->user_charm_icon($userInfo['user_id']);//魅力图标
|
||||
$userInfo['charm'] = db::name('vs_room_user_charm')->where(['user_id' => $userInfo['user_id'],'room_id' => $room_id])->value('charm');//魅力
|
||||
$ToUserInfos[] = $userInfo;
|
||||
|
||||
// 为每个用户单独推送消息
|
||||
foreach($userGiftMap as $userId => $userData) {
|
||||
$userInfo = $userData['userInfo'];
|
||||
$gifts = $userData['gifts'];
|
||||
|
||||
// 构建用户专属文本消息,接收者名字只出现一次
|
||||
$userTextMessage = $user_nickname . ' 送给 ' . $userInfo['nickname'];
|
||||
// 添加该用户收到的所有礼物
|
||||
$giftCount = [];
|
||||
foreach ($gifts as $gift) {
|
||||
$userTextMessage .= ' 盲盒转盘礼物 ' . $gift['gift_name'].' x ' .$gift['count'];
|
||||
// 统计相同礼物的数量
|
||||
$giftCount[] = [
|
||||
'gift_info' => $gift,
|
||||
'count' => $gift['count']
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
$userInfo['icon'][0] = model('api/UserData')->user_wealth_icon($userInfo['user_id']);
|
||||
$userInfo['icon'][1] = model('api/UserData')->user_charm_icon($userInfo['user_id']);
|
||||
$userInfo['charm'] = db::name('vs_room_user_charm')->where(['user_id' => $userInfo['user_id'],'room_id' => $room_id])->value('charm');
|
||||
|
||||
$userText = [
|
||||
'FromUserInfo' => $FromUserInfo,
|
||||
'ToUserInfo' => $userInfo,
|
||||
'GiftInfos' => array_values($gifts),
|
||||
'text' => $userTextMessage
|
||||
];
|
||||
|
||||
// 聊天室推送系统消息给每个用户
|
||||
model('api/Chat')->sendMsg(1038,$room_id,$userText);
|
||||
|
||||
foreach ($giftCount as $giftData) {
|
||||
$gift_inf = $giftData['gift_info'];
|
||||
$count = $giftData['count'];
|
||||
|
||||
// 推送礼物特效消息
|
||||
$effectData = [
|
||||
'FromUserInfo' => $FromUserInfo,
|
||||
'ToUserInfo' => $userInfo,
|
||||
'GiftInfo' => $gift_inf,
|
||||
'gift_num' => $count,
|
||||
'text' => null
|
||||
];
|
||||
|
||||
// 聊天室推送礼物特效消息
|
||||
model('api/Chat')->sendMsg(1005,$room_id,$effectData);
|
||||
}
|
||||
}
|
||||
$text = [
|
||||
'FromUserInfo' => $FromUserInfo,
|
||||
'ToUserInfos' => $ToUserInfos,
|
||||
'GiftInfo' => [
|
||||
'play_image' => implode(',',$play_image),
|
||||
'gift_name' => implode(',',$gift_names),
|
||||
],
|
||||
'text' => rtrim($textMessage, "\n")
|
||||
];
|
||||
//聊天室推送系统消息
|
||||
model('Chat')->sendMsg(1005,$room_id,$text);
|
||||
$roomtype = Db::name('vs_room')->where(['id' => $room_id])->value('type_id');
|
||||
if($roomtype == 6){
|
||||
//推送消息
|
||||
@@ -100,7 +144,7 @@ class RoomPan
|
||||
'text' => '房间心动值变化'
|
||||
];
|
||||
//聊天室推送系统消息
|
||||
model('Chat')->sendMsg(1028,$room_id,$text1);
|
||||
model('api/Chat')->sendMsg(1028,$room_id,$text1);
|
||||
}else{
|
||||
if(!empty($text_list_new)){
|
||||
//推送礼物横幅
|
||||
|
||||
Reference in New Issue
Block a user