Exemple #1
0
        /// <summary>
        /// 将信息记录到系统日志
        /// </summary>
        /// <param name="Info"></param>
        /// <param name="logtype"></param>
        public static void SysSaveSysLog(string Info, EnumSysLogType logtype)
        {
            Us_SysLog dblog = new Us_SysLog()
            {
                Us_SysLogId = Helps.GetTimeId(),
                CreatedOn   = DateTime.Now,
                errormsg    = Info,
                type        = byte.Parse(logtype.GetHashCode().ToString())
            };

            BaseSysTemDataBaseManager.SysSaveErrorLogMsg(dblog);
        }
Exemple #2
0
        /// <summary>
        /// 将信息记录到错误日志
        /// </summary>
        /// <param name="errormsg">错误描述</param>
        /// <param name="condtion">当前方法的请求参数对象</param>
        public static void SysSaveErrorLogMsg(string errormsg, object condtion = null)
        {
            string condtions = null;

            if (condtion != null)
            {
                condtions = JsonConvert.SerializeObject(condtion);
            }
            Us_SysLog dblog = new Us_SysLog()
            {
                Us_SysLogId = Helps.GetTimeId(),
                condtion    = condtions,
                CreatedOn   = DateTime.Now,
                errormsg    = errormsg,
                type        = 0
            };

            BaseSysTemDataBaseManager.SysSaveErrorLogMsg(dblog);
        }
Exemple #3
0
        /// <summary>
        /// 会员自助注册
        /// </summary>
        /// <param name="condtion"></param>
        /// <returns></returns>
        internal RegisterMembersReplayModel RegisterMembers(Models.RegisterMembersRequestModel condtion)
        {
            RegisterMembersReplayModel result = new RegisterMembersReplayModel();

            try
            {
                //请求参数验证
                if (string.IsNullOrEmpty(condtion.deviceUUid) && string.IsNullOrEmpty(condtion.mobilePhone))
                {
                    result.ReturnCode    = EnumErrorCode.EmptyDate;
                    result.ReturnMessage = "设备ID或者手机号码不能同时为空";
                    return(result);
                }
                if (!string.IsNullOrEmpty(condtion.mobilePhone))
                {
                    if (condtion.mobilePhone.Length < 11)
                    {
                        result.ReturnCode    = EnumErrorCode.EmptyDate;
                        result.ReturnMessage = "手机号码必须是11位";
                        return(result);
                    }
                    Regex r = new Regex("^[0-9_]+$");
                    if (!r.IsMatch(condtion.mobilePhone))
                    {
                        result.ReturnCode    = EnumErrorCode.EmptyDate;
                        result.ReturnMessage = "手机号码必须全部为数字";
                        return(result);
                    }
                }
                int count = CheckMobilePhoneOrUUIdIsExist(condtion);
                if (count == 0)
                {
                    //判断用户的角色
                    if (string.IsNullOrEmpty(condtion.mobilePhone))
                    {
                        condtion.roleId = 1008;//注册为访客
                    }
                    else
                    {
                        condtion.roleId = 1009;//注册为会员
                    }
                    //随机获取一个登录名
                    condtion.loginName = Helps.GetTimeId();
                    result             = BaseSysTemDataBaseManager.MemberRegisterMembers(condtion);
                    if (result.ReturnCode == EnumErrorCode.Success)
                    {
                        //注册成功后获取用户基础信息
                        GetMemberBaseInfo(new GetMembersInfoRequestModel()
                        {
                            userId = result.UserInfo.UserId
                        });
                        result.UserInfo = this.MemberBaseInfo;
                    }
                }
                else
                {
                    result.ReturnCode    = EnumErrorCode.EmptyDate;
                    result.ReturnMessage = "该手机号码已使用";
                }
            }
            catch (Exception e) {
                result.ReturnCode    = EnumErrorCode.ServiceError;
                result.ReturnMessage = "服务器错误 500";
                SysManagerService.SysSaveErrorLogMsg(e.ToString(), condtion);
            }
            return(result);
        }