Example #1
0
        public async Task <ServiceResult <UserLogonResponse> > RegisterUser(UserRegisterRequest registerRequest)
        {
            //手机验证
            var codeVaildResult = await _iCode.Vaild(registerRequest.CountryCode + registerRequest.Phone, registerRequest.Code);

            if (codeVaildResult.Failed)
            {
                return(ServiceResult <UserLogonResponse> .IsFailed(codeVaildResult.Message));
            }

            registerRequest.UserNo = await _id.Create("D4");

            registerRequest.UserName = "******" + registerRequest.UserName;
            var result = await _iUser.RegisterUser(registerRequest.MapTo <RegisterUserRequest>());

            if (result.Success)
            {
                var token    = BuildJwt(result.Data.MapTo <AdministratorData>());
                var response = result.Data.MapTo <UserLogonResponse>();
                response.Token = token;

                return(ServiceResult <UserLogonResponse> .IsSuccess("登录成功", response));
            }

            return(ServiceResult <UserLogonResponse> .IsFailed(result.Message));
        }
Example #2
0
        public void Logon_IsNormal_IsTrue()
        {
            var sw = Stopwatch.StartNew();

            Enumerable.Range(1, 1000).AsParallel().ForAll(a =>
            {
                var order = _id.Create("GS|D10");
            });

            sw.Stop();
        }
Example #3
0
        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="registerRequest"></param>
        /// <returns></returns>
        public async Task <ServiceResult <AdministratorData> > RegisterUser(UserRegisterInputAo registerRequest)
        {
            //手机验证
            var codeVaildResult = await _iCode.Vaild(registerRequest.CountryCode + registerRequest.Phone, registerRequest.Code);

            if (codeVaildResult.Failed)
            {
                return(ServiceResult <AdministratorData> .IsFailed(codeVaildResult.Message));
            }

            registerRequest.UserNo = await _id.Create("D4");

            registerRequest.UserName = "******" + registerRequest.UserName;
            var registerResult = _iUser.RegisterUser(registerRequest.MapTo <User>());

            return(registerResult);
        }