diff --git a/application/api/model/BlindBoxTurntableGift.php b/application/api/model/BlindBoxTurntableGift.php index 067f850..dad2f15 100644 --- a/application/api/model/BlindBoxTurntableGift.php +++ b/application/api/model/BlindBoxTurntableGift.php @@ -628,88 +628,83 @@ class BlindBoxTurntableGift extends Model * 礼物特效播放 */ public function gift_send($send_id){ - 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]; - } - $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']; + $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'], - ]; - } - $ToUserInfosList[$value['gift_user_id']] = $ToUserInfo; + $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") + } + 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' => '房间心动值变化' ]; //聊天室推送系统消息 - 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); - } + 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]; } /* @@ -1166,7 +1161,7 @@ class BlindBoxTurntableGift extends Model } return [ 'activities_name' => $xlh_box['name'], - 'icon' => null, + 'ico' => null, 'xlh_status'=>$xlh_status, 'end_time'=>$xlh_data['end_time'] ?? 0, ]; diff --git a/application/api/model/DailyTasks.php b/application/api/model/DailyTasks.php index f1752b2..e148df2 100644 --- a/application/api/model/DailyTasks.php +++ b/application/api/model/DailyTasks.php @@ -135,13 +135,13 @@ class DailyTasks extends Model $v['processing_type'] = 2; $v['processing_type_str'] = $this->processing_type_str[$v['processing_type']]; //跳转的房间路径 - $v['from_id'] = db::name('vs_room')->where(['delete_time'=>0,'room_status'=>1,'type_id'=>['<>',6],'apply_status'=>2])->orderRaw('rand()')->value('id'); + $v['from_id'] = db::name('vs_room')->where(['delete_time'=>0,'room_status'=>1,'type_id'=>['<>',6]])->orderRaw('rand()')->value('id'); $v['target_quantity'] = $v['target_quantity'] * 60; $v['is_time'] = 1; }elseif(in_array($v['task_id'],[10])){ $v['processing_type'] = 7; $v['processing_type_str'] = $this->processing_type_str[$v['processing_type']]; - $v['from_id'] = db::name('vs_room')->where(['delete_time'=>0,'room_status'=>1,'type_id'=>['<>',6],'apply_status'=>2])->orderRaw('rand()')->value('id'); + $v['from_id'] = db::name('vs_room')->where(['delete_time'=>0,'room_status'=>1,'type_id'=>['<>',6]])->orderRaw('rand()')->value('id'); } else{ $v['processing_type'] = 9; $v['processing_type_str'] = $this->processing_type_str[$v['processing_type']]; diff --git a/application/api/model/Decorate.php b/application/api/model/Decorate.php index 878a129..e8c5ed8 100644 --- a/application/api/model/Decorate.php +++ b/application/api/model/Decorate.php @@ -16,7 +16,7 @@ class Decorate extends Model protected $createTime = 'createtime'; protected $updateTime = 'updatetime'; // 定义字段类型 1头像框 2坐骑 3麦圈 6个人靓号 7房间靓号 8公会靓号 - public $TypeArray = [1=>'头像框',2=>'坐骑',3=>'麦圈',6=>'个人靓号',7=>'房间靓号',8=>'公会靓号']; + public $TypeArray = [1=>'头像框',2=>'坐骑',6=>'个人靓号',7=>'房间靓号',8=>'公会靓号']; protected $FromType = [1=>'购买',2=>'后台赠送',3=>'礼盒开奖',4=>'好友赠送',5=>'首充赠送',6=>'天降好礼获得',7=>'财富等级特权赠送']; public function __construct($data = []) {