心跳3秒,助理推送

master
DESKTOP-7R8JEQQ\k 2025-07-21 18:12:13 +08:00
parent f9f51384b4
commit 53c2085bfc
6 changed files with 43 additions and 2 deletions

View File

@ -18,6 +18,7 @@ GroupMgrEvent = {
OnNewApply = "OnNewApply", OnNewApply = "OnNewApply",
OnNewRecord = "OnNewRecord", OnNewRecord = "OnNewRecord",
OnMemberState = "OnMemberState", OnMemberState = "OnMemberState",
Onpush_assistant = "Onpush_assistant",
} }
GroupMgrController = { GroupMgrController = {
@ -57,6 +58,7 @@ function GroupMgrController.new()
self._eventmap[Protocol.FGMGR_EVT_DATA_CHATROOM] = self.FG_Data_ChatRoom self._eventmap[Protocol.FGMGR_EVT_DATA_CHATROOM] = self.FG_Data_ChatRoom
self._eventmap[Protocol.FGMGR_EVT_NEWCHAT] = self.FG_Data_NewChat self._eventmap[Protocol.FGMGR_EVT_NEWCHAT] = self.FG_Data_NewChat
self._eventmap[Protocol.FGMGR_EVT_Member_State] = self.FG_Data_Member_State self._eventmap[Protocol.FGMGR_EVT_Member_State] = self.FG_Data_Member_State
self._eventmap[Protocol.FGMGR_EVT_Push_Assistant] = self.OnEVT_Push_Assistant
-- self:connect(callback) -- self:connect(callback)
return self return self
end end
@ -389,6 +391,22 @@ function M:FG_ResponseInvited(evt_data)
DispatchEvent(self._dispatcher, GroupMgrEvent.InviteResponse, invite_id, g_name, roomid, pid, groupid) DispatchEvent(self._dispatcher, GroupMgrEvent.InviteResponse, invite_id, g_name, roomid, pid, groupid)
end end
-- 设置助理,来用给对面刷新界面 tagId=助理
function M:FG_Update_Assistant(groupId, tagId, callback)
local _data = {}
_data.id = groupId
_data.tagId = tagId
self._mgr_client:send(Protocol.FGMGR_EVT_Update_Assistant, _data, function(res)
callback(res)
end)
end
function M:OnEVT_Push_Assistant(evt_data)
print("收到助理刷新推送")
pt(evt_data)
DispatchEvent(self._dispatcher, GroupMgrEvent.Onpush_assistant, evt_data)
end
function M:FG_Isopen_ChatRoom(evt_data) function M:FG_Isopen_ChatRoom(evt_data)
print("收到是否开启聊天室推送") print("收到是否开启聊天室推送")
pt(evt_data) pt(evt_data)

View File

@ -403,6 +403,10 @@ Protocol = {
WEB_FG_SET_CANWATCH = "group/set_group_guest", WEB_FG_SET_CANWATCH = "group/set_group_guest",
-- 家族成员在线状态推送 -- 家族成员在线状态推送
FGMGR_EVT_Member_State = "13007", FGMGR_EVT_Member_State = "13007",
-- 设置助理,来用给对面刷新界面
FGMGR_EVT_Update_Assistant = "update_assistant",
-- 助理刷新界面推送
FGMGR_EVT_Push_Assistant = "push_assistant",
--end::::::::::::::牌友圈协议:::::::::::::::::::: --end::::::::::::::牌友圈协议::::::::::::::::::::
-------------------Game ---------------------------- -------------------Game ----------------------------

View File

@ -25,6 +25,7 @@ function FamilyEventView.new(root)
mgr_ctr:AddEventListener(GroupMgrEvent.ChatRoomData, handler(self, self._evtChatRoomData)) mgr_ctr:AddEventListener(GroupMgrEvent.ChatRoomData, handler(self, self._evtChatRoomData))
mgr_ctr:AddEventListener(GroupMgrEvent.OnNewApply, handler(self, self._evtOnNewApply)) mgr_ctr:AddEventListener(GroupMgrEvent.OnNewApply, handler(self, self._evtOnNewApply))
mgr_ctr:AddEventListener(GroupMgrEvent.OnNewRecord, handler(self, self._evtOnNewRecord)) mgr_ctr:AddEventListener(GroupMgrEvent.OnNewRecord, handler(self, self._evtOnNewRecord))
mgr_ctr:AddEventListener(GroupMgrEvent.Onpush_assistant, handler(self, self._evtOnPush_assistant))
--mgr_ctr:AddEventListener(GroupMgrEvent.OnMemberState, handler(self, self._evtOnMemberState)) --mgr_ctr:AddEventListener(GroupMgrEvent.OnMemberState, handler(self, self._evtOnMemberState))
return self return self
end end
@ -193,4 +194,13 @@ function M:_evtOnMemberState(...)
end end
end end
function M:_evtOnPush_assistant(...)
local view = ViewManager.GetCurrenView()
if view.class ~= "FamilyMainView" then
return
end
view:ChangeOther(tonumber(view._group.lev) + 1)
end
return M return M

View File

@ -60,7 +60,12 @@ function M:FillData()
local play = group:getPlay(self.pid) local play = group:getPlay(self.pid)
local player = group.memberMap[self.invite_id] local player = group.memberMap[self.invite_id]
print("lingmeng FillData", self.groupid, self.pid, self.invite_id, type(self.invite_id),player) if player == nil then
return
end
--print("lingmeng FillData", self.groupid, self.pid, self.invite_id, type(self.invite_id), type(self.groupid),player)
--pt(group.memberMap)
self._viewText_groupName.text = group.name self._viewText_groupName.text = group.name
self._viewText_gameName.text = play.game_name self._viewText_gameName.text = play.game_name

View File

@ -116,6 +116,10 @@ function M:init(url, lev, res)
flag_assistant = 1 - flag_assistant flag_assistant = 1 - flag_assistant
self._view:GetChild('btn_assistant'):GetController('isAssistant').selectedIndex = flag_assistant self._view:GetChild('btn_assistant'):GetController('isAssistant').selectedIndex = flag_assistant
self._callback_refren() self._callback_refren()
-- 让服务器推送
local mgr_ctr = ControllerManager.GetController(GroupMgrController)
mgr_ctr:FG_Update_Assistant(self.groupId, info.uid, function() end)
else else
ViewUtil.ShowOneChooose("设置助理失败") ViewUtil.ShowOneChooose("设置助理失败")
end end

View File

@ -677,7 +677,7 @@ function M:OnUpdate()
self:UpdateFamilyRoom(fgCtr, self._group.id) self:UpdateFamilyRoom(fgCtr, self._group.id)
end end
local HeartbeatTime = 30 local HeartbeatTime = 3
if newTime - self.lastTime > HeartbeatTime then if newTime - self.lastTime > HeartbeatTime then
fgCtr:FG_SetFamilyHeartbeat(self._group.id, DataManager.SelfUser.account_id, function(res) fgCtr:FG_SetFamilyHeartbeat(self._group.id, DataManager.SelfUser.account_id, function(res)
print(res) print(res)