local FamilyNotice = {} local M = FamilyNotice function M.New(data, callback) setmetatable(M, { __index = BaseWindow }) local self = setmetatable({}, { __index = M }) self.class = "FamilyNotice" self._close_destroy = true self._close_zone = false self._data = data self._callback = callback self:init("ui://Family/com_FamilyNotice") return self end function M:init(url) BaseWindow.init(self, url) local group = self._data.group self._view:GetChild('text_familyName').text = string.format("%s(%s)", group.name, group.id) self._view:GetChild('label_detial').text = group.notice end function M.TryShow(data, callback) local group = data.group local noticeTime = Utils.LoadLocalFile(string.format("Family_%s_notice_time", group.id)) or 0 local noticeText = Utils.LoadLocalFile(string.format("Family_%s_notice_text", group.id)) or "" if tonumber(os.date("%Y%m%d", tonumber(noticeTime))) - tonumber(os.date("%Y%m%d", os.time())) < -1 and group.notice and #group.notice > 0 and noticeText ~= group.notice then Utils.SaveLocalFile(string.format("Family_%s_notice_time", group.id), os.time()) Utils.SaveLocalFile(string.format("Family_%s_notice_text", group.id), group.notice) local my = M.New(data, callback) my:Show() end end return M