hengyang_client/lua_probject/base_project/Game/View/Family/FamilyMsgDiamond.lua

65 lines
2.0 KiB
Lua
Raw Permalink Normal View History

2025-09-08 20:54:23 +08:00
local FamilyMsgDiamond = {}
local M = FamilyMsgDiamond
--类型字段1为进入游戏预扣2为结束游戏返还
2025-11-06 17:37:53 +08:00
local TypeTable = { "亲友圈开局游戏预扣", "因游戏结束返还您", "您为亲友圈充值" }
2025-09-08 20:54:23 +08:00
function M.New(data, callback)
setmetatable(M, { __index = BaseWindow })
local self = setmetatable({}, { __index = M })
self._full = true
self.class = "com_FamilyMsgRecord"
2025-09-09 14:58:47 +08:00
BaseWindow.init(self, 'ui://Family/com_FamilyMsgDiamond')
2025-09-08 20:54:23 +08:00
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)
2025-11-06 17:37:53 +08:00
ViewUtil.ShowModalWait2()
2025-09-08 20:54:23 +08:00
fgCtr:FG_Get_Diamond_Msg(self.data.groupId, function(res)
2025-11-06 17:37:53 +08:00
ViewUtil.CloseModalWait2()
2025-09-08 20:54:23 +08:00
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)
2025-11-08 13:40:27 +08:00
local data = self.msgData[index + 1]
local type = data.diamo_type
obj:GetChild('tex_time').text = os.date("%Y-%m-%d %H:%M:%S", math.floor(data.m_time / 1000))
if type == 2 and data.user_nick and #data.user_nick > 0 then
obj:GetChild('tex_msg').text = string.format("【%s(%s)】用户为亲友圈充值%d房卡剩余%d房卡", data.user_nick, data.uid,
data.diamo_num, data.diamo_cur)
else
obj:GetChild('tex_msg').text = string.format("%s%d房卡剩余%d房卡", TypeTable[data.diamo_type + 1],
data.diamo_num, data.diamo_cur)
end
2025-09-08 20:54:23 +08:00
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