feat: 统一字段命名风格,使用下划线格式替代驼峰式命名

This commit is contained in:
2025-12-29 10:20:53 +08:00
parent d482905157
commit 60ff49d4c8
8 changed files with 106 additions and 105 deletions

View File

@@ -24,15 +24,18 @@ components:
message: message:
type: string type: string
Pagination: Pager:
type: object type: object
properties: properties:
page: page:
type: integer type: integer
pageSize: limit:
type: integer type: integer
total: total:
type: integer type: integer
items:
type: array
items: {} # Generic placeholder
# --- User Models --- # --- User Models ---
User: User:
@@ -67,7 +70,7 @@ components:
points: points:
type: integer type: integer
readOnly: true readOnly: true
isRealNameVerified: is_real_name_verified:
type: boolean type: boolean
readOnly: true readOnly: true
@@ -111,17 +114,17 @@ components:
enum: [video, audio, article] enum: [video, audio, article]
price: price:
type: number type: number
authorId: author_id:
type: string type: string
authorName: author_name:
type: string type: string
authorAvatar: author_avatar:
type: string type: string
views: views:
type: integer type: integer
likes: likes:
type: integer type: integer
isPurchased: is_purchased:
type: boolean type: boolean
description: User specific state description: User specific state
@@ -134,7 +137,7 @@ components:
type: string type: string
body: body:
type: string # HTML/Markdown type: string # HTML/Markdown
mediaUrls: media_urls:
type: array type: array
items: items:
type: object type: object
@@ -154,10 +157,10 @@ components:
type: string type: string
beat: beat:
type: string type: string
isLiked: is_liked:
type: boolean type: boolean
description: User specific state description: User specific state
isFavorited: is_favorited:
type: boolean type: boolean
description: User specific state description: User specific state
@@ -168,19 +171,19 @@ components:
type: string type: string
content: content:
type: string type: string
userId: user_id:
type: string type: string
userNickname: user_nickname:
type: string type: string
userAvatar: user_avatar:
type: string type: string
createTime: create_time:
type: string type: string
likes: likes:
type: integer type: integer
isLiked: is_liked:
type: boolean type: boolean
replyTo: reply_to:
type: string # Comment ID type: string # Comment ID
# --- Tenant/Creator Public Profile --- # --- Tenant/Creator Public Profile ---
@@ -199,7 +202,7 @@ components:
type: string type: string
description: description:
type: string type: string
certType: cert_type:
type: string type: string
enum: [personal, enterprise] enum: [personal, enterprise]
stats: stats:
@@ -211,7 +214,7 @@ components:
type: integer type: integer
likes: likes:
type: integer type: integer
isFollowing: is_following:
type: boolean type: boolean
# --- Order Models --- # --- Order Models ---
@@ -220,10 +223,10 @@ components:
properties: properties:
id: id:
type: string type: string
createTime: create_time:
type: string type: string
format: date-time format: date-time
payTime: pay_time:
type: string type: string
format: date-time format: date-time
status: status:
@@ -237,18 +240,18 @@ components:
type: array type: array
items: items:
$ref: '#/components/schemas/ContentItem' $ref: '#/components/schemas/ContentItem'
tenantId: tenant_id:
type: string type: string
tenantName: tenant_name:
type: string type: string
isVirtual: is_virtual:
type: boolean type: boolean
# --- Creator Dashboard Models --- # --- Creator Dashboard Models ---
CreatorStats: CreatorStats:
type: object type: object
properties: properties:
totalFollowers: total_followers:
type: object type: object
properties: properties:
value: value:
@@ -256,16 +259,16 @@ components:
trend: trend:
type: number type: number
description: Percentage change (e.g. 1.2 for +1.2%) description: Percentage change (e.g. 1.2 for +1.2%)
totalRevenue: total_revenue:
type: object type: object
properties: properties:
value: value:
type: number type: number
trend: trend:
type: number type: number
pendingRefunds: pending_refunds:
type: integer type: integer
newMessages: new_messages:
type: integer type: integer
PayoutAccount: PayoutAccount:
@@ -295,7 +298,7 @@ components:
type: string type: string
size: size:
type: integer type: integer
mimeType: mime_type:
type: string type: string
security: security:
@@ -367,7 +370,7 @@ paths:
in: query in: query
schema: schema:
type: string type: string
- name: tenantId - name: tenant_id
in: query in: query
schema: schema:
type: string type: string
@@ -387,14 +390,14 @@ paths:
content: content:
application/json: application/json:
schema: schema:
type: object allOf:
properties: - $ref: '#/components/schemas/Pager'
data: - type: object
type: array properties:
items: items:
$ref: '#/components/schemas/ContentItem' type: array
pagination: items:
$ref: '#/components/schemas/Pagination' $ref: '#/components/schemas/ContentItem'
/contents/{id}: /contents/{id}:
get: get:
@@ -433,14 +436,14 @@ paths:
content: content:
application/json: application/json:
schema: schema:
type: object allOf:
properties: - $ref: '#/components/schemas/Pager'
data: - type: object
type: array properties:
items: items:
$ref: '#/components/schemas/Comment' type: array
pagination: items:
$ref: '#/components/schemas/Pagination' $ref: '#/components/schemas/Comment'
post: post:
summary: Post a comment summary: Post a comment
requestBody: requestBody:
@@ -451,7 +454,7 @@ paths:
properties: properties:
content: content:
type: string type: string
replyTo: reply_to:
type: string type: string
responses: responses:
'200': '200':
@@ -573,7 +576,7 @@ paths:
properties: properties:
realname: realname:
type: string type: string
idCard: id_card:
type: string type: string
responses: responses:
'200': '200':
@@ -630,9 +633,9 @@ paths:
schema: schema:
type: object type: object
properties: properties:
payParams: pay_params:
type: string # QR code or SDK params type: string # QR code or SDK params
orderId: order_id:
type: string type: string
/me/orders: /me/orders:
@@ -695,7 +698,7 @@ paths:
post: post:
summary: Add to favorites summary: Add to favorites
parameters: parameters:
- name: contentId - name: content_id
in: query in: query
required: true required: true
schema: schema:
@@ -704,11 +707,11 @@ paths:
'200': '200':
description: Added description: Added
/me/favorites/{contentId}: /me/favorites/{content_id}:
delete: delete:
summary: Remove from favorites summary: Remove from favorites
parameters: parameters:
- name: contentId - name: content_id
in: path in: path
required: true required: true
schema: schema:
@@ -731,7 +734,7 @@ paths:
post: post:
summary: Like content summary: Like content
parameters: parameters:
- name: contentId - name: content_id
in: query in: query
required: true required: true
schema: schema:
@@ -740,11 +743,11 @@ paths:
'200': '200':
description: Liked description: Liked
/me/likes/{contentId}: /me/likes/{content_id}:
delete: delete:
summary: Unlike content summary: Unlike content
parameters: parameters:
- name: contentId - name: content_id
in: path in: path
required: true required: true
schema: schema:
@@ -796,7 +799,7 @@ paths:
schema: schema:
type: object type: object
properties: properties:
contentId: content_id:
type: string type: string
sku: sku:
type: string type: string
@@ -810,7 +813,7 @@ paths:
schema: schema:
type: object type: object
properties: properties:
orderId: order_id:
type: string type: string
/orders/{id}/pay: /orders/{id}/pay:
@@ -838,7 +841,7 @@ paths:
schema: schema:
type: object type: object
properties: properties:
payParams: pay_params:
type: string type: string
/orders/{id}/status: /orders/{id}/status:
@@ -931,7 +934,7 @@ paths:
type: string type: string
price: price:
type: number type: number
mediaIds: media_ids:
type: array type: array
items: items:
type: string type: string
@@ -1093,7 +1096,7 @@ paths:
method: method:
type: string type: string
enum: [wallet, external] enum: [wallet, external]
accountId: account_id:
type: string # Required if method is external type: string # Required if method is external
responses: responses:
'200': '200':
@@ -1122,4 +1125,4 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/UploadResult' $ref: '#/components/schemas/UploadResult'

