feat: 重构内容和订单列表接口,使用过滤器结构体简化参数传递;更新相关服务和测试用例

This commit is contained in:
2025-12-29 15:41:48 +08:00
parent fba77afec1
commit 9d598e7f9b
11 changed files with 286 additions and 232 deletions

View File

@@ -4,10 +4,10 @@ import "quyun/v2/app/requests"
type ContentListFilter struct {
requests.Pagination
Keyword string `query:"keyword"`
Genre string `query:"genre"`
TenantID string `query:"tenantId"`
Sort string `query:"sort"`
Keyword *string `query:"keyword"`
Genre *string `query:"genre"`
TenantID *string `query:"tenantId"`
Sort *string `query:"sort"`
}
type ContentItem struct {

View File

@@ -1,5 +1,7 @@
package dto
import "quyun/v2/app/requests"
type ApplyForm struct {
Name string `json:"name"`
Bio string `json:"bio"`
@@ -37,6 +39,19 @@ type ContentUpdateForm struct {
MediaIDs []string `json:"media_ids"`
}
type CreatorContentListFilter struct {
requests.Pagination
Status *string `query:"status"`
Genre *string `query:"genre"`
Keyword *string `query:"keyword"`
}
type CreatorOrderListFilter struct {
requests.Pagination
Status *string `query:"status"`
Keyword *string `query:"keyword"`
}
type RefundForm struct {
Action string `json:"action"` // accept, reject
Reason string `json:"reason"`
@@ -63,15 +78,3 @@ type WithdrawForm struct {
Method string `json:"method"` // wallet, external
AccountID string `json:"account_id"`
}
// Re-export or Wrap
// Since ContentItem and Order are in the same package 'dto',
// we don't need type aliases unless we want to rename them.
// If creator.go uses them, it can use dto.ContentItem directly.
// But creator.go is in `v1` (package v1) and imports `dto`.
// So it uses `dto.ContentItem`.
// So we don't need aliases here if the original types are in this package.
// However, if the originals were in `content/dto` and `user/dto` and we moved them to `v1/dto` (this package),
// then we just have them defined in `content.go` (dto) and `user.go` (dto).
// So aliases are not needed if they are in the same package.

View File

@@ -1,9 +1,31 @@
package dto
import (
"quyun/v2/app/requests"
"quyun/v2/pkg/consts"
)
// Filters
type UserListFilter struct {
requests.Pagination
Username *string `query:"username"`
}
type TenantListFilter struct {
requests.Pagination
Name *string `query:"name"`
}
type SuperContentListFilter struct {
requests.Pagination
// Add filters if needed, currently list signature is just pagination in super.go service
}
type SuperOrderListFilter struct {
requests.Pagination
// Add filters if needed
}
// SuperUserLite 用于平台用户列表的轻量级用户信息
type SuperUserLite struct {
ID int64 `json:"id"`