fix: some api bug

This commit is contained in:
wwweww
2026-03-31 22:12:06 +08:00
parent c5ff4f0216
commit e7970ac25f
219 changed files with 16195 additions and 2126 deletions
@@ -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,