View File

@@ -27,7 +27,7 @@ type User struct {
Location *Location `json:"location"` Location *Location `json:"location"`
Balance float64 `json:"balance"` Balance float64 `json:"balance"`
Points int64 `json:"points"` Points int64 `json:"points"`
IsRealNameVerified bool `json:"isRealNameVerified"` IsRealNameVerified bool `json:"is_real_name_verified"`
} }
type Location struct { type Location struct {

View File

@@ -5,5 +5,5 @@ type UploadResult struct {
URL string `json:"url"` URL string `json:"url"`
Filename string `json:"filename"` Filename string `json:"filename"`
Size int64 `json:"size"` Size int64 `json:"size"`
MimeType string `json:"mimeType"` MimeType string `json:"mime_type"`
} }

View File

@@ -1,7 +1,5 @@
package dto package dto
import "quyun/v2/app/requests"
type ContentItem struct { type ContentItem struct {
ID string `json:"id"` ID string `json:"id"`
Title string `json:"title"` Title string `json:"title"`
@@ -9,22 +7,22 @@ type ContentItem struct {
Genre string `json:"genre"` Genre string `json:"genre"`
Type string `json:"type"` // video, audio, article Type string `json:"type"` // video, audio, article
Price float64 `json:"price"` Price float64 `json:"price"`
AuthorID string `json:"authorId"` AuthorID string `json:"author_id"`
AuthorName string `json:"authorName"` AuthorName string `json:"author_name"`
AuthorAvatar string `json:"authorAvatar"` AuthorAvatar string `json:"author_avatar"`
Views int `json:"views"` Views int `json:"views"`
Likes int `json:"likes"` Likes int `json:"likes"`
IsPurchased bool `json:"isPurchased"` IsPurchased bool `json:"is_purchased"`
} }
type ContentDetail struct { type ContentDetail struct {
ContentItem ContentItem
Description string `json:"description"` Description string `json:"description"`
Body string `json:"body"` Body string `json:"body"`
MediaUrls []MediaURL `json:"mediaUrls"` MediaUrls []MediaURL `json:"media_urls"`
Meta Meta `json:"meta"` Meta Meta `json:"meta"`
IsLiked bool `json:"isLiked"` IsLiked bool `json:"is_liked"`
IsFavorited bool `json:"isFavorited"` IsFavorited bool `json:"is_favorited"`
} }
type MediaURL struct { type MediaURL struct {
@@ -42,18 +40,18 @@ type Meta struct {
type Comment struct { type Comment struct {
ID string `json:"id"` ID string `json:"id"`
Content string `json:"content"` Content string `json:"content"`
UserID string `json:"userId"` UserID string `json:"user_id"`
UserNickname string `json:"userNickname"` UserNickname string `json:"user_nickname"`
UserAvatar string `json:"userAvatar"` UserAvatar string `json:"user_avatar"`
CreateTime string `json:"createTime"` CreateTime string `json:"create_time"`
Likes int `json:"likes"` Likes int `json:"likes"`
IsLiked bool `json:"isLiked"` IsLiked bool `json:"is_liked"`
ReplyTo string `json:"replyTo"` ReplyTo string `json:"reply_to"`
} }
type CommentCreateForm struct { type CommentCreateForm struct {
Content string `json:"content"` Content string `json:"content"`
ReplyTo string `json:"replyTo"` ReplyTo string `json:"reply_to"`
} }
type Topic struct { type Topic struct {
@@ -66,9 +64,9 @@ type Topic struct {
type ContentPrice struct { type ContentPrice struct {
Currency string `json:"currency"` Currency string `json:"currency"`
PriceAmount float64 `json:"priceAmount"` PriceAmount float64 `json:"price_amount"`
DiscountType string `json:"discountType"` DiscountType string `json:"discount_type"`
DiscountValue float64 `json:"discountValue"` DiscountValue float64 `json:"discount_value"`
DiscountStartAt string `json:"discountStartAt"` DiscountStartAt string `json:"discount_start_at"`
DiscountEndAt string `json:"discountEndAt"` DiscountEndAt string `json:"discount_end_at"`
} }

View File

@@ -7,10 +7,10 @@ type ApplyForm struct {
} }
type DashboardStats struct { type DashboardStats struct {
TotalFollowers IntStatItem `json:"totalFollowers"` TotalFollowers IntStatItem `json:"total_followers"`
TotalRevenue FloatStatItem `json:"totalRevenue"` TotalRevenue FloatStatItem `json:"total_revenue"`
PendingRefunds int `json:"pendingRefunds"` PendingRefunds int `json:"pending_refunds"`
NewMessages int `json:"newMessages"` NewMessages int `json:"new_messages"`
} }
type IntStatItem struct { type IntStatItem struct {
@@ -27,14 +27,14 @@ type ContentCreateForm struct {
Title string `json:"title"` Title string `json:"title"`
Genre string `json:"genre"` Genre string `json:"genre"`
Price float64 `json:"price"` Price float64 `json:"price"`
MediaIDs []string `json:"mediaIds"` MediaIDs []string `json:"media_ids"`
} }
type ContentUpdateForm struct { type ContentUpdateForm struct {
Title string `json:"title"` Title string `json:"title"`
Genre string `json:"genre"` Genre string `json:"genre"`
Price float64 `json:"price"` Price float64 `json:"price"`
MediaIDs []string `json:"mediaIds"` MediaIDs []string `json:"media_ids"`
} }
type RefundForm struct { type RefundForm struct {
@@ -61,7 +61,7 @@ type PayoutAccount struct {
type WithdrawForm struct { type WithdrawForm struct {
Amount float64 `json:"amount"` Amount float64 `json:"amount"`
Method string `json:"method"` // wallet, external Method string `json:"method"` // wallet, external
AccountID string `json:"accountId"` AccountID string `json:"account_id"`
} }
// Re-export or Wrap // Re-export or Wrap

View File

@@ -1,13 +1,13 @@
package dto package dto
type OrderCreateForm struct { type OrderCreateForm struct {
ContentID string `json:"contentId"` ContentID string `json:"content_id"`
Sku string `json:"sku"` Sku string `json:"sku"`
Quantity int `json:"quantity"` Quantity int `json:"quantity"`
} }
type OrderCreateResponse struct { type OrderCreateResponse struct {
OrderID string `json:"orderId"` OrderID string `json:"order_id"`
} }
type OrderPayForm struct { type OrderPayForm struct {
@@ -15,7 +15,7 @@ type OrderPayForm struct {
} }
type OrderPayResponse struct { type OrderPayResponse struct {
PayParams string `json:"payParams"` PayParams string `json:"pay_params"`
} }
type OrderStatusResponse struct { type OrderStatusResponse struct {

View File

@@ -7,9 +7,9 @@ type TenantProfile struct {
Cover string `json:"cover"` Cover string `json:"cover"`
Bio string `json:"bio"` Bio string `json:"bio"`
Description string `json:"description"` Description string `json:"description"`
CertType string `json:"certType"` // personal, enterprise CertType string `json:"cert_type"` // personal, enterprise
Stats Stats `json:"stats"` Stats Stats `json:"stats"`
IsFollowing bool `json:"isFollowing"` IsFollowing bool `json:"is_following"`
} }
type Stats struct { type Stats struct {

View File

@@ -13,7 +13,7 @@ type UserUpdate struct {
type RealNameForm struct { type RealNameForm struct {
Realname string `json:"realname"` Realname string `json:"realname"`
IDCard string `json:"idCard"` IDCard string `json:"id_card"`
} }
type WalletResponse struct { type WalletResponse struct {
@@ -35,21 +35,21 @@ type RechargeForm struct {
} }
type RechargeResponse struct { type RechargeResponse struct {
PayParams string `json:"payParams"` PayParams string `json:"pay_params"`
OrderID string `json:"orderId"` OrderID string `json:"order_id"`
} }
type Order struct { type Order struct {
ID string `json:"id"` ID string `json:"id"`
CreateTime string `json:"createTime"` CreateTime string `json:"create_time"`
PayTime string `json:"payTime"` PayTime string `json:"pay_time"`
Status string `json:"status"` Status string `json:"status"`
Amount float64 `json:"amount"` Amount float64 `json:"amount"`
Quantity int `json:"quantity"` Quantity int `json:"quantity"`
Items []ContentItem `json:"items"` Items []ContentItem `json:"items"`
TenantID string `json:"tenantId"` TenantID string `json:"tenant_id"`
TenantName string `json:"tenantName"` TenantName string `json:"tenant_name"`
IsVirtual bool `json:"isVirtual"` IsVirtual bool `json:"is_virtual"`
} }
type Notification struct { type Notification struct {