-- 牌友圈成员体力值记录 local TimeSettingPanel = import("Game.View.NewGroup.MngView.TimeSettingPanelTog") local GroupMemberFagLogView = {} local M = GroupMemberFagLogView function GroupMemberFagLogView.new(group_id, member, not_manager) setmetatable(M, { __index = BaseWindow }) local self = setmetatable({}, { __index = M }) self.class = "GroupMemberFagLogView" self._close_destroy = true -- self._blur_view = blur_view self.member = member self.nick = nick -- self._full = true self._animation = false self.group_id = group_id self.hp_log = {} self.daily_count = {} self.not_manager = not_manager -- self._full = true self.m_index = 0 self:init("ui://NewGroup/Win_MemberFagLog") return self end function M:init(url) BaseWindow.init(self, url) local btn_close = self._view:GetChild("btn_close") btn_close.onClick:Set(function() self:Destroy() end) 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 = {} self.m_index = 0 self.lst_fag.numItems = 0 self:GetData(0) end) end end self._view:GetChild('btn_all').onClick:Set(function() self:GetData(0) end) self.lst_fag = self._view:GetChild("lst_fag") self.lst_fag:SetVirtual() self.lst_fag.itemRenderer = function(index, obj) self:OnRenderItem(index, obj) end self.lst_fag.scrollPane.onPullUpRelease:Set(function() self:GetData(self.lst_fag.numItems + self.m_index) 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 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) self.begin_time, self.end_time = self.time_panel:GetDate() self:GetData(0) end -- 获取过滤值,根据多选框计算 function M:GetFilter() local filter = 0 local btn_all = self._view:GetChild('btn_all') for i = 1, 8 do local tem = math.pow(2, i - 1) --print("aaaaaaaaaaaaaaaaaaaaaaaa ",tem) local btn_filter = self._view:GetChild("btn_filter" .. tem) if btn_filter and btn_filter.selected then filter = filter + tem end end return btn_all.selected and 1 or filter end -- 显示原因文本 local function __getReason(data) -- return "玩家操作" local s_nick = string.utf8sub(data.m_nick, 6) if data.reason == 6 then return data.info elseif data.reason == 7 then return string.format("房卡(%s)", data.roomid) 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 "推广奖励" 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 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() 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 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) self.lst_fag.numItems = #self.hp_log end end) end function M:GuoLv(data) if self.member.lev == 1 then local m_data_other = {} local m_data_my = {} for i = 1, #data do if self.member.uid ~= data[i].mgr_id then table.insert(m_data_other, data[i]) else table.insert(m_data_my, data[i]) 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 for i = 1, #m_data_my do self.hp_log[#self.hp_log + 1] = m_data_my[i] 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] end self.m_index = #data - #m_data_other + self.m_index end else local m_data_other = {} local m_data_my = {} for i = 1, #data do if self.member.uid ~= data[i].mgr_id then table.insert(m_data_other, data[i]) end end -- printlog("比较计算11=========m_data_my>>>",#m_data_my) -- printlog("比较计算11=========m_data_other>>>",#m_data_other) 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) end -- 填充体力值详情对象 function M:OnRenderItem(index, obj) local data = self.hp_log[index + 1] -- 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) obj:GetChild("tex_name").text = ViewUtil.stringEllipsis(self.member.nick) obj:GetChild("tex_id").text = string.format("ID:%s", ViewUtil.stringEllipsis(self.member.uid)) 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 "玩法已删除") 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) 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 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) 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 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) local num = d2ad(data.num) obj:GetChild("tex_num").text = num >= 0 and ('+' .. num) or num end return M