public async Task <JsonResponse> Login(UserInfoDto dto) { JsonResponse response = new JsonResponse(); try { var pwd = ""; using (var md5 = MD5.Create()) { var result = md5.ComputeHash(Encoding.UTF8.GetBytes(dto.Pwd)); pwd = BitConverter.ToString(result).Replace("-", ""); } var model = await _userInfoRepository.GetAsync(m => m.Account == dto.Account && m.Pwd == pwd); if (model == null) { response.total = 0; response.msg = "账号或密码错误"; response.code = StatusCodeDefine.RequestedRangeNotSatisfiable; return(response); } response.data = model; response.total = 1; response.msg = "操作成功"; response.code = StatusCodeDefine.Success; //绑定事件 _userEventHandler.BaseDomainEvent += _userEventHandler.UserAccount_Login_Handler; _userEventHandler.BaseDomainEvent += _userEventHandler.UserLogin_Login_Handler; UserDto userDto = new UserDto() { Id = model.Id, userAccountDto = new UserAccountDto() { Integral = 5 }, userLoginDto = new UserLoginDto() { Id = Guid.NewGuid().ToString(), UserID = model.Id, LoginIP = "", LoginTime = DateTime.Now, LoginType = 0 } }; await _userEventHandler.RunAsync(userDto); } catch (Exception ex) { response.msg = ex.Message; response.code = StatusCodeDefine.ServerError; response.status = -1; } return(response); }