yunque9/lua_probject/base_project/Game/View/NewGroup/MngView/GroupMemberFagLogView.lua

333 lines
12 KiB
Lua
Raw Normal View History

2025-05-24 14:29:14 +08:00
-- 牌友圈成员体力值记录
local TimeSettingPanel = import("Game.View.NewGroup.MngView.TimeSettingPanelTog")
2025-05-24 14:29:14 +08:00
local GroupMemberFagLogView = {}
local M = GroupMemberFagLogView
function GroupMemberFagLogView.new(group_id, member, not_manager)
setmetatable(M, { __index = BaseWindow })
local self = setmetatable({}, { __index = M })
2025-05-24 14:29:14 +08:00
self.class = "GroupMemberFagLogView"
self._close_destroy = true
-- self._blur_view = blur_view
self.member = member
self.nick = nick
2025-06-14 17:44:40 +08:00
-- self._full = true
2025-05-24 14:29:14 +08:00
self._animation = false
self.group_id = group_id
self.hp_log = {}
2025-05-24 14:29:14 +08:00
self.daily_count = {}
self.not_manager = not_manager
2025-06-14 17:44:40 +08:00
-- self._full = true
2025-05-24 14:29:14 +08:00
self.m_index = 0
self:init("ui://NewGroup/Win_MemberFagLog")
return self
end
function M:init(url)
BaseWindow.init(self, url)
2025-05-24 14:29:14 +08:00
local btn_close = self._view:GetChild("btn_close")
btn_close.onClick:Set(function()
self:Destroy()
end)
2025-06-14 20:40:16 +08:00
2025-05-24 14:29:14 +08:00
for i = 1, 8 do
local tem = math.pow(2, i - 1)
local btn_filter = self._view:GetChild("btn_filter" .. tem)
if btn_filter then
btn_filter.onClick:Set(function()
self.hp_log = {}
2025-05-24 14:29:14 +08:00
self.m_index = 0
self.lst_fag.numItems = 0
self:GetData(0)
end)
end
2025-05-24 14:29:14 +08:00
end
2025-06-14 17:44:40 +08:00
self._view:GetChild('btn_all').onClick:Set(function()
self:GetData(0)
end)
2025-05-24 14:29:14 +08:00
self.lst_fag = self._view:GetChild("lst_fag")
self.lst_fag:SetVirtual()
2025-05-24 14:29:14 +08:00
self.lst_fag.itemRenderer = function(index, obj)
self:OnRenderItem(index, obj)
end
2025-05-24 14:29:14 +08:00
self.lst_fag.scrollPane.onPullUpRelease:Set(function()
self:GetData(self.lst_fag.numItems + self.m_index)
2025-05-24 14:29:14 +08:00
end)
if not self.not_manager then
self._view:GetController("manager").selectedIndex = 1
else
self._view:GetChild("btn_filter1").selected = false
self._view:GetChild("btn_filter8").selected = false
self._view:GetChild("btn_filter16").selected = false
end
self.lst_daily_count = self._view:GetChild("lst_daily_count")
self.lst_daily_count:SetVirtual()
self.lst_daily_count.itemRenderer = function(index, obj)
self:OnRenderDailyItem(index, obj)
end
2025-05-24 14:29:14 +08:00
self.ctr_index = self._view:GetController("index")
self.ctr_index.onChanged:Set(function()
if self.ctr_index.selectedIndex == 1 then
self:GetDailyData()
end
end)
self.time_panel = TimeSettingPanel.new(self._view, self._view:GetChild("btn_date1"), self._view:GetChild("btn_date2"),
-308, 0, function()
self.hp_log = {}
self.lst_fag.numItems = 0
self.m_index = 0
self.begin_time, self.end_time = self.time_panel:GetDate()
self:GetData(0)
end)
2025-05-24 14:29:14 +08:00
self.begin_time, self.end_time = self.time_panel:GetDate()
self:GetData(0)
end
-- 获取过滤值,根据多选框计算
function M:GetFilter()
local filter = 0
2025-06-14 20:40:16 +08:00
local btn_all = self._view:GetChild('btn_all')
2025-05-24 14:29:14 +08:00
for i = 1, 8 do
local tem = math.pow(2, i - 1)
2025-05-24 14:29:14 +08:00
--print("aaaaaaaaaaaaaaaaaaaaaaaa ",tem)
local btn_filter = self._view:GetChild("btn_filter" .. tem)
if btn_filter and btn_filter.selected then
filter = filter + tem
end
2025-05-24 14:29:14 +08:00
end
2025-06-17 21:30:34 +08:00
return btn_all.selected and 1 or filter
2025-05-24 14:29:14 +08:00
end
-- 显示原因文本
local function __getReason(data)
-- return "玩家操作"
2025-05-24 14:29:14 +08:00
local s_nick = string.utf8sub(data.m_nick, 6)
if data.reason == 6 then
return data.info
elseif data.reason == 7 then
2025-06-27 03:16:36 +08:00
return string.format("房卡(%s)", data.roomid)
2025-05-24 14:29:14 +08:00
elseif data.reason == 8 then
return string.format("[color=#FF6600]%s[/color](%s) %s", s_nick, data.mgr_id, "操作增加")
elseif data.reason == 9 then
return string.format("[color=#FF6600]%s[/color](%s) %s", s_nick, data.mgr_id, "操作减少")
-- return "退出圈子"
elseif data.reason == 10 then
return string.format("[color=#FF6600]%s[/color](%s) %s", s_nick, data.mgr_id, "操作增加")
elseif data.reason == 11 then
return string.format("[color=#FF6600]%s[/color](%s) %s", s_nick, data.mgr_id, "操作减少")
-- return "每日提取"
elseif data.reason == 12 then
return "推广奖励"
2025-05-24 14:29:14 +08:00
elseif data.reason == 13 then
if data.hp < 0 then
return string.format("转账给 [color=#FF6600]%s(%s)[/color]", s_nick, data.mgr_id)
else
return string.format("收到 [color=#FF6600]%s(%s)[/color] 转账", s_nick, data.mgr_id)
end
elseif data.reason == 14 then
2025-05-24 14:29:14 +08:00
return "提取能量包"
elseif data.reason == 15 then
return ""
elseif data.reason == 20 then
return "洗牌"
elseif data.reason == 21 then
return "洗牌奖励"
elseif data.reason == 22 then
return "暗抽奖励"
elseif data.reason == 23 then
return string.format("系统衰减ac(%s)", data.roomid)
--return "管理费"
end
end
-- 获取体力值详情数据
function M:GetData(index)
local filter = self:GetFilter()
if filter == 0 then return end
ViewUtil.ShowModalWait()
2025-05-24 14:29:14 +08:00
local fgCtr = ControllerManager.GetController(NewGroupController)
fgCtr:FG_GetMemberHpLog(self.group_id, self.member.uid, index, 6, filter, self.begin_time, self.end_time,
function(res)
if self._is_destroy then
return
2025-05-24 14:29:14 +08:00
end
ViewUtil.CloseModalWait()
if res.ReturnCode ~= 0 then
ViewUtil.ErrorTip(res.ReturnCode, "获取积分详情失败")
else
local data = res.Data.hp_logs
if #data == 0 then return end
-- print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
-- pt(data)
-- pt(self.member)
for i = 1, #data do
self.hp_log[#self.hp_log + 1] = data[i]
end
--self:GuoLv(data)
2025-05-24 14:29:14 +08:00
self.lst_fag.numItems = #self.hp_log
end
end)
2025-05-24 14:29:14 +08:00
end
function M:GuoLv(data)
if self.member.lev == 1 then
2025-05-24 14:29:14 +08:00
local m_data_other = {}
local m_data_my = {}
for i = 1, #data do
2025-05-24 14:29:14 +08:00
if self.member.uid ~= data[i].mgr_id then
table.insert(m_data_other, data[i])
2025-05-24 14:29:14 +08:00
else
table.insert(m_data_my, data[i])
2025-05-24 14:29:14 +08:00
end
end
-- printlog("比较计算=========m_data_my>>>",#m_data_my)
-- printlog("比较计算=========m_data_other>>>",#m_data_other)
if #m_data_my > 0 and #m_data_other == 0 then
2025-05-24 14:29:14 +08:00
for i = 1, #m_data_my do
self.hp_log[#self.hp_log + 1] = m_data_my[i]
2025-05-24 14:29:14 +08:00
end
self.m_index = #data - #m_data_my + self.m_index
else
for i = 1, #m_data_other do
self.hp_log[#self.hp_log + 1] = m_data_other[i]
2025-05-24 14:29:14 +08:00
end
self.m_index = #data - #m_data_other + self.m_index
end
2025-05-24 14:29:14 +08:00
else
local m_data_other = {}
local m_data_my = {}
for i = 1, #data do
2025-05-24 14:29:14 +08:00
if self.member.uid ~= data[i].mgr_id then
table.insert(m_data_other, data[i])
2025-05-24 14:29:14 +08:00
end
end
-- printlog("比较计算11=========m_data_my>>>",#m_data_my)
-- printlog("比较计算11=========m_data_other>>>",#m_data_other)
2025-05-24 14:29:14 +08:00
for i = 1, #m_data_other do
self.hp_log[#self.hp_log + 1] = m_data_other[i]
end
self.m_index = #data - #m_data_other + self.m_index
end
end
local function fillItem(data, obj)
local num = d2ad(data.hp)
obj:GetChild("tex_num").text = num >= 0 and ('+' .. num) or num
obj:GetChild("tex_time").text = os.date("%Y-%m-%d\n%H:%M", data.time)
obj:GetChild("tex_reason").text = __getReason(data)
2025-05-24 14:29:14 +08:00
end
-- 填充体力值详情对象
function M:OnRenderItem(index, obj)
local data = self.hp_log[index + 1]
2025-07-07 15:47:37 +08:00
-- print("lingmeng render", self.group_id, data.pid, DataManager.groups:get(self.group_id),
-- DataManager.groups:get(self.group_id):getPlay(data.pid))
-- pt(DataManager.groups:get(self.group_id).playList)
local play = DataManager.groups:get(self.group_id):getPlay(data.pid)
2025-05-24 14:29:14 +08:00
obj:GetChild("tex_name").text = ViewUtil.stringEllipsis(self.member.nick)
obj:GetChild("tex_id").text = string.format("ID:%s", ViewUtil.stringEllipsis(self.member.uid))
2025-05-24 14:29:14 +08:00
local num = d2ad(data.hp)
obj:GetChild("tex_num").text = num >= 0 and ('+' .. num) or num
obj:GetController("add").selectedIndex = num >= 0 and 1 or 0
obj:GetChild("tex_fag").text = d2ad(data.cur_hp)
obj:GetChild("tex_reason").text = __getReason(data)
obj:GetChild("tex_time").text = os.date("%Y-%m-%d\n%H:%M", data.time)
obj:GetChild("tex_roomID").text = data.roomid
obj:GetChild("tex_playName").text = data.roomid == "" and "" or (play and play.name or "玩法已删除")
2025-05-24 14:29:14 +08:00
local btn_head = obj:GetChild("btn_head")
btn_head.icon = "ui://Common/Head0"
ImageLoad.Load(self.member.portrait, btn_head._iconObject)
obj:GetController("show_check").selectedIndex = data.reason == 15 and 1 or 0
local btn_check = obj:GetChild("btn_check")
if data.reason ~= 15 or not data.detail then
btn_check.selected = false
obj:GetController("c1").selectedIndex = 0
obj.height = 94
end
btn_check.onClick:Set(function()
local lst = obj:GetChild("lst")
lst:RemoveChildrenToPool()
if not btn_check.selected then
obj.height = 94
self.lst_fag:RefreshVirtualList()
return
end
if data.detail then
lst:RemoveChildrenToPool()
for i = 1, #data.detail do
local item = lst:AddItemFromPool()
fillItem(data.detail[i], item)
end
obj.height = 95 * (#data.detail + 1)
2025-05-24 14:29:14 +08:00
self.lst_fag:RefreshVirtualList()
self.lst_fag:ScrollToView(index)
else
ViewUtil.ShowModalWait()
local fgCtr = ControllerManager.GetController(NewGroupController)
fgCtr:FG_GetHpLogDetail(self.group_id, self.member.uid, data.roomid, data.time, function(res)
if self._is_destroy then
return
end
ViewUtil.CloseModalWait()
if res.ReturnCode ~= 0 then
2025-05-24 14:29:14 +08:00
ViewUtil.ErrorTip(res.ReturnCode, "获取积分详情失败")
else
data.detail = res.Data.hp_logs
lst:RemoveChildrenToPool()
for i = 1, #data.detail do
local item = lst:AddItemFromPool()
fillItem(data.detail[i], item)
end
obj.height = 95 * (#data.detail + 1)
2025-05-24 14:29:14 +08:00
self.lst_fag:RefreshVirtualList()
self.lst_fag:ScrollToView(index)
end
end)
end
end)
end
-- 获取日统计数据
function M:GetDailyData()
ViewUtil.ShowModalWait()
local fgCtr = ControllerManager.GetController(NewGroupController)
fgCtr:FG_GetPlayerDailyHPCount(self.group_id, self.member.uid, function(res)
if self._is_destroy then
return
end
ViewUtil.CloseModalWait()
if res.ReturnCode ~= 0 then
2025-05-24 14:29:14 +08:00
ViewUtil.ErrorTip(res.ReturnCode, "获取积分详情失败")
else
self.daily_count = res.Data.list
self.lst_daily_count.numItems = #self.daily_count
end
end)
end
-- 填充日统计对象
function M:OnRenderDailyItem(index, obj)
local data = self.daily_count[#self.daily_count - index]
obj:GetChild("tex_date").text = os.date("%Y-%m-%d", data.time)
2025-05-24 14:29:14 +08:00
local num = d2ad(data.num)
obj:GetChild("tex_num").text = num >= 0 and ('+' .. num) or num
end
return M