fix: some api bug
This commit is contained in:
@@ -26,10 +26,13 @@ func NewGetWalletsByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge
|
||||
|
||||
func (l *GetWalletsByIdLogic) GetWalletsById(in *pb.GetWalletsByIdReq) (*pb.GetWalletsByIdResp, error) {
|
||||
item, err := l.svcCtx.WalletModelsRO.Wallet.Query().
|
||||
Where(wallet.UserIDEQ(in.Id)).
|
||||
Where(wallet.IDEQ(in.Id)).
|
||||
First(l.ctx)
|
||||
if err != nil {
|
||||
if models.IsNotFound(err) {
|
||||
if _, e := l.svcCtx.WalletModelsRO.Wallet.Create().SetID(in.Id).Save(l.ctx); e != nil {
|
||||
return nil, e
|
||||
}
|
||||
return &pb.GetWalletsByIdResp{}, nil
|
||||
}
|
||||
return nil, err
|
||||
@@ -42,7 +45,7 @@ func (l *GetWalletsByIdLogic) GetWalletsById(in *pb.GetWalletsByIdReq) (*pb.GetW
|
||||
|
||||
return &pb.GetWalletsByIdResp{
|
||||
Wallets: &pb.Wallets{
|
||||
UserId: item.UserID,
|
||||
UserId: item.ID,
|
||||
Balance: item.Balance.String(),
|
||||
FrozenBalance: item.FrozenBalance.String(),
|
||||
UpdatedAt: updatedAt,
|
||||
|
||||
Reference in New Issue
Block a user