local FamilyMsgDiamond = {} local M = FamilyMsgDiamond --类型字段,1为进入游戏预扣,2为结束游戏返还 local TypeTable = { "亲友圈开局游戏预扣", "因游戏结束返还您" } function M.New(data, callback) setmetatable(M, { __index = BaseWindow }) local self = setmetatable({}, { __index = M }) self._full = true self.class = "com_FamilyMsgRecord" BaseWindow.init(self, 'ui://Family/com_FamilyMsgRecord') self.data = data self:Init() self.closeCallback = callback return self end function M:Init() local list_msg = self._view:GetChild('list_msg') list_msg.itemRenderer = function(index, obj) self:msgRenderer(index, obj) end local fgCtr = ControllerManager.GetController(NewGroupController) fgCtr:FG_Get_Diamond_Msg(self.data.groupId, function(res) if res.ReturnCode ~= 0 then ViewUtil.ErrorTip(res.ReturnCode, "获取房卡记录失败") else self.msgData = res.Data.messages list_msg.numItems = #self.msgData end end) end function M:msgRenderer(index, obj) local data = self.msgData obj:GetChild('tex_time').text = os.date("%Y-%m-%d %H:%M:%S", math.floor(data[index + 1].m_time / 1000)) obj:GetChild('tex_msg').text = string.format("%s%d房卡,剩余%d房卡", TypeTable[data[index + 1].diamo_type + 1], data[index + 1].diamo_num, data[index + 1].diamo_cur) end function M:Show(groupId) getmetatable(M).__index.Show(self) end function M:Close() if self.closeCallback then self.closeCallback() end getmetatable(M).__index.Close(self) end return M