fix: int64 ID 字段序列化为 JSON string

This commit is contained in:
zetaloop
2026-05-03 05:54:48 +08:00
parent 83fa982749
commit cf639f1bca
22 changed files with 86 additions and 82 deletions
+3 -3
View File
@@ -4,7 +4,7 @@
package types
type Comment struct {
Id int64 `json:"id"`
Id int64 `json:"id,string"`
Content string `json:"content"`
Author UserProfile `json:"author"`
LikeCount int64 `json:"likeCount"`
@@ -54,12 +54,12 @@ type PathId struct {
}
type Post struct {
Id int64 `json:"id"`
Id int64 `json:"id,string"`
Title string `json:"title"`
Content string `json:"content"`
Images []string `json:"images"`
Tags []string `json:"tags"`
LinkedOrderId int64 `json:"linkedOrderId,optional"`
LinkedOrderId int64 `json:"linkedOrderId,string,optional"`
Pinned bool `json:"pinned"`
LikeCount int64 `json:"likeCount"`
CommentCount int64 `json:"commentCount"`
+5 -5
View File
@@ -15,11 +15,11 @@ type CreateDisputeReq struct {
}
type Dispute struct {
Id int64 `json:"id"`
OrderId int64 `json:"orderId"`
InitiatorId int64 `json:"initiatorId"`
Id int64 `json:"id,string"`
OrderId int64 `json:"orderId,string"`
InitiatorId int64 `json:"initiatorId,string"`
InitiatorName string `json:"initiatorName"`
RespondentId int64 `json:"respondentId"`
RespondentId int64 `json:"respondentId,string"`
Reason string `json:"reason"`
Evidence []string `json:"evidence"`
Status string `json:"status"`
@@ -28,7 +28,7 @@ type Dispute struct {
RespondentEvidence []string `json:"respondentEvidence"`
AppealReason string `json:"appealReason,optional"`
AppealedAt string `json:"appealedAt,optional"`
ResolvedBy int64 `json:"resolvedBy,optional"`
ResolvedBy int64 `json:"resolvedBy,string,optional"`
ResolvedAt string `json:"resolvedAt,optional"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
+1 -1
View File
@@ -1,5 +1,5 @@
// Code generated by goctl. DO NOT EDIT.
// goctl 1.9.2
// goctl 1.10.1
package handler
+1 -1
View File
@@ -7,7 +7,7 @@ type EmptyResp struct {
}
type Game struct {
Id int64 `json:"id,optional"`
Id int64 `json:"id,string,optional"`
Name string `json:"name"`
Icon string `json:"icon"`
Category string `json:"category"`
+1 -1
View File
@@ -7,7 +7,7 @@ type EmptyResp struct {
}
type Notification struct {
Id int64 `json:"id"`
Id int64 `json:"id,string"`
Type string `json:"type"`
Title string `json:"title"`
Content string `json:"content"`
+9 -9
View File
@@ -4,9 +4,9 @@
package types
type CreateOrderReq struct {
PlayerId int64 `json:"playerId"`
ShopId int64 `json:"shopId,optional"`
ServiceId int64 `json:"serviceId"`
PlayerId int64 `json:"playerId,string"`
ShopId int64 `json:"shopId,string,optional"`
ServiceId int64 `json:"serviceId,string"`
Quantity int `json:"quantity"`
Note string `json:"note,optional"`
}
@@ -20,10 +20,10 @@ type EmptyResp struct {
}
type Order struct {
Id int64 `json:"id"`
ConsumerId int64 `json:"consumerId"`
Id int64 `json:"id,string"`
ConsumerId int64 `json:"consumerId,string"`
PlayerId string `json:"playerId"`
ShopId int64 `json:"shopId,optional"`
ShopId int64 `json:"shopId,string,optional"`
Service PlayerService `json:"service"`
Status string `json:"status"`
TotalPrice float64 `json:"totalPrice"`
@@ -60,9 +60,9 @@ type PathId struct {
}
type PlayerService struct {
Id int64 `json:"id"`
PlayerId int64 `json:"playerId"`
GameId int64 `json:"gameId"`
Id int64 `json:"id,string"`
PlayerId int64 `json:"playerId,string"`
GameId int64 `json:"gameId,string"`
GameName string `json:"gameName"`
Title string `json:"title"`
Description string `json:"description"`
+6 -6
View File
@@ -4,7 +4,7 @@
package types
type CreateServiceReq struct {
GameId int64 `json:"gameId,optional"`
GameId int64 `json:"gameId,string,optional"`
Title string `json:"title,optional"`
Description string `json:"description,optional"`
Price float64 `json:"price"`
@@ -56,7 +56,7 @@ type PlayerListResp struct {
}
type PlayerProfile struct {
Id int64 `json:"id"`
Id int64 `json:"id,string"`
User UserProfile `json:"user"`
Rating float64 `json:"rating"`
TotalOrders int64 `json:"totalOrders"`
@@ -71,9 +71,9 @@ type PlayerProfile struct {
}
type PlayerService struct {
Id int64 `json:"id,optional"`
PlayerId int64 `json:"playerId"`
GameId int64 `json:"gameId"`
Id int64 `json:"id,string,optional"`
PlayerId int64 `json:"playerId,string"`
GameId int64 `json:"gameId,string"`
GameName string `json:"gameName"`
Title string `json:"title"`
Description string `json:"description"`
@@ -100,7 +100,7 @@ type UpdatePlayerStatusReq struct {
type UpdateServiceReq struct {
Id int64 `path:"id"`
GameId *int64 `json:"gameId,optional"`
GameId *int64 `json:"gameId,string,optional"`
Title *string `json:"title,optional"`
Description *string `json:"description,optional"`
Price *float64 `json:"price,optional"`
+3 -3
View File
@@ -27,9 +27,9 @@ type PageReq struct {
}
type Review struct {
Id int64 `json:"id"`
OrderId int64 `json:"orderId"`
FromUserId int64 `json:"fromUserId"`
Id int64 `json:"id,string"`
OrderId int64 `json:"orderId,string"`
FromUserId int64 `json:"fromUserId,string"`
FromUserName string `json:"fromUserName"`
Rating int `json:"rating"`
Content string `json:"content"`
+5 -5
View File
@@ -37,7 +37,7 @@ type IncomeStatsResp struct {
type InvitationReq struct {
Id int64 `path:"id"`
PlayerId int64 `json:"playerId"`
PlayerId int64 `json:"playerId,string"`
}
type PageMeta struct {
@@ -61,11 +61,11 @@ type ShopIdReq struct {
}
type ShopInvitation struct {
Id int64 `json:"id"`
ShopId int64 `json:"shopId"`
PlayerId int64 `json:"playerId"`
Id int64 `json:"id,string"`
ShopId int64 `json:"shopId,string"`
PlayerId int64 `json:"playerId,string"`
Status string `json:"status"`
InvitedBy int64 `json:"invitedBy"`
InvitedBy int64 `json:"invitedBy,string"`
CreatedAt int64 `json:"createdAt"`
RespondedAt int64 `json:"respondedAt,optional"`
}
+9 -9
View File
@@ -125,13 +125,13 @@ type VerificationIdReq struct {
}
type VerificationItem struct {
Id int64 `json:"id"` // 认证记录ID (主键,用于管理员操作)
UserId int64 `json:"userId"` // 申请人ID (外键)
UserNickname string `json:"userNickname"` // 冗余显示,方便前端展示
Role string `json:"role"` // 申请角色: player, owner
Status string `json:"status"` // pending, approved, rejected
Materials map[string]string `json:"materials"` // 核心字段:对应 DB 的 JSONB
RejectReason string `json:"rejectReason"` // 驳回原因
CreatedAt string `json:"createdAt"` // 申请时间
ReviewedAt string `json:"reviewedAt"` // 审核时间
Id int64 `json:"id,string"` // 认证记录ID (主键,用于管理员操作)
UserId int64 `json:"userId,string"` // 申请人ID (外键)
UserNickname string `json:"userNickname"` // 冗余显示,方便前端展示
Role string `json:"role"` // 申请角色: player, owner
Status string `json:"status"` // pending, approved, rejected
Materials map[string]string `json:"materials"` // 核心字段:对应 DB 的 JSONB
RejectReason string `json:"rejectReason"` // 驳回原因
CreatedAt string `json:"createdAt"` // 申请时间
ReviewedAt string `json:"reviewedAt"` // 审核时间
}
+1 -1
View File
@@ -1,5 +1,5 @@
// Code generated by goctl. DO NOT EDIT.
// goctl 1.9.2
// goctl 1.10.1
package handler
+2 -2
View File
@@ -1,5 +1,5 @@
// Code generated by goctl. DO NOT EDIT.
// goctl 1.9.2
// goctl 1.10.1
package types
@@ -29,7 +29,7 @@ type TopupReq struct {
}
type Transaction struct {
Id int64 `json:"id"`
Id int64 `json:"id,string"`
Type string `json:"type"`
Amount string `json:"amount"`
Description string `json:"description"`