コード例 #1
0
        /// <summary>
        /// 服务器端检查在线状态
        /// </summary>
        /// <param name="taskId">任务标识</param>
        /// <returns>离线人数</returns>
        public int ServerCheckOnline(string taskId)
        {
            var result = 0;

            using (var dbHelper = DbHelperFactory.Create(BaseSystemInfo.UserCenterDbType))
            {
                try
                {
                    dbHelper.Open(BaseSystemInfo.UserCenterWriteDbConnection);
                    var userLogonManager = new BaseUserLogonManager(dbHelper);
                    result = userLogonManager.CheckOnline();
                }
                catch (Exception ex)
                {
                    LogUtil.WriteException(ex);
                    throw;
                }
                finally
                {
                    dbHelper.Close();
                }
            }

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// 激活用户
        /// </summary>
        /// <param name="taskId">任务标识</param>
        /// <param name="userInfo">用户</param>
        /// <param name="openId">唯一识别码</param>
        /// <returns>用户实体</returns>
        public BaseUserInfo AccountActivation(string taskId, BaseUserInfo userInfo, string openId)
        {
            BaseUserInfo result = null;

            var parameter = ServiceInfo.Create(taskId, userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (dbHelper) =>
            {
                var userLogonManager = new BaseUserLogonManager(dbHelper, userInfo);
                // 先侦测是否在线
                userLogonManager.CheckOnline();
                // 再进行登录
                var userManager = new BaseUserManager(dbHelper, userInfo);
                result          = userManager.AccountActivation(openId);
            });

            return(result);
        }
コード例 #3
0
        /// <summary>
        /// 按唯一识别码登录
        /// </summary>
        /// <param name="taskId">任务标识</param>
        /// <param name="userInfo">用户</param>
        /// <param name="openId">唯一识别码</param>
        /// <returns>用户实体</returns>
        public UserLogonResult LogonByOpenId(string taskId, BaseUserInfo userInfo, string openId)
        {
            var result = new UserLogonResult();

            var parameter = ServiceInfo.Create(taskId, userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (dbHelper) =>
            {
                // 先侦测是否在线
                var userLogonManager = new BaseUserLogonManager();
                userLogonManager.CheckOnline();
                // 若是单点登录,那就不能判断ip地址,因为不是直接登录,是间接登录
                var userManager = new BaseUserManager(userInfo);
                result          = userManager.LogonByOpenId(openId, userInfo.SystemCode, string.Empty, string.Empty);
            });

            return(result);
        }
コード例 #4
0
        /// <summary>
        /// 获得用户列表
        /// </summary>
        /// <param name="taskId">任务标识</param>
        /// <param name="userInfo">用户</param>
        /// <returns>数据表</returns>
        public DataTable GetUserDT(string taskId, BaseUserInfo userInfo)
        {
            var result = new DataTable(BaseUserEntity.CurrentTableName);

            var parameter = ServiceInfo.Create(taskId, userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterReadDb(userInfo, parameter, (dbHelper) =>
            {
                // 检查用户在线状态(服务器专用)
                var userLogonManager = new BaseUserLogonManager();
                userLogonManager.CheckOnline();
                var userManager = new BaseUserManager(dbHelper, userInfo);
                // 获取允许登录列表
                var parameters = new List <KeyValuePair <string, object> >
                {
                    new KeyValuePair <string, object>(BaseUserEntity.FieldEnabled, 1),
                    new KeyValuePair <string, object>(BaseUserEntity.FieldDeleted, 0)
                };
                result           = userManager.GetDataTable(parameters, BaseUserEntity.FieldSortCode);
                result.TableName = BaseUserEntity.CurrentTableName;
            });

            return(result);
        }