Ejemplo n.º 1
0
        private UserRankValue GetRankValueStruct(RankDataKey key)
        {
            double        currSecond  = Global.GetOffsetSecond(DateTime.Now);
            UserRankValue tmpRankData = this.GetRankValueFromCache(key);

            if (null != tmpRankData)
            {
                if (tmpRankData.EndTime >= currSecond)
                {
                    return(tmpRankData);
                }
                if (tmpRankData.QueryFromDBTime > tmpRankData.EndTime)
                {
                    return(tmpRankData);
                }
            }
            UserRankValue result;

            lock (UserRankValueCache.UserRankValueDictLock)
            {
                tmpRankData = this.InitRankValue(key);
                this.DictUserRankValue[key.GetKey()] = tmpRankData;
                result = tmpRankData;
            }
            return(result);
        }
Ejemplo n.º 2
0
        public UserRankValue InitRankValue(RankDataKey key)
        {
            DBManager     dbMgr = DBManager.getInstance();
            UserRankValue result;

            if (null == dbMgr)
            {
                result = null;
            }
            else
            {
                UserRankValue DBRankValue = null;
                if (RankType.Charge == key.rankType)
                {
                    DBRoleInfo roleInfo = dbMgr.GetDBRoleInfo(ref this.roleID);
                    if (null != roleInfo)
                    {
                        DBRankValue = this.GetUserInputRankVaule(dbMgr, roleInfo.UserID, roleInfo.ZoneID, key.StartDate, key.EndDate);
                    }
                }
                else if (RankType.Consume == key.rankType)
                {
                    DBRankValue = this.GetUserConsumeRankValue(dbMgr, key.StartDate, key.EndDate);
                }
                result = DBRankValue;
            }
            return(result);
        }
Ejemplo n.º 3
0
        public UserRankValue GetRankValueFromCache(RankDataKey key)
        {
            UserRankValue tmpRankData = null;

            lock (UserRankValueCache.UserRankValueDictLock)
            {
                if (this.DictUserRankValue.ContainsKey(key.GetKey()))
                {
                    tmpRankData = this.DictUserRankValue[key.GetKey()];
                }
            }
            return(tmpRankData);
        }
Ejemplo n.º 4
0
        public int GetRankValue(RankDataKey key)
        {
            UserRankValue tmpRankData = this.GetRankValueStruct(key);

            return((tmpRankData == null) ? 0 : tmpRankData.RankValue);
        }