local Attention_Model = {} local private = {} local EventSystem = require('Event/EventSystem') local push_interface_opt_pb = require("Proto/push_interface_opt_pb") Attention_Model.OptType = { SetReceive = 1, -- 设置可领奖 Receive = 2, -- 领奖 } Attention_Model.AttentionState = { Initial = 0, -- 初始状态 CanReceive = 1, -- 可领奖状态 HasReceive = 2, -- 已领奖状态 } function Attention_Model.OnStartup() NetManager.RegisterMsgCB(MessageEnums.MessagePushInterfaceOpt, private.PushInterfaceOptResp) private.AttentionDic = {} -- 关注有礼 字典(K:pushId,V:状态 对应 Attention_Model.OptType) end function Attention_Model.SyncPushInterFaceInfo(pushInterFaceInfos) for _, v in ipairs(pushInterFaceInfos) do private.AttentionDic[v.pushId] = v.state end EventSystem.Dispatch(EventID.Attention_ShowRedPoint) end function Attention_Model.PushInterfaceOptReq(pushId, optType) local msg = push_interface_opt_pb.PushInterfaceOptReq() msg.pushId = pushId msg.optType = optType NetManager.SendMessage(MessageEnums.MessagePushInterfaceOpt, msg) end function private.PushInterfaceOptResp(msgResp) end function Attention_Model.GetAttentionState(pushId) return private.AttentionDic[pushId] end function Attention_Model.ShowAttentionTab(pushId) local info = private.AttentionDic[pushId] if info and info == Attention_Model.AttentionState.HasReceive then return false end return true end return Attention_Model