fix: stabilize backend tests

This commit is contained in:
2026-01-08 14:07:58 +08:00
parent 7f1d2e7cb3
commit edbb62449b
18 changed files with 281 additions and 147 deletions

View File

@@ -451,7 +451,7 @@ func (s *creator) UpdateContent(
})
}
func (s *creator) DeleteContent(ctx context.Context, userID int64, id int64) error {
func (s *creator) DeleteContent(ctx context.Context, userID, id int64) error {
tid, err := s.getTenantID(ctx, userID)
if err != nil {
return err
@@ -472,7 +472,7 @@ func (s *creator) DeleteContent(ctx context.Context, userID int64, id int64) err
return nil
}
func (s *creator) GetContent(ctx context.Context, userID int64, id int64) (*creator_dto.ContentEditDTO, error) {
func (s *creator) GetContent(ctx context.Context, userID, id int64) (*creator_dto.ContentEditDTO, error) {
tid, err := s.getTenantID(ctx, userID)
if err != nil {
return nil, err
@@ -634,7 +634,7 @@ func (s *creator) ListOrders(
return data, nil
}
func (s *creator) ProcessRefund(ctx context.Context, userID int64, id int64, form *creator_dto.RefundForm) error {
func (s *creator) ProcessRefund(ctx context.Context, userID, id int64, form *creator_dto.RefundForm) error {
tid, err := s.getTenantID(ctx, userID)
if err != nil {
return err
@@ -699,7 +699,7 @@ func (s *creator) ProcessRefund(ctx context.Context, userID int64, id int64, for
// 4. Revoke Content Access
// Fetch order items to get content IDs
items, _ := tx.OrderItem.WithContext(ctx).Where(tx.OrderItem.OrderID.Eq(oid)).Find()
items, _ := tx.OrderItem.WithContext(ctx).Where(tx.OrderItem.OrderID.Eq(o.ID)).Find()
contentIDs := make([]int64, len(items))
for i, item := range items {
contentIDs[i] = item.ContentID
@@ -717,7 +717,7 @@ func (s *creator) ProcessRefund(ctx context.Context, userID int64, id int64, for
ledger := &models.TenantLedger{
TenantID: tid,
UserID: uid,
OrderID: oid,
OrderID: o.ID,
Type: consts.TenantLedgerTypeCreditRefund,
Amount: o.AmountPaid,
Remark: "退款: " + form.Reason,
@@ -824,7 +824,7 @@ func (s *creator) AddPayoutAccount(ctx context.Context, userID int64, form *crea
return nil
}
func (s *creator) RemovePayoutAccount(ctx context.Context, userID int64, id int64) error {
func (s *creator) RemovePayoutAccount(ctx context.Context, userID, id int64) error {
tid, err := s.getTenantID(ctx, userID)
if err != nil {
return err