699 lines
25 KiB
PHP
699 lines
25 KiB
PHP
<?php
|
|
|
|
namespace app\common\controller;
|
|
|
|
use think\Loader;
|
|
|
|
class Push
|
|
{
|
|
const PUSH_POPULARITY = 5001;//推送房间-人气变化
|
|
const PUSH_RIDE = 5003;//推送房间-坐骑进场特效
|
|
const PUSH_NOBILITY = 5004;//推送房间-爵位用户进场特效
|
|
const PUSH_APPLY_COUNT = 5005;//推送房间-上麦申请人数变化
|
|
const PUSH_BANNED_USER = 5007;//推送房间-用户禁言 1禁言2解禁
|
|
const PUSH_CLOSE_PIT = 5011;//推送房间-是否封麦 1封麦2解封
|
|
const PUSH_CLEAR_CARDIAC = 5013;//推送房间-清空单个麦位心动值
|
|
const PUSH_CLEAR_CARDIAC_ALL = 5014;//推送房间-清空所有麦位心动值
|
|
const PUSH_SET_MANAGER = 5015;//推送房间-设置房间管理员
|
|
const PUSH_DELETE_MANAGER = 5016;//推送房间-删除房间管理员
|
|
const PUSH_SWITCH_VOICE = 5017;//推送房间-开关麦 1开0关
|
|
const PUSH_GIFT_BANNER = 5019;//推送所有人-横幅礼物通知
|
|
const PUSH_GIFT_CHAT_ROOM = 5020;//推送房间-聊天室礼物通知
|
|
const PUSH_FISH = 5021;//推送所有人-许愿池钓到大礼物时通知
|
|
const PUSH_ROOM_PASSWORD = 5022;//推送房间-房间密码变化通知 0取消密码1设置或修改密码
|
|
const PUSH_CARDIAC_SWITCH = 5023;//推送房间-房间心动值开关变化通知 1开2关
|
|
const PUSH_ROOM_WHEAT = 5024;//推送房间-上麦模式变化通知 1自由2排麦
|
|
const PUSH_UPDATE_ROOM_NAME = 5025;//推送房间-修改房间名称
|
|
const PUSH_WEEK_STAR = 5027;//推送房间-周星用户进场特效
|
|
const PUSH_UPDATE_ROOM_BACKGROUND = 5028;//推送房间-修改房间背景
|
|
const PUSH_UPDATE_ROOM_PLAYING = 5029;//推送房间-修改房间 玩法|公告
|
|
const PUSH_BOSS_ATTACK = 5030;//推送房间-BOSS大作战 超过99999金币 发送所有人消息
|
|
const PUSH_BOSS_BLOOD = 5031;//推送所有正在攻击boss的用户-boss大作战血量变化推送
|
|
const PUSH_PIT_ON = 5032;//推送房间-上麦
|
|
const PUSH_PIT_DOWN = 5033;//推送房间-下麦
|
|
const PUSH_KICK_OUT = 5034;//推送单独用户-被踢出房间
|
|
const PUSH_APPLY_USER = 5035;//推送单独用户-定向推向给上麦的用户
|
|
const PUSH_SHUT_UP = 5036;//推送房间-用户禁麦 1禁麦2解禁
|
|
const PUSH_JOIN_ROOM = 5037;//推送房间-用户进入房间
|
|
const PUSH_COUNT_DOWN = 5038;//推送房间-麦位倒计时
|
|
const PUSH_ROLL = 5039;//推送房间-扔骰子
|
|
const PUSH_FM_GOLD = 5040;//推送所有房间-电台房开通黄金守护
|
|
const PUSH_FACE = 5041;//推送房间-在麦上发送表情
|
|
const PUSH_ZEGO_LOG = 5042;//推送单独用户-上传即构日志
|
|
const PUSH_ROOM_CHAT_STATUS = 5043;//推送房间-公屏状态
|
|
const PUSH_BALL_START = 5044;//推送房间-球球大作战-开球
|
|
const PUSH_BALL_THROW = 5045;//推送房间-球球大作战-弃球
|
|
const PUSH_BALL_SHOW = 5046;//推送房间-球球大作战-亮球
|
|
const PUSH_SOUND_EFFECT_CHANGE = 5047;//推送房间-房间音效改变
|
|
const PUSH_ORDER_RECEIVE = 5048;//推送大神用户-有用户下单
|
|
const PUSH_ORDER_REFUND = 5049;//推送给大神-有用户要退款
|
|
const PUSH_ROOM_DEMAND_BOSS = 5050;//推送单独用户-推送给8号麦的老板
|
|
const PUSH_ROOM_DEMAND_UPDATE = 5051;//推送房间-更新派单需求
|
|
const PUSH_ROOM_DEMAND_TO_ANCHOR = 5052;//推送所有用户-将派单需求推送给所有符合条件的大神
|
|
const PUSH_ORDER_MESSAGE = 5053;//推送所有的订单消息(浮窗形式)
|
|
const PUSH_ROOM_OWNER_MODEL = 5054;//推送房间-更新房主模式
|
|
const PUSH_ROOM_QUIT = 5055;//推送房间-用户退出房间
|
|
const PUSH_ROOM_OWNER_JOIN = 5056;//推送房间-房主进入房间
|
|
const PUSH_LUCKYRANK = 5057;//推送房间-许愿池手气榜推送
|
|
const PUSH_GAME_TIPS = 5060;//房间游戏飘屏
|
|
const PUSH_CHANGE_HEARTBEAT = 5061;//推送房间-心动值变化
|
|
const PUSH_PIT_CHANGE = 5062;//推送房间-换麦位
|
|
const PUSH_PIT_JOIN_SMALL_ROOM = 5063;//推送单独用户-进小房间
|
|
const PUSH_PIT_OUT_SMALL_ROOM = 5064;//推送单独用户-退出小黑屋
|
|
const PUSH_FRIEND_STATUS = 5065;//推送房间-交友环节状态
|
|
const PUSH_ONLINE_DATING_NUM = 5066;//推送交友房在线对数发生变化
|
|
const PUSH_FRIEND_ADD_TIME = 5067;//推送房间-交友-心动连线环节 延时推送
|
|
const PUSH_SMALL_ROOM_ADD_TIME = 5068;//推送房间-送礼物增加时间
|
|
const PUSH_CHANGE_PIT = 5069;//自由上麦换麦
|
|
const PUSH_CHANGE_ROOM_LABEL = 5070;//推送房间类型发生变化
|
|
const PUSH_WISH_PROGRESS = 7001;//游戏进度
|
|
//推送系统消息
|
|
const PUSH_SYSTEM_MESSAGE = 7000;//推送系统消息
|
|
|
|
public $user_id, $room_id, $topic_room, $topic_client;
|
|
|
|
public function __construct($user_id = 0, $room_id = 0)
|
|
{
|
|
$this->user_id = $user_id;
|
|
$this->room_id = $room_id;
|
|
|
|
$this->topic_room = 'room_' . $this->room_id;
|
|
$this->topic_client = 'user_' . $this->user_id;
|
|
}
|
|
|
|
public function setUser($user_id)
|
|
{
|
|
$this->user_id = $user_id;
|
|
$this->topic_client = 'user_' . $user_id;
|
|
}
|
|
|
|
public function setRoom($room_id)
|
|
{
|
|
$this->room_id = $room_id;
|
|
$this->topic_room = 'room_' . $room_id;
|
|
}
|
|
|
|
private function push($push_type, $topic, $data = [])
|
|
{
|
|
Loader::import('Mqtt.Mqtt', EXTEND_PATH, '.php');
|
|
$mqtt = new \Mqtt();
|
|
$content = json_encode(
|
|
[
|
|
'type' => $push_type,
|
|
'time' => getMillisecond(),
|
|
'msg' => $data,
|
|
]
|
|
);
|
|
$mqtt->publishs($topic, $content);
|
|
}
|
|
/**
|
|
* 推送许愿池手气榜记录
|
|
*/
|
|
public function luckyRank($data)
|
|
{
|
|
$topic = 'room';
|
|
$this->push(self::PUSH_LUCKYRANK, $topic, $data);
|
|
return true;
|
|
}
|
|
|
|
//推送人气
|
|
public function updatePopularity($popularity)
|
|
{
|
|
$topic = '$delayed/1/' . $this->topic_room;
|
|
$data = ['popularity' => $popularity, 'room_id' => $this->room_id];
|
|
$this->push(self::PUSH_POPULARITY, $topic, $data);
|
|
}
|
|
|
|
//推送上麦
|
|
public function pitOn($pit_number, $data)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data['room_id'] = $this->room_id;
|
|
$data['pit_number'] = intval($pit_number);
|
|
|
|
$ball = S('room:user:ball:' . $this->room_id . ':' . $this->user_id);
|
|
$data['ball_state'] = $ball === false ? 0 : 1;
|
|
$this->push(self::PUSH_PIT_ON, $topic, $data);
|
|
}
|
|
|
|
//推送下麦
|
|
public function pitDown($down_info)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = ['room_id' => $this->room_id,
|
|
'pit_number' => intval($down_info['pit_number']),
|
|
'user_id' => intval($this->user_id),
|
|
'emchat_username'=>$down_info['emchat_username']];
|
|
$this->push(self::PUSH_PIT_DOWN, $topic, $data);
|
|
}
|
|
|
|
//带坐骑用户进场特效通知
|
|
public function ride($ride_info)
|
|
{
|
|
$topic = '$delayed/1/' . $this->topic_room;
|
|
$data = [
|
|
'room_id' => $this->room_id,
|
|
'ride_url' => $ride_info['special'],
|
|
'show_type' => $ride_info['show_type']
|
|
];
|
|
$this->push(self::PUSH_RIDE, $topic, $data);
|
|
}
|
|
|
|
//带爵位用户进场特效通知
|
|
public function nobility($data)
|
|
{
|
|
$topic = '$delayed/1/' . $this->topic_room;
|
|
if ($data['nobilityId'] == 6) {
|
|
$special = 'https://yutangyuyin.oss-cn-hangzhou.aliyuncs.com/nobility/' . $data['nobilityId'] . '.svga';
|
|
} else {
|
|
$special = '';
|
|
}
|
|
|
|
//爵位特效暂时不推
|
|
$special = '';
|
|
|
|
$data = [
|
|
'room_id' => $this->room_id,
|
|
'user_id' => $this->user_id,
|
|
'nobility_name' => $data['nobilityName'],
|
|
'nobility_id' => $data['nobilityId'],
|
|
'nobility_icon' => $data['nobility_icon'],
|
|
'avatar' => $data['headPicture'],
|
|
'nickname' => $data['userName'],
|
|
'special' => $special,
|
|
'sex' => $data['sex'],
|
|
];
|
|
$this->push(self::PUSH_NOBILITY, $topic, $data);
|
|
}
|
|
|
|
//上麦申请人数变化通知
|
|
public function applyCount($count, $user_ids = '')
|
|
{
|
|
$topic = $this->topic_room;
|
|
|
|
$count_8 = M('RoomPitApply')->where(['room_id' => $this->room_id, 'pit_number' => 8])->count();
|
|
$count_8 = $count_8 > 0 ? $count_8 : 0;
|
|
|
|
$total_count = $count - $count_8;
|
|
$data = [
|
|
'room_id' => $this->room_id,
|
|
'count' => $total_count > 0 ? $total_count : 0,
|
|
'count_8' => $count_8,
|
|
'user_ids' => $user_ids
|
|
];
|
|
$this->push(self::PUSH_APPLY_COUNT, $topic, $data);
|
|
}
|
|
|
|
//用户被禁言 action 1禁言2解禁
|
|
public function bannedUser($action)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = ['room_id' => $this->room_id, 'user_id' => $this->user_id, 'action' => $action];
|
|
$this->push(self::PUSH_BANNED_USER, $topic, $data);
|
|
}
|
|
|
|
//是否封麦 1.封麦 2.解除封麦
|
|
public function closePit($pit_number, $action)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = ['room_id' => $this->room_id, 'pit_number' => $pit_number, 'action' => $action];
|
|
$this->push(self::PUSH_CLOSE_PIT, $topic, $data);
|
|
}
|
|
|
|
//清空单个麦位心动值
|
|
public function clearCardiac($pit_number)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = ['room_id' => $this->room_id, 'pit_number' => $pit_number];
|
|
$this->push(self::PUSH_CLEAR_CARDIAC, $topic, $data);
|
|
}
|
|
|
|
//清空所有麦位心动值
|
|
public function clearCardiacAll()
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = ['room_id' => $this->room_id];
|
|
$this->push(self::PUSH_CLEAR_CARDIAC_ALL, $topic, $data);
|
|
}
|
|
|
|
//设置房间管理员
|
|
public function setManager()
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = ['room_id' => $this->room_id, 'user_id' => $this->user_id];
|
|
$this->push(self::PUSH_SET_MANAGER, $topic, $data);
|
|
}
|
|
|
|
//删除房间管理员
|
|
public function deleteManager()
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = ['room_id' => $this->room_id, 'user_id' => $this->user_id];
|
|
$this->push(self::PUSH_DELETE_MANAGER, $topic, $data);
|
|
}
|
|
|
|
//开关麦 action 1开0关
|
|
public function switchVoice($action, $pit_number = 0)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = [
|
|
'room_id' => $this->room_id,
|
|
'user_id' => $this->user_id,
|
|
'pit_number' => $pit_number,
|
|
'action' => $action
|
|
];
|
|
$this->push(self::PUSH_SWITCH_VOICE, $topic, $data);
|
|
}
|
|
|
|
|
|
|
|
|
|
// =======================================================================================================
|
|
// ========================================羽声使用开始=====================================================================
|
|
|
|
//横幅礼物通知
|
|
public function giftBanner($gift_list)
|
|
{
|
|
$topic = 'qx_room_topic';
|
|
$data = ['room_id' => $this->room_id, 'list' => $gift_list];
|
|
$this->push(self::PUSH_GIFT_BANNER, $topic, $data);
|
|
}
|
|
|
|
//系统消息
|
|
public function systemMessage($text_list)
|
|
{
|
|
$topic = 'system_message';
|
|
$data = ['list' => $text_list];
|
|
$this->push(self::PUSH_SYSTEM_MESSAGE, $topic, $data);
|
|
}
|
|
|
|
|
|
|
|
|
|
// =========================================羽声使用结束=====================================================
|
|
// =============================================================================================================
|
|
|
|
|
|
|
|
|
|
//聊天室礼物通知
|
|
public function giftChatRoom($gift_list, $cardiac, $contribution, $show_cat = 0)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = [
|
|
'room_id' => $this->room_id,
|
|
'gift_list' => $gift_list,
|
|
'cardiac_list' => $cardiac,
|
|
'contribution' => $contribution,
|
|
'show_cat' => $show_cat,
|
|
'user_id' => $this->user_id
|
|
];
|
|
$this->push(self::PUSH_GIFT_CHAT_ROOM, $topic, $data);
|
|
}
|
|
|
|
//自由上麦换麦通知
|
|
public function sendPitNumber($data)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = $data;
|
|
$this->push(self::PUSH_CHANGE_PIT, $topic, $data);
|
|
}
|
|
|
|
//聊天室心动值变化通知
|
|
public function heartChatRoom($heart)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data['list'] = $heart;
|
|
$data['room_id'] = $this->room_id;
|
|
$this->push(self::PUSH_CHANGE_HEARTBEAT, $topic, $data);
|
|
}
|
|
|
|
//推送房间-交友-心动连线环节 延时推送
|
|
public function friendDelayed($endtime)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = $endtime;
|
|
$this->push(self::PUSH_FRIEND_ADD_TIME, $topic, $data);
|
|
}
|
|
|
|
//私密小屋刷礼物后推送
|
|
public function heartSmallRoom($heart)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = $heart;
|
|
$this->push(self::PUSH_SMALL_ROOM_ADD_TIME, $topic, $data);
|
|
}
|
|
|
|
//聊天室排行榜通知
|
|
public function rankChatRoom($data_list)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data['list'] = $data_list;
|
|
$data['room_id'] = $this->room_id;
|
|
$this->push(self::PUSH_PIT_CHANGE, $topic, $data);
|
|
}
|
|
|
|
//进入小黑屋
|
|
//退出小黑屋
|
|
public function blackRoom($cp_room_id,$users,$action,$room_on_line_cp=0,$heart_id=0,$heart_value=0)
|
|
{
|
|
$topic = $this->topic_room;
|
|
if($action == 1){ //进入小黑屋
|
|
$data = ['room_id' => $this->room_id,'cp_room_id'=>$cp_room_id,'users' => $users,'room_on_line_cp' => $room_on_line_cp,'heart_id'=>$heart_id,'heart_value'=>$heart_value,'end_time'=>time()+600];
|
|
$this->push(self::PUSH_PIT_JOIN_SMALL_ROOM, $topic, $data);
|
|
}else{//退出小黑屋
|
|
$data = ['room_id' => $this->room_id,'pid_room_id'=>$cp_room_id,'users' => $users,'room_on_line_cp' => $room_on_line_cp,'heart_id'=>$heart_id,'heart_value'=>$heart_value];
|
|
$this->push(self::PUSH_PIT_OUT_SMALL_ROOM, $topic, $data);
|
|
}
|
|
}
|
|
|
|
//交由环节状态
|
|
public function stage($roomid,$stage,$end_time="")
|
|
{
|
|
$topic = $this->topic_room;
|
|
if($stage == 2) {
|
|
$data = ['room_id' => $roomid, 'status' => $stage,'end_time'=>$end_time];
|
|
}else{
|
|
$data = ['room_id' => $roomid, 'status' => $stage];
|
|
}
|
|
$this->push(self::PUSH_FRIEND_STATUS, $topic, $data);
|
|
}
|
|
|
|
//聊天室在线心动人数 PUSH_ONLINE_DATING_NUM
|
|
public function onlineDatingNum($room_id,$online_num)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = ['room_id' => $room_id, 'online_num' => $online_num];
|
|
$this->push(self::PUSH_ONLINE_DATING_NUM, $topic, $data);
|
|
}
|
|
|
|
//许愿池钓到大礼物时通知
|
|
public function fish($data, $user_info,$name)
|
|
{
|
|
$gift_list = $data['gift_list'];
|
|
$txt = "<font color='#FFFFFF'>哇塞</font><font color='#B9FF5E'>".$user_info['nickname']."</font><font color='#FFA7E7'>在{$name}中获得</font>";
|
|
$txt_extra = [];
|
|
foreach ($gift_list as $key => $value) {
|
|
if ($value['price'] >= C('WISH_PUSH_MONEY')) {
|
|
$txt_extra [] = [
|
|
'text' => $txt."<font color='#5AFDFF'>".$value['prize_title']."</font><font color='#FFFFFF'>X".$value['number']."</font>",
|
|
'picture' => $value['picture'],
|
|
];
|
|
}
|
|
}
|
|
if (!empty($txt_extra)) {
|
|
$topic = 'room';
|
|
$this->push(self::PUSH_FISH, $topic, $txt_extra);
|
|
}
|
|
}
|
|
|
|
//房间密码 0取消密码1设置或修改密码
|
|
public function roomPassword($action)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = ['room_id' => $this->room_id, 'action' => $action];
|
|
$this->push(self::PUSH_ROOM_PASSWORD, $topic, $data);
|
|
}
|
|
|
|
//房间心动值开关 1开2关
|
|
public function cardiacSwitch($action)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = ['room_id' => $this->room_id, 'action' => $action];
|
|
$this->push(self::PUSH_CARDIAC_SWITCH, $topic, $data);
|
|
}
|
|
|
|
//上麦模式变化 1自由2排麦
|
|
public function roomWheat($action)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = ['room_id' => $this->room_id, 'action' => $action];
|
|
$this->push(self::PUSH_ROOM_WHEAT, $topic, $data);
|
|
}
|
|
|
|
//修改房间名称
|
|
public function updateRoomName($room_name)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = ['room_id' => $this->room_id, 'room_name' => $room_name];
|
|
$this->push(self::PUSH_UPDATE_ROOM_NAME, $topic, $data);
|
|
}
|
|
|
|
//周星用户进场
|
|
public function weekStar($nickname, $rank)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = ['room_id' => $this->room_id, 'nickname' => $nickname, 'rank' => $rank];
|
|
$this->push(self::PUSH_WEEK_STAR, $topic, $data);
|
|
}
|
|
|
|
//修改房间背景
|
|
public function updateRoomBackground($background)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = ['room_id' => $this->room_id, 'background' => $background];
|
|
$this->push(self::PUSH_UPDATE_ROOM_BACKGROUND, $topic, $data);
|
|
}
|
|
|
|
//修改房间玩法|公告
|
|
public function updateRoomPlaying($playing, $greeting)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = ['room_id' => $this->room_id, 'playing' => $playing, 'greeting' => $greeting];
|
|
$this->push(self::PUSH_UPDATE_ROOM_PLAYING, $topic, $data);
|
|
}
|
|
|
|
//boss大作战 超过99999金币 发送所有人消息
|
|
|
|
public function AttackBoss($gift_list, $user_info)
|
|
{
|
|
$txt = "<font color='#FFFFFF'>哇塞</font><font color='#FD8469'>" . $user_info['nickname'] . "</font><font color='#FFFFFF'>在BOSS大作战中获得</font>";
|
|
$txt_extra = [];
|
|
foreach ($gift_list as $key => $value) {
|
|
if ($value['price'] >= 5200) {
|
|
$txt_extra [] = [
|
|
'text' => $txt."<font color='#FABA5C'>".$value['prize_title']."</font><font color='#FFFFFF'>X".$value['number']."</font>",
|
|
'picture' => $value['picture'],
|
|
];
|
|
}
|
|
}
|
|
if (!empty($txt_extra)) {
|
|
$topic = 'room';
|
|
$this->push(self::PUSH_BOSS_ATTACK, $topic, $txt_extra);
|
|
}
|
|
}
|
|
|
|
//boss大作战血量变化推送
|
|
public function bossBlood($left_blood = 0, $total_blood = 0, $gift_list = [], $user_info = [])
|
|
{
|
|
if ($gift_list) {
|
|
foreach ($gift_list as $key => $value) {
|
|
if ($value['price'] >= 520) {
|
|
$gift_list[$key]['nickname'] = $user_info['nickname'];
|
|
} else {
|
|
unset($gift_list[$key]);
|
|
}
|
|
}
|
|
}
|
|
$topic = 'boss';
|
|
$data = ['left_blood' => $left_blood, 'total_blood' => $total_blood, 'gift_list' => array_values($gift_list)];
|
|
$this->push(self::PUSH_BOSS_BLOOD, $topic, $data);
|
|
}
|
|
|
|
//定向推送给上麦的用户
|
|
public function agreeApplyUser($pit_number)
|
|
{
|
|
$topic = $this->topic_client;
|
|
$data = ['room_id' => $this->room_id, 'pit_number' => $pit_number];
|
|
$this->push(self::PUSH_APPLY_USER, $topic, $data);
|
|
}
|
|
|
|
//定向推送给被踢出房间的用户
|
|
public function kickOut()
|
|
{
|
|
$topic = $this->topic_client;
|
|
$data = ['room_id' => $this->room_id, 'user_id' => $this->user_id];
|
|
$this->push(self::PUSH_KICK_OUT, $topic, $data);
|
|
}
|
|
|
|
//用户禁麦 action 1禁麦2解禁
|
|
public function shutUp($action, $pit_number)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = [
|
|
'room_id' => $this->room_id,
|
|
'action' => $action,
|
|
'pit_number' => $pit_number,
|
|
'user_id' => $this->user_id
|
|
];
|
|
$this->push(self::PUSH_SHUT_UP, $topic, $data);
|
|
}
|
|
|
|
//用户进入房间
|
|
public function joinRoom($nickname, $rank_icon, $role, $user_is_new)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = [
|
|
'room_id' => $this->room_id,
|
|
'user_id' => $this->user_id,
|
|
'nickname' => $nickname,
|
|
'rank_icon' => $rank_icon,
|
|
'role' => $role,
|
|
'user_is_new' => $user_is_new
|
|
];
|
|
$this->push(self::PUSH_JOIN_ROOM, $topic, $data);
|
|
}
|
|
|
|
//麦位倒计时
|
|
public function countDown($pit_number, $seconds)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = ['room_id' => $this->room_id, 'pit_number' => $pit_number, 'seconds' => $seconds];
|
|
$this->push(self::PUSH_COUNT_DOWN, $topic, $data);
|
|
}
|
|
|
|
//扔骰子
|
|
public function roll($number, $pit_number)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = [
|
|
'room_id' => $this->room_id,
|
|
'user_id' => $this->user_id,
|
|
'number' => $number,
|
|
'pit_number' => $pit_number
|
|
];
|
|
$this->push(self::PUSH_ROLL, $topic, $data);
|
|
}
|
|
|
|
//电台房开通黄金守护
|
|
public function fmGold($nickname_from, $nickname_to)
|
|
{
|
|
$topic = 'room';
|
|
$data = ['room_id' => $this->room_id, 'nickname_from' => $nickname_from, 'nickname_to' => $nickname_to];
|
|
$this->push(self::PUSH_FM_GOLD, $topic, $data);
|
|
}
|
|
|
|
//发送表情
|
|
public function face($pit_number, $picture, $special)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = [
|
|
'room_id' => $this->room_id,
|
|
'pit_number' => $pit_number,
|
|
'picture' => $picture,
|
|
'special' => $special
|
|
];
|
|
$this->push(self::PUSH_FACE, $topic, $data);
|
|
}
|
|
|
|
//上传即构日志
|
|
public function zegoLog()
|
|
{
|
|
$topic = $this->topic_client;
|
|
$data = ['user_id' => $this->user_id];
|
|
$this->push(self::PUSH_ZEGO_LOG, $topic, $data);
|
|
}
|
|
|
|
//公屏状态
|
|
public function roomChatStatus($status)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = ['room_id' => $this->room_id, 'status' => $status];
|
|
$this->push(self::PUSH_ROOM_CHAT_STATUS, $topic, $data);
|
|
}
|
|
|
|
//球球大作战-开球
|
|
public function ballStart($pit_number)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = ['room_id' => $this->room_id, 'pit_number' => $pit_number];
|
|
$this->push(self::PUSH_BALL_START, $topic, $data);
|
|
}
|
|
|
|
//球球大作战-弃球
|
|
public function ballThrow($pit_number)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = ['room_id' => $this->room_id, 'pit_number' => $pit_number];
|
|
$this->push(self::PUSH_BALL_THROW, $topic, $data);
|
|
}
|
|
|
|
//球球大作战-亮球
|
|
public function ballShow($pit_number, $first, $second, $third)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = [
|
|
'room_id' => $this->room_id,
|
|
'pit_number' => $pit_number,
|
|
'first' => $first,
|
|
'second' => $second,
|
|
'third' => $third,
|
|
'user_id' => $this->user_id
|
|
];
|
|
$this->push(self::PUSH_BALL_SHOW, $topic, $data);
|
|
}
|
|
|
|
//房间音效改变
|
|
public function soundEffectChange($sound_effect_detail)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$data = [
|
|
'room_id' => $this->room_id,
|
|
'id' => $sound_effect_detail['id'],
|
|
'config' => $sound_effect_detail['config']
|
|
];
|
|
$this->push(self::PUSH_SOUND_EFFECT_CHANGE, $topic, $data);
|
|
}
|
|
|
|
//更新房主模式
|
|
public function ownerModel($data)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$this->push(self::PUSH_ROOM_OWNER_MODEL, $topic, $data);
|
|
}
|
|
|
|
//退出房间
|
|
public function quitRoom($data)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$this->push(self::PUSH_ROOM_QUIT, $topic, $data);
|
|
}
|
|
|
|
public function gamePush($data){
|
|
$topic = 'room';
|
|
$this->push(self::PUSH_GAME_TIPS, $topic, $data);
|
|
}
|
|
|
|
public function gameProgressPush($data){
|
|
$topic = 'room';
|
|
$this->push(self::PUSH_WISH_PROGRESS, $topic, $data);
|
|
}
|
|
|
|
//游戏达到大礼物时通知
|
|
public function game($giftInfo, $nickname,$title)
|
|
{
|
|
$txt = "<font color='#FFFFFF'>哇塞</font><font color='#FD8469'>".$nickname."</font><font color='#FFFFFF'>在{$title}中获得</font>";
|
|
$txt_extra = [];
|
|
foreach ($giftInfo as $key => $value) {
|
|
if ($value['price'] >= 5200) {
|
|
$txt_extra [] = [
|
|
'text' => $txt."<font color='#FABA5C'>".$value['prize_title']."</font><font color='#FFFFFF'>X".$value['number']."</font>",
|
|
'picture' => $value['picture']
|
|
];
|
|
}
|
|
}
|
|
if (!empty($txt_extra)) {
|
|
$topic = 'room';
|
|
$this->push(self::PUSH_FISH, $topic, $txt_extra);
|
|
}
|
|
|
|
}
|
|
|
|
//推送房间类型发生变化
|
|
public function roomTypeChange($data)
|
|
{
|
|
$topic = $this->topic_room;
|
|
$this->push(self::PUSH_CHANGE_ROOM_LABEL, $topic, $data);
|
|
}
|
|
|
|
} |