Пример #1
0
 /// <summary>
 /// 设置用户登录区信息
 /// </summary>
 /// <param name="account"></param>
 /// <param name="platform"></param>
 /// <param name="siteId"></param>
 /// <returns></returns>
 public MessageCode SetUserLogin(string account, string platform, string siteId)
 {
     try
     {
         DateTime date       = DateTime.Now;
         var      userRecord = UserloginZoneMgr.GetByAccountPlatform(account, platform);
         bool     isInsert   = false;
         if (userRecord == null)
         {
             isInsert   = true;
             userRecord = new UserloginZoneEntity(account, platform, date, siteId, date);
         }
         else
         {
             var sitesString = siteId;
             if (userRecord.LoginSties.Length > 0)
             {
                 var siteList = userRecord.LoginSties.Split(',');
                 foreach (var s in siteList)
                 {
                     if (s != siteId)
                     {
                         sitesString += "," + s;
                     }
                 }
             }
             userRecord.LastLoginTime = date;
             userRecord.LoginSties    = sitesString;
         }
         if (isInsert)
         {
             if (!UserloginZoneMgr.Insert(userRecord))
             {
                 return(MessageCode.NbUpdateFail);
             }
         }
         else
         {
             if (!UserloginZoneMgr.Update(userRecord))
             {
                 return(MessageCode.NbUpdateFail);
             }
         }
         return(MessageCode.Success);
     }
     catch (Exception ex)
     {
         SystemlogMgr.Error("设置用户登录信息", ex);
         return(MessageCode.NbParameterError);
     }
 }
Пример #2
0
        /// <summary>
        /// 获取用户登录信息
        /// </summary>
        /// <param name="account"></param>
        /// <param name="platform"></param>
        /// <returns></returns>
        public GetUserLoginRecordResponse GetUserLoginRecord(string account, string platform, string longType = "")
        {
            GetUserLoginRecordResponse response = new GetUserLoginRecordResponse();

            response.Data = new Entity.Response.GetUserLoginRecord();
            try
            {
                var userRecord = UserloginZoneMgr.GetByAccountPlatform(account, platform);
                if (userRecord != null)
                {
                    response.Data.LoginRecord = userRecord.LoginSties;
                }

                List <AllZoneinfoEntity> zonelist = null;
                if (ShareUtil.IsTx)
                {
                    zonelist = CacheFactory.ZoneCache.GetWanBaZone(longType);
                }
                else if (_aloneZoneList.Contains(platform))
                {
                    zonelist = CacheFactory.ZoneCache.GetAllAloneZone();
                }
                else if (_qunheiAnd9G.Contains(platform))
                {
                    zonelist = CacheFactory.ZoneCache.GetQunheiAnd9GZone();
                }
                else if (_H5_Egret.Contains(platform))
                {
                    zonelist = CacheFactory.ZoneCache.GetEgterZone();
                }
                else if (_h5_Bear.Contains(platform))
                {
                    zonelist = CacheFactory.ZoneCache.GetBearZone();
                }
                else
                {
                    zonelist = CacheFactory.ZoneCache.GetAllMixtureZone();
                }

                if (ShareUtil.IsQunHei)
                {
                    zonelist = CacheFactory.ZoneCache.GetQunHeiZone();
                }
                List <GetAllZone> resultList = new List <GetAllZone>();

                foreach (var item in zonelist)
                {
                    if (item.States == 5)
                    {
                        if (!_H5_A8Debug.Contains(account))
                        {
                            continue;
                        }
                    }
                    if (_aloneZoneList.Contains(platform)) //暂时这样处理。后续去掉这限制
                    {
                        if (item.PlatformZoneName == "1" || item.PlatformZoneName == "2")
                        {
                            if (platform != "h5_1758")
                            {
                                continue;
                            }
                        }
                    }
                    GetAllZone entity = new GetAllZone();
                    entity.PlatForm   = platform;
                    entity.ZoneId     = item.PlatformZoneName;
                    entity.ZoneName   = item.Name;
                    entity.Maintain   = item.Maintain;
                    entity.Host       = item.ApiUrl;
                    entity.ZoneStates = item.States;
                    resultList.Add(entity);
                }
                response.Data.ZoneList = resultList;
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("获取用户登录记录", ex);
                response.Code = (int)MessageCode.NbParameterError;
            }
            return(response);
        }