local OACommon_Controller = {} local private = {} function OACommon_Controller.OnStartup() private.tempParam = {} end function OACommon_Controller.GetDefaultTabId(activityId) for tabId, v in ipairs(MDL.OACommon.GetTaskData(activityId)) do if OACommon_Controller.IsTabHasReward(activityId, tabId) then return tabId end end return 1 end function OACommon_Controller.IsTabHasReward(activityId, tabId) for i, v in ipairs(MDL.OACommon.GetTaskData(activityId, tabId)) do local taskStatus = MDL.OACommon.GetTaskStatus(activityId, v.ID) if taskStatus and taskStatus == MDL.OACommon.ActivityTaskState.Done then return true end end return false end function OACommon_Controller.IsHasTaskRedPoint(activityId) return MDL.OACommon.GetOARedPointByActivityId(activityId) end function OACommon_Controller.IsHasGiftRedPoint(activityId) for _, v in MDL.DirectGift.GetDirectGiftEnumerator(MDL.DirectGift.DirectGiftType.StageUnlock, activityId) do local sheetData = v.data or nil if sheetData and sheetData.IsFree and v.state == MDL.DirectGift.GiftStateEnum.Available and (sheetData.LimitType == LuaConst.LimitBuyType.NoLimit or sheetData.TimesLimit - MDL.DirectGift.GetGiftBuyingCount(v.activityId, v.giftId) > 0) then return true end break end for _, v in MDL.DirectGift.GetDirectGiftEnumerator(MDL.DirectGift.DirectGiftType.Base, activityId) do local sheetData = v.data or nil if sheetData and sheetData.IsFree and v.state == MDL.DirectGift.GiftStateEnum.Available and (sheetData.LimitType == LuaConst.LimitBuyType.NoLimit or sheetData.TimesLimit - MDL.DirectGift.GetGiftBuyingCount(v.activityId, v.giftId) > 0) then return true end end return false end function OACommon_Controller.OpenPayPopView(goodId, viewClass, context) context.goodData = MDL.OperationActivity.StoreGoodsData:GetDataByID(goodId) UIManager.OpenView(viewClass, context) end function OACommon_Controller.SortByStatus(statusA, statusB) local activityTaskState = MDL.OACommon.ActivityTaskState if statusA == activityTaskState.Done then return true elseif statusA == activityTaskState.Commit then return false else if statusB == activityTaskState.Done then return false else return true end end end return OACommon_Controller