public async Task <AppSrvResult <SimpleDto <string> > > Recharge(RechargeInputDto inputDto) { var customer = await _customerRepo.FindAsync(inputDto.ID); if (customer == null) { return(Problem(HttpStatusCode.NotFound, "不存在该账号")); } var cusTransactionLog = new CusTransactionLog() { ID = IdGenerater.GetNextId(IdGenerater.DatacenterId, IdGenerater.WorkerId) , Account = customer.Account , ExchangeType = "100" , Remark = "" , Amount = inputDto.Amount , ExchageStatus = "10" }; await _cusManagerService.Recharge(customer.ID, inputDto.Amount, cusTransactionLog); return(new SimpleDto <string>(cusTransactionLog.ID.ToString())); }
public async Task <SimpleDto <string> > Recharge(RechargeInputDto inputDto) { var customer = await _customerRepo.FindAsync(new object[] { inputDto.ID }); if (customer == null) { throw new BusinessException(new ErrorModel(HttpStatusCode.Forbidden, "不存在该账号")); } var cusTransactionLog = new CusTransactionLog() { ID = IdGenerater.GetNextId(IdGenerater.DatacenterId, IdGenerater.WorkerId) , Account = customer.Account , ExchangeType = "100" , Remark = "" , Amount = inputDto.Amount , ExchageStatus = "10" }; await _cusManagerService.Recharge(customer.ID, inputDto.Amount, cusTransactionLog); return(new SimpleDto <string>() { Result = cusTransactionLog.ID.ToString() }); }
public async Task <SimpleDto <string> > Recharge(RechargeInputDto inputDto) { if (inputDto.Amount == 0) { throw new BusinessException(new ErrorModel(ErrorCode.BadRequest, "充值金额不能等于0")); } var customer = await _customerRepo.FindAsync(new object[] { inputDto.ID }); if (customer == null) { throw new BusinessException(new ErrorModel(ErrorCode.Forbidden, "不存在该账号")); } var cusTransactionLog = new CusTransactionLog() { ID = new Snowflake(1, 1).NextId() , Account = customer.Account , ExchangeType = "100" , Remark = "" , Amount = inputDto.Amount , ExchageStatus = "10" }; await _cusManagerService.Recharge(customer.ID, inputDto.Amount, cusTransactionLog); return(new SimpleDto <string>() { Result = cusTransactionLog.ID.ToString() }); }