错误屏蔽
This commit is contained in:
@@ -628,83 +628,88 @@ class BlindBoxTurntableGift extends Model
|
||||
* 礼物特效播放
|
||||
*/
|
||||
public function gift_send($send_id){
|
||||
$blind_box_turntable = db('vs_blind_box_turntable_log')->where(['id'=>$send_id,'is_sued'=>0])->find();
|
||||
if(!$blind_box_turntable){
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => null];
|
||||
}
|
||||
$room_id = $blind_box_turntable['room_id'];
|
||||
$blind_box_turntable_log = db('vs_blind_box_turntable_results_log')->where(['tid'=>$send_id])->select();
|
||||
if(!$blind_box_turntable_log){
|
||||
return ['code' => 0, 'msg' => '数据不存在','data' => null];
|
||||
}
|
||||
$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['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']);//魅力图标
|
||||
$user_nickname = $FromUserInfo['nickname'];
|
||||
$textMessage = $user_nickname;
|
||||
$text_message = [];
|
||||
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[] = [
|
||||
'text' => $text_message,
|
||||
'gift_picture' => $draw_gift['base_image'],
|
||||
'room_id' => $room_id,
|
||||
'fromUserName' => $FromUserInfo['nickname'],
|
||||
'toUserName' => $ToUserInfo['nickname'],
|
||||
'giftName' => $draw_gift['gift_name'],
|
||||
'roomId' => $room_id,
|
||||
'number' => $value['count'],
|
||||
];
|
||||
try{
|
||||
$blind_box_turntable = db('vs_blind_box_turntable_log')->where(['id'=>$send_id,'is_sued'=>0])->find();
|
||||
if(!$blind_box_turntable){
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => null];
|
||||
}
|
||||
$ToUserInfosList[$value['gift_user_id']] = $ToUserInfo;
|
||||
$room_id = $blind_box_turntable['room_id'];
|
||||
$blind_box_turntable_log = db('vs_blind_box_turntable_results_log')->where(['tid'=>$send_id])->select();
|
||||
if(!$blind_box_turntable_log){
|
||||
return ['code' => 0, 'msg' => '数据不存在','data' => null];
|
||||
}
|
||||
$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['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']);//魅力图标
|
||||
$user_nickname = $FromUserInfo['nickname'];
|
||||
$textMessage = $user_nickname;
|
||||
$text_message = [];
|
||||
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'];
|
||||
|
||||
}
|
||||
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;
|
||||
}
|
||||
$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){
|
||||
//推送消息
|
||||
$hot_value = db::name('vs_give_gift')->where('from_id', $room_id)->where('from',6)
|
||||
->sum('total_price');
|
||||
$text1 = [
|
||||
'room_id' => $room_id,
|
||||
'hot_value' => $hot_value * 10,
|
||||
'text' => '房间心动值变化'
|
||||
$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,
|
||||
'gift_picture' => $draw_gift['base_image'],
|
||||
'room_id' => $room_id,
|
||||
'fromUserName' => $FromUserInfo['nickname'],
|
||||
'toUserName' => $ToUserInfo['nickname'],
|
||||
'giftName' => $draw_gift['gift_name'],
|
||||
'roomId' => $room_id,
|
||||
'number' => $value['count'],
|
||||
];
|
||||
}
|
||||
$ToUserInfosList[$value['gift_user_id']] = $ToUserInfo;
|
||||
|
||||
}
|
||||
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;
|
||||
}
|
||||
$text = [
|
||||
'FromUserInfo' => $FromUserInfo,
|
||||
'ToUserInfos' => $ToUserInfos,
|
||||
'GiftInfo' => [
|
||||
'play_image' => implode(',',$play_image),
|
||||
'gift_name' => implode(',',$gift_names),
|
||||
],
|
||||
'text' => rtrim($textMessage, "\n")
|
||||
];
|
||||
//聊天室推送系统消息
|
||||
model('Chat')->sendMsg(1028,$room_id,$text1);
|
||||
}else{
|
||||
if(!empty($text_list_new)){
|
||||
//推送礼物横幅
|
||||
$push = new Push($blind_box_turntable['user_id'], $room_id);
|
||||
$push->giftBanner($text_list_new);
|
||||
model('Chat')->sendMsg(1005,$room_id,$text);
|
||||
$roomtype = Db::name('vs_room')->where(['id' => $room_id])->value('type_id');
|
||||
if($roomtype == 6){
|
||||
//推送消息
|
||||
$hot_value = db::name('vs_give_gift')->where('from_id', $room_id)->where('from',6)
|
||||
->sum('total_price');
|
||||
$text1 = [
|
||||
'room_id' => $room_id,
|
||||
'hot_value' => $hot_value * 10,
|
||||
'text' => '房间心动值变化'
|
||||
];
|
||||
//聊天室推送系统消息
|
||||
model('Chat')->sendMsg(1028,$room_id,$text1);
|
||||
}else{
|
||||
if(!empty($text_list_new)){
|
||||
//推送礼物横幅
|
||||
$push = new Push($blind_box_turntable['user_id'], $room_id);
|
||||
$push->giftBanner($text_list_new);
|
||||
}
|
||||
}
|
||||
db::name('vs_blind_box_turntable_log')->where('id', $send_id)->update(['is_sued' => 1, 'updatetime' => time()]);
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => null];
|
||||
} catch (\Exception $e) {
|
||||
return ['code' => 0, 'msg' => "网络请求错误,请重试!", 'data' => null];
|
||||
}
|
||||
db::name('vs_blind_box_turntable_log')->where('id', $send_id)->update(['is_sued' => 1, 'updatetime' => time()]);
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => null];
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1161,7 +1166,7 @@ class BlindBoxTurntableGift extends Model
|
||||
}
|
||||
return [
|
||||
'activities_name' => $xlh_box['name'],
|
||||
'ico' => null,
|
||||
'icon' => null,
|
||||
'xlh_status'=>$xlh_status,
|
||||
'end_time'=>$xlh_data['end_time'] ?? 0,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user