Beispiel #1
0
        /// <summary>
        /// 激活用户
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="openId">唯一识别码</param>
        /// <param name="statusCode">返回状态码</param>
        /// <param name="statusMessage">返回状消息</param>
        /// <returns>用户实体</returns>
        public BaseUserInfo AccountActivation(BaseUserInfo userInfo, string openId, out string statusCode, out string statusMessage)
        {
            // 写入调试信息
            #if (DEBUG)
            int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod());
            #endif

            // 加强安全验证防止未授权匿名调用
            #if (!DEBUG)
            LogOnService.UserIsLogOn(userInfo);
            #endif

            BaseUserInfo returnUserInfo = null;
            statusCode    = string.Empty;
            statusMessage = string.Empty;

            using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType))
            {
                try
                {
                    dbHelper.Open(UserCenterDbConnection);
                    BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo);
                    // 先侦测是否在线
                    userManager.CheckOnLine();
                    // 再进行登录
                    returnUserInfo = userManager.AccountActivation(openId, out statusCode);
                    statusMessage  = userManager.GetStateMessage(statusCode);
                    // 登录时会自动记录进行日志记录,所以不需要进行重复日志记录
                    // BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, "激活用户", MethodBase.GetCurrentMethod());
                }
                catch (Exception ex)
                {
                    BaseExceptionManager.LogException(dbHelper, userInfo, ex);
                    throw ex;
                }
                finally
                {
                    dbHelper.Close();
                }
            }

            // 写入调试信息
            #if (DEBUG)
            BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart);
            #endif

            return(returnUserInfo);
        }
Beispiel #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);
        }