feat: 更新服务方法,显式接受用户ID参数,简化上下文调用

This commit is contained in:
2025-12-30 23:23:56 +08:00
parent e6a8e3f321
commit 317db2daad
10 changed files with 216 additions and 91 deletions

View File

@@ -58,7 +58,7 @@ func (s *WalletTestSuite) Test_GetWallet() {
models.OrderQuery.WithContext(ctx).Create(o1, o2)
Convey("should return balance and transactions", func() {
res, err := Wallet.GetWallet(ctx)
res, err := Wallet.GetWallet(ctx, u.ID)
So(err, ShouldBeNil)
So(res.Balance, ShouldEqual, 50.0)
So(len(res.Transactions), ShouldEqual, 2)
@@ -82,7 +82,7 @@ func (s *WalletTestSuite) Test_Recharge() {
Convey("should create recharge order", func() {
form := &user_dto.RechargeForm{Amount: 100.0}
res, err := Wallet.Recharge(ctx, form)
res, err := Wallet.Recharge(ctx, u.ID, form)
So(err, ShouldBeNil)
So(res.OrderID, ShouldNotBeEmpty)