37 lines
762 B
Go
37 lines
762 B
Go
package walletservicelogic
|
|
|
|
import (
|
|
"context"
|
|
|
|
"tianyuan-api/apps/user/internal/svc"
|
|
"tianyuan-api/apps/user/user"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type GetWalletLogic struct {
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
logx.Logger
|
|
}
|
|
|
|
func NewGetWalletLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetWalletLogic {
|
|
return &GetWalletLogic{
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
Logger: logx.WithContext(ctx),
|
|
}
|
|
}
|
|
|
|
// 查询钱包信息
|
|
func (l *GetWalletLogic) GetWallet(in *user.GetWalletRequest) (*user.GetWalletResponse, error) {
|
|
wallet, err := l.svcCtx.WalletsModel.FindOne(l.ctx, in.Id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &user.GetWalletResponse{
|
|
UserId: wallet.UserId,
|
|
Balance: wallet.Balance,
|
|
}, nil
|
|
}
|