Ejemplo n.º 1
0
        public async Task <AjaxResult> LoginBind(UserLoginInfoEx loginInfo)
        {
            loginInfo.RegisterIp = HttpContext.GetClientIp();
            OperationResult <User> result = await _identityContract.LoginBind(loginInfo);

            IUnitOfWork unitOfWork = HttpContext.RequestServices.GetUnitOfWork <User, int>();

            unitOfWork.Commit();
            if (!result.Succeeded)
            {
                return(result.ToAjaxResult());
            }

            User         user  = result.Data;
            JsonWebToken token = await CreateJwtToken(user);

            return(new AjaxResult("登录成功", AjaxResultType.Success, token));
        }
Ejemplo n.º 2
0
        public async Task <AjaxResult> LoginBind(UserLoginInfoEx loginInfo)
        {
            loginInfo.RegisterIp = HttpContext.GetClientIp();
            OperationResult <User> result = await _identityContract.LoginBind(loginInfo);

            IUnitOfWorkManager unitOfWorkManager = HttpContext.RequestServices.GetRequiredService <IUnitOfWorkManager>();

#if NET5_0
            await unitOfWorkManager.CommitAsync();
#else
            unitOfWorkManager.Commit();
#endif
            if (!result.Succeeded)
            {
                return(result.ToAjaxResult());
            }

            User         user  = result.Data;
            JsonWebToken token = await CreateJwtToken(user);

            return(new AjaxResult("登录成功", AjaxResultType.Success, token));
        }