private async Task <AccountDetailVm> GetAccountDetail(long id) { var accountInfo = await AccountRepositoryHelper.GetAccountInfo(id, _accountRep, _redisRep); if (accountInfo == null) { return(null); } var tMoney = _moneyClient.GetResponseExt <GetMoneyMqCmd, WrappedResponse <MoneyMqResponse> > (new GetMoneyMqCmd(id)); var tLevel = _bus.SendCommand(new GetLevelInfoCommand(id)); var tGame = _bus.SendCommand(new GetGameInfoCommand(id)); await Task.WhenAll(tMoney, tLevel, tGame); var moneyResponse = tMoney.Result; var moneyInfo = new MoneyInfoVm(moneyResponse.Message.Body.CurCoins + moneyResponse.Message.Body.Carry, moneyResponse.Message.Body.CurDiamonds, moneyResponse.Message.Body.MaxCoins, moneyResponse.Message.Body.MaxDiamonds); var levelInfo = _mapper.Map <LevelInfoVm>(tLevel.Result.Body); var gameInfo = _mapper.Map <GameInfoVm>(tGame.Result.Body); if (accountInfo == null || moneyInfo == null || levelInfo == null || gameInfo == null) { return(null); } return(new AccountDetailVm(accountInfo.PlatformAccount, accountInfo.UserName, accountInfo.Sex, accountInfo.HeadUrl, accountInfo.Type, levelInfo, gameInfo, moneyInfo)); }
public async Task <WrappedResponse <GetAccountBaseInfoMqResponse> > Handle(GetAccountBaseInfoCommand request, CancellationToken cancellationToken) { var accountInfo = await AccountRepositoryHelper.GetAccountInfo(request.Id, _accountRep, _redisRep); if (accountInfo == null) { return(new WrappedResponse <GetAccountBaseInfoMqResponse>(ResponseStatus.AccountError, null)); } return(new WrappedResponse <GetAccountBaseInfoMqResponse>(ResponseStatus.Success, null, _mapper.Map <GetAccountBaseInfoMqResponse>(accountInfo))); }