void doReflesh(HappyModeData hmd, List <int> happyKeys) { if (null == hmd) { return; } if (hmd.realItemBuyCntInRefleshTime.Count != happyKeys.Count) { hmd.ModifyLocked(() => { hmd.realItemBuyCntInRefleshTime.Clear(); foreach (int k in happyKeys) { RefleshCacheInfo info = new RefleshCacheInfo(); info.itemId = k; info.cnt = 0; hmd.realItemBuyCntInRefleshTime.Add(k, info); } }); } var shareCacheRealItemCnt = new ShareCacheStruct <ShareRealItemCnt>(); hmd.ModifyLocked(() => { for (int k = 0; k < happyKeys.Count; ++k) { int id = happyKeys[k]; ShareRealItemCnt cntData = shareCacheRealItemCnt.FindKey(id.ToString()); if (cntData != null && hmd.realItemBuyCntInRefleshTime.ContainsKey(id)) { if (hmd.realItemBuyCntInRefleshTime[id].preRefleshDate <= cntData.preUpdateTime) { hmd.realItemBuyCntInRefleshTime[id].cnt = 0; hmd.realItemBuyCntInRefleshTime[id].preRefleshDate = cntData.preUpdateTime.AddSeconds(1); } } else { ConsoleLog.showErrorInfo(0, "Refresh Acton1009"); TraceLog.WriteError("Refresh Acton1009"); } } }); }
void test() { HappyModeData hmd = new HappyModeData(); PayOrderPersion pop = new PayOrderPersion(); pop.Index = 1; pop.UserId = 2; pop.Identify = "1"; pop.typeUser = "******"; // 360Pay..maybe pop.ProductId = "1"; pop.num = 1; pop.the3rdUsrID = 1;// utils.KeyUInt2Int(requestPack.the3rdUserId); pop.strThe3rdOrderId = "1"; pop.ServerOrderId = "1"; pop.the3rdOrderId = "1"; hmd.PayInfoDic.Add("1", pop); HappyModeData d = new HappyModeData(); persionRealItemInfo prii = new persionRealItemInfo(); prii.Index = 1; hmd.RealItemInfoLst.Add(prii); UserActionInfo uai = new UserActionInfo(); uai.index = 1; hmd.ActionEnterHappyPoint.Add(1, uai); RefleshCacheInfo rci = new RefleshCacheInfo(); rci.itemId = 1; hmd.realItemBuyCntInRefleshTime.Add(1, rci); d.realItemBuyCntInRefleshTime = clone <CacheDictionary <int, RefleshCacheInfo> >(hmd.realItemBuyCntInRefleshTime); d.ActionEnterHappyPoint = clone <CacheDictionary <int, UserActionInfo> >(hmd.ActionEnterHappyPoint); d.RealItemInfoLst = clone <CacheList <persionRealItemInfo> >(hmd.RealItemInfoLst); d.PayInfoDic = clone <CacheDictionary <string, PayOrderPersion> >(hmd.PayInfoDic); }
void doReflesh(HappyModeData hmd, List<int> happyKeys) { if (null == hmd) return; if (hmd.realItemBuyCntInRefleshTime.Count != happyKeys.Count) { hmd.ModifyLocked(() => { hmd.realItemBuyCntInRefleshTime.Clear(); foreach (int k in happyKeys) { RefleshCacheInfo info = new RefleshCacheInfo(); info.itemId = k; info.cnt = 0; hmd.realItemBuyCntInRefleshTime.Add(k, info); } }); } var shareCacheRealItemCnt = new ShareCacheStruct<ShareRealItemCnt>(); hmd.ModifyLocked(() => { for (int k = 0; k < happyKeys.Count; ++k) { int id = happyKeys[k]; ShareRealItemCnt cntData = shareCacheRealItemCnt.FindKey(id.ToString()); if (cntData != null && hmd.realItemBuyCntInRefleshTime.ContainsKey(id)) { if (hmd.realItemBuyCntInRefleshTime[id].preRefleshDate <= cntData.preUpdateTime) { hmd.realItemBuyCntInRefleshTime[id].cnt = 0; hmd.realItemBuyCntInRefleshTime[id].preRefleshDate = cntData.preUpdateTime.AddSeconds(1); } } else { ConsoleLog.showErrorInfo(0, "Refresh Acton1009"); TraceLog.WriteError("Refresh Acton1009"); } } }); }