chore: stabilize lint and verify builds
This commit is contained in:
@@ -104,6 +104,7 @@ func (s *creator) Dashboard(ctx context.Context, tenantID, userID int64) (*creat
|
||||
PendingRefunds: int(pendingRefunds),
|
||||
NewMessages: 0,
|
||||
}
|
||||
|
||||
return stats, nil
|
||||
}
|
||||
|
||||
@@ -482,6 +483,7 @@ func (s *creator) DeleteContent(ctx context.Context, tenantID, userID, id int64)
|
||||
if err != nil {
|
||||
return errorx.ErrDatabaseError.WithCause(err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -505,6 +507,7 @@ func (s *creator) GetContent(ctx context.Context, tenantID, userID, id int64) (*
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, errorx.ErrRecordNotFound
|
||||
}
|
||||
|
||||
return nil, errorx.ErrDatabaseError.WithCause(err)
|
||||
}
|
||||
|
||||
@@ -556,6 +559,7 @@ func (s *creator) GetContent(ctx context.Context, tenantID, userID, id int64) (*
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return dto, nil
|
||||
}
|
||||
|
||||
@@ -691,6 +695,7 @@ func (s *creator) ListOrders(
|
||||
for _, ca := range c.ContentAssets {
|
||||
if ca.Role == consts.ContentAssetRoleCover && ca.Asset != nil {
|
||||
cover = Common.GetAssetURL(ca.Asset.ObjectKey)
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -708,6 +713,7 @@ func (s *creator) ListOrders(
|
||||
Cover: cover,
|
||||
})
|
||||
}
|
||||
|
||||
return data, nil
|
||||
}
|
||||
|
||||
@@ -738,6 +744,7 @@ func (s *creator) ProcessRefund(ctx context.Context, tenantID, userID, id int64,
|
||||
Status: consts.OrderStatusPaid,
|
||||
RefundReason: form.Reason, // Store reject reason? Or clear it?
|
||||
})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -825,6 +832,7 @@ func (s *creator) GetSettings(ctx context.Context, tenantID, userID int64) (*cre
|
||||
return nil, errorx.ErrRecordNotFound
|
||||
}
|
||||
cfg := t.Config.Data()
|
||||
|
||||
return &creator_dto.Settings{
|
||||
ID: t.ID,
|
||||
Name: t.Name,
|
||||
@@ -856,6 +864,7 @@ func (s *creator) UpdateSettings(ctx context.Context, tenantID, userID int64, fo
|
||||
Name: form.Name,
|
||||
Config: types.NewJSONType(cfg),
|
||||
})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -885,6 +894,7 @@ func (s *creator) ListPayoutAccounts(ctx context.Context, tenantID, userID int64
|
||||
ReviewReason: v.ReviewReason,
|
||||
})
|
||||
}
|
||||
|
||||
return data, nil
|
||||
}
|
||||
|
||||
@@ -907,6 +917,7 @@ func (s *creator) AddPayoutAccount(ctx context.Context, tenantID, userID int64,
|
||||
if err := models.PayoutAccountQuery.WithContext(ctx).Create(pa); err != nil {
|
||||
return errorx.ErrDatabaseError.WithCause(err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -921,6 +932,7 @@ func (s *creator) RemovePayoutAccount(ctx context.Context, tenantID, userID, id
|
||||
if err != nil {
|
||||
return errorx.ErrDatabaseError.WithCause(err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -956,6 +968,7 @@ func (s *creator) Withdraw(ctx context.Context, tenantID, userID int64, form *cr
|
||||
if account.Status == consts.PayoutAccountStatusRejected && reason != "" {
|
||||
return errorx.ErrPreconditionFailed.WithMsg("收款账户审核未通过:" + reason)
|
||||
}
|
||||
|
||||
return errorx.ErrPreconditionFailed.WithMsg("收款账户未审核通过")
|
||||
}
|
||||
|
||||
@@ -1036,11 +1049,13 @@ func (s *creator) getTenantID(ctx context.Context, tenantID, userID int64) (int6
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return 0, errorx.ErrPermissionDenied.WithMsg("非创作者")
|
||||
}
|
||||
|
||||
return 0, errorx.ErrDatabaseError.WithCause(err)
|
||||
}
|
||||
if tenantID > 0 && t.ID != tenantID {
|
||||
return 0, errorx.ErrPermissionDenied.WithMsg("无权限访问该租户")
|
||||
}
|
||||
|
||||
return t.ID, nil
|
||||
}
|
||||
|
||||
@@ -1048,6 +1063,7 @@ func (s *creator) formatTime(t time.Time) string {
|
||||
if t.IsZero() {
|
||||
return ""
|
||||
}
|
||||
|
||||
return t.Format(time.RFC3339)
|
||||
}
|
||||
|
||||
@@ -1094,6 +1110,7 @@ func (s *creator) validateContentAssets(
|
||||
if asset.TenantID == 0 && asset.UserID == userID {
|
||||
continue
|
||||
}
|
||||
|
||||
return errorx.ErrForbidden.WithMsg("素材不属于当前租户")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user