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 package types
type Comment struct { type Comment struct {
Id int64 `json:"id"` Id int64 `json:"id,string"`
Content string `json:"content"` Content string `json:"content"`
Author UserProfile `json:"author"` Author UserProfile `json:"author"`
LikeCount int64 `json:"likeCount"` LikeCount int64 `json:"likeCount"`
@@ -54,12 +54,12 @@ type PathId struct {
} }
type Post struct { type Post struct {
Id int64 `json:"id"` Id int64 `json:"id,string"`
Title string `json:"title"` Title string `json:"title"`
Content string `json:"content"` Content string `json:"content"`
Images []string `json:"images"` Images []string `json:"images"`
Tags []string `json:"tags"` Tags []string `json:"tags"`
LinkedOrderId int64 `json:"linkedOrderId,optional"` LinkedOrderId int64 `json:"linkedOrderId,string,optional"`
Pinned bool `json:"pinned"` Pinned bool `json:"pinned"`
LikeCount int64 `json:"likeCount"` LikeCount int64 `json:"likeCount"`
CommentCount int64 `json:"commentCount"` CommentCount int64 `json:"commentCount"`
+5 -5
View File
@@ -15,11 +15,11 @@ type CreateDisputeReq struct {
} }
type Dispute struct { type Dispute struct {
Id int64 `json:"id"` Id int64 `json:"id,string"`
OrderId int64 `json:"orderId"` OrderId int64 `json:"orderId,string"`
InitiatorId int64 `json:"initiatorId"` InitiatorId int64 `json:"initiatorId,string"`
InitiatorName string `json:"initiatorName"` InitiatorName string `json:"initiatorName"`
RespondentId int64 `json:"respondentId"` RespondentId int64 `json:"respondentId,string"`
Reason string `json:"reason"` Reason string `json:"reason"`
Evidence []string `json:"evidence"` Evidence []string `json:"evidence"`
Status string `json:"status"` Status string `json:"status"`
@@ -28,7 +28,7 @@ type Dispute struct {
RespondentEvidence []string `json:"respondentEvidence"` RespondentEvidence []string `json:"respondentEvidence"`
AppealReason string `json:"appealReason,optional"` AppealReason string `json:"appealReason,optional"`
AppealedAt string `json:"appealedAt,optional"` AppealedAt string `json:"appealedAt,optional"`
ResolvedBy int64 `json:"resolvedBy,optional"` ResolvedBy int64 `json:"resolvedBy,string,optional"`
ResolvedAt string `json:"resolvedAt,optional"` ResolvedAt string `json:"resolvedAt,optional"`
CreatedAt string `json:"createdAt"` CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"` UpdatedAt string `json:"updatedAt"`
+1 -1
View File
@@ -1,5 +1,5 @@
// Code generated by goctl. DO NOT EDIT. // Code generated by goctl. DO NOT EDIT.
// goctl 1.9.2 // goctl 1.10.1
package handler package handler
+1 -1
View File
@@ -7,7 +7,7 @@ type EmptyResp struct {
} }
type Game struct { type Game struct {
Id int64 `json:"id,optional"` Id int64 `json:"id,string,optional"`
Name string `json:"name"` Name string `json:"name"`
Icon string `json:"icon"` Icon string `json:"icon"`
Category string `json:"category"` Category string `json:"category"`
+1 -1
View File
@@ -7,7 +7,7 @@ type EmptyResp struct {
} }
type Notification struct { type Notification struct {
Id int64 `json:"id"` Id int64 `json:"id,string"`
Type string `json:"type"` Type string `json:"type"`
Title string `json:"title"` Title string `json:"title"`
Content string `json:"content"` Content string `json:"content"`
+9 -9
View File
@@ -4,9 +4,9 @@
package types package types
type CreateOrderReq struct { type CreateOrderReq struct {
PlayerId int64 `json:"playerId"` PlayerId int64 `json:"playerId,string"`
ShopId int64 `json:"shopId,optional"` ShopId int64 `json:"shopId,string,optional"`
ServiceId int64 `json:"serviceId"` ServiceId int64 `json:"serviceId,string"`
Quantity int `json:"quantity"` Quantity int `json:"quantity"`
Note string `json:"note,optional"` Note string `json:"note,optional"`
} }
@@ -20,10 +20,10 @@ type EmptyResp struct {
} }
type Order struct { type Order struct {
Id int64 `json:"id"` Id int64 `json:"id,string"`
ConsumerId int64 `json:"consumerId"` ConsumerId int64 `json:"consumerId,string"`
PlayerId string `json:"playerId"` PlayerId string `json:"playerId"`
ShopId int64 `json:"shopId,optional"` ShopId int64 `json:"shopId,string,optional"`
Service PlayerService `json:"service"` Service PlayerService `json:"service"`
Status string `json:"status"` Status string `json:"status"`
TotalPrice float64 `json:"totalPrice"` TotalPrice float64 `json:"totalPrice"`
@@ -60,9 +60,9 @@ type PathId struct {
} }
type PlayerService struct { type PlayerService struct {
Id int64 `json:"id"` Id int64 `json:"id,string"`
PlayerId int64 `json:"playerId"` PlayerId int64 `json:"playerId,string"`
GameId int64 `json:"gameId"` GameId int64 `json:"gameId,string"`
GameName string `json:"gameName"` GameName string `json:"gameName"`
Title string `json:"title"` Title string `json:"title"`
Description string `json:"description"` Description string `json:"description"`
+6 -6
View File
@@ -4,7 +4,7 @@
package types package types
type CreateServiceReq struct { type CreateServiceReq struct {
GameId int64 `json:"gameId,optional"` GameId int64 `json:"gameId,string,optional"`
Title string `json:"title,optional"` Title string `json:"title,optional"`
Description string `json:"description,optional"` Description string `json:"description,optional"`
Price float64 `json:"price"` Price float64 `json:"price"`
@@ -56,7 +56,7 @@ type PlayerListResp struct {
} }
type PlayerProfile struct { type PlayerProfile struct {
Id int64 `json:"id"` Id int64 `json:"id,string"`
User UserProfile `json:"user"` User UserProfile `json:"user"`
Rating float64 `json:"rating"` Rating float64 `json:"rating"`
TotalOrders int64 `json:"totalOrders"` TotalOrders int64 `json:"totalOrders"`
@@ -71,9 +71,9 @@ type PlayerProfile struct {
} }
type PlayerService struct { type PlayerService struct {
Id int64 `json:"id,optional"` Id int64 `json:"id,string,optional"`
PlayerId int64 `json:"playerId"` PlayerId int64 `json:"playerId,string"`
GameId int64 `json:"gameId"` GameId int64 `json:"gameId,string"`
GameName string `json:"gameName"` GameName string `json:"gameName"`
Title string `json:"title"` Title string `json:"title"`
Description string `json:"description"` Description string `json:"description"`
@@ -100,7 +100,7 @@ type UpdatePlayerStatusReq struct {
type UpdateServiceReq struct { type UpdateServiceReq struct {
Id int64 `path:"id"` Id int64 `path:"id"`
GameId *int64 `json:"gameId,optional"` GameId *int64 `json:"gameId,string,optional"`
Title *string `json:"title,optional"` Title *string `json:"title,optional"`
Description *string `json:"description,optional"` Description *string `json:"description,optional"`
Price *float64 `json:"price,optional"` Price *float64 `json:"price,optional"`
+3 -3
View File
@@ -27,9 +27,9 @@ type PageReq struct {
} }
type Review struct { type Review struct {
Id int64 `json:"id"` Id int64 `json:"id,string"`
OrderId int64 `json:"orderId"` OrderId int64 `json:"orderId,string"`
FromUserId int64 `json:"fromUserId"` FromUserId int64 `json:"fromUserId,string"`
FromUserName string `json:"fromUserName"` FromUserName string `json:"fromUserName"`
Rating int `json:"rating"` Rating int `json:"rating"`
Content string `json:"content"` Content string `json:"content"`
+5 -5
View File
@@ -37,7 +37,7 @@ type IncomeStatsResp struct {
type InvitationReq struct { type InvitationReq struct {
Id int64 `path:"id"` Id int64 `path:"id"`
PlayerId int64 `json:"playerId"` PlayerId int64 `json:"playerId,string"`
} }
type PageMeta struct { type PageMeta struct {
@@ -61,11 +61,11 @@ type ShopIdReq struct {
} }
type ShopInvitation struct { type ShopInvitation struct {
Id int64 `json:"id"` Id int64 `json:"id,string"`
ShopId int64 `json:"shopId"` ShopId int64 `json:"shopId,string"`
PlayerId int64 `json:"playerId"` PlayerId int64 `json:"playerId,string"`
Status string `json:"status"` Status string `json:"status"`
InvitedBy int64 `json:"invitedBy"` InvitedBy int64 `json:"invitedBy,string"`
CreatedAt int64 `json:"createdAt"` CreatedAt int64 `json:"createdAt"`
RespondedAt int64 `json:"respondedAt,optional"` RespondedAt int64 `json:"respondedAt,optional"`
} }
+2 -2
View File
@@ -125,8 +125,8 @@ type VerificationIdReq struct {
} }
type VerificationItem struct { type VerificationItem struct {
Id int64 `json:"id"` // 认证记录ID (主键,用于管理员操作) Id int64 `json:"id,string"` // 认证记录ID (主键,用于管理员操作)
UserId int64 `json:"userId"` // 申请人ID (外键) UserId int64 `json:"userId,string"` // 申请人ID (外键)
UserNickname string `json:"userNickname"` // 冗余显示,方便前端展示 UserNickname string `json:"userNickname"` // 冗余显示,方便前端展示
Role string `json:"role"` // 申请角色: player, owner Role string `json:"role"` // 申请角色: player, owner
Status string `json:"status"` // pending, approved, rejected Status string `json:"status"` // pending, approved, rejected
+1 -1
View File
@@ -1,5 +1,5 @@
// Code generated by goctl. DO NOT EDIT. // Code generated by goctl. DO NOT EDIT.
// goctl 1.9.2 // goctl 1.10.1
package handler package handler
+2 -2
View File
@@ -1,5 +1,5 @@
// Code generated by goctl. DO NOT EDIT. // Code generated by goctl. DO NOT EDIT.
// goctl 1.9.2 // goctl 1.10.1
package types package types
@@ -29,7 +29,7 @@ type TopupReq struct {
} }
type Transaction struct { type Transaction struct {
Id int64 `json:"id"` Id int64 `json:"id,string"`
Type string `json:"type"` Type string `json:"type"`
Amount string `json:"amount"` Amount string `json:"amount"`
Description string `json:"description"` Description string `json:"description"`
+3 -3
View File
@@ -7,12 +7,12 @@ type (
Id int64 `path:"id"` Id int64 `path:"id"`
} }
Post { Post {
Id int64 `json:"id"` Id int64 `json:"id,string"`
Title string `json:"title"` Title string `json:"title"`
Content string `json:"content"` Content string `json:"content"`
Images []string `json:"images"` Images []string `json:"images"`
Tags []string `json:"tags"` Tags []string `json:"tags"`
LinkedOrderId int64 `json:"linkedOrderId,optional"` LinkedOrderId int64 `json:"linkedOrderId,string,optional"`
Pinned bool `json:"pinned"` Pinned bool `json:"pinned"`
LikeCount int64 `json:"likeCount"` LikeCount int64 `json:"likeCount"`
CommentCount int64 `json:"commentCount"` CommentCount int64 `json:"commentCount"`
@@ -37,7 +37,7 @@ type (
Meta PageMeta `json:"meta"` Meta PageMeta `json:"meta"`
} }
Comment { Comment {
Id int64 `json:"id"` Id int64 `json:"id,string"`
Content string `json:"content"` Content string `json:"content"`
Author UserProfile `json:"author"` Author UserProfile `json:"author"`
LikeCount int64 `json:"likeCount"` LikeCount int64 `json:"likeCount"`
+6 -5
View File
@@ -7,11 +7,11 @@ type (
Id int64 `path:"id"` Id int64 `path:"id"`
} }
Dispute { Dispute {
Id int64 `json:"id"` Id int64 `json:"id,string"`
OrderId int64 `json:"orderId"` OrderId int64 `json:"orderId,string"`
InitiatorId int64 `json:"initiatorId"` InitiatorId int64 `json:"initiatorId,string"`
InitiatorName string `json:"initiatorName"` InitiatorName string `json:"initiatorName"`
RespondentId int64 `json:"respondentId"` RespondentId int64 `json:"respondentId,string"`
Reason string `json:"reason"` Reason string `json:"reason"`
Evidence []string `json:"evidence"` Evidence []string `json:"evidence"`
Status string `json:"status"` Status string `json:"status"`
@@ -20,7 +20,7 @@ type (
RespondentEvidence []string `json:"respondentEvidence"` RespondentEvidence []string `json:"respondentEvidence"`
AppealReason string `json:"appealReason,optional"` AppealReason string `json:"appealReason,optional"`
AppealedAt string `json:"appealedAt,optional"` AppealedAt string `json:"appealedAt,optional"`
ResolvedBy int64 `json:"resolvedBy,optional"` ResolvedBy int64 `json:"resolvedBy,string,optional"`
ResolvedAt string `json:"resolvedAt,optional"` ResolvedAt string `json:"resolvedAt,optional"`
CreatedAt string `json:"createdAt"` CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"` UpdatedAt string `json:"updatedAt"`
@@ -74,3 +74,4 @@ service dispute-api {
@handler AppealDispute @handler AppealDispute
post /disputes/:id/appeal (AppealReq) returns (EmptyResp) post /disputes/:id/appeal (AppealReq) returns (EmptyResp)
} }
+1 -1
View File
@@ -4,7 +4,7 @@ import "common.api"
type ( type (
Game { Game {
Id int64 `json:"id,optional"` Id int64 `json:"id,string,optional"`
Name string `json:"name"` Name string `json:"name"`
Icon string `json:"icon"` Icon string `json:"icon"`
Category string `json:"category"` Category string `json:"category"`
+2 -1
View File
@@ -7,7 +7,7 @@ type (
Id int64 `path:"id"` Id int64 `path:"id"`
} }
Notification { Notification {
Id int64 `json:"id"` Id int64 `json:"id,string"`
Type string `json:"type"` Type string `json:"type"`
Title string `json:"title"` Title string `json:"title"`
Content string `json:"content"` Content string `json:"content"`
@@ -38,3 +38,4 @@ service notifi-api {
@handler ReadAllNotifications @handler ReadAllNotifications
put /notifications/read-all (EmptyResp) returns (EmptyResp) put /notifications/read-all (EmptyResp) returns (EmptyResp)
} }
+9 -9
View File
@@ -14,9 +14,9 @@ type (
Id int64 `path:"id"` Id int64 `path:"id"`
} }
PlayerService { PlayerService {
Id int64 `json:"id"` Id int64 `json:"id,string"`
PlayerId int64 `json:"playerId"` PlayerId int64 `json:"playerId,string"`
GameId int64 `json:"gameId"` GameId int64 `json:"gameId,string"`
GameName string `json:"gameName"` GameName string `json:"gameName"`
Title string `json:"title"` Title string `json:"title"`
Description string `json:"description"` Description string `json:"description"`
@@ -26,10 +26,10 @@ type (
Availability []string `json:"availability"` Availability []string `json:"availability"`
} }
Order { Order {
Id int64 `json:"id"` Id int64 `json:"id,string"`
ConsumerId int64 `json:"consumerId"` ConsumerId int64 `json:"consumerId,string"`
PlayerId string `json:"playerId"` PlayerId string `json:"playerId"`
ShopId int64 `json:"shopId,optional"` ShopId int64 `json:"shopId,string,optional"`
Service PlayerService `json:"service"` Service PlayerService `json:"service"`
Status string `json:"status"` Status string `json:"status"`
TotalPrice float64 `json:"totalPrice"` TotalPrice float64 `json:"totalPrice"`
@@ -48,9 +48,9 @@ type (
Meta PageMeta `json:"meta"` Meta PageMeta `json:"meta"`
} }
CreateOrderReq { CreateOrderReq {
PlayerId int64 `json:"playerId"` PlayerId int64 `json:"playerId,string"`
ShopId int64 `json:"shopId,optional"` ShopId int64 `json:"shopId,string,optional"`
ServiceId int64 `json:"serviceId"` ServiceId int64 `json:"serviceId,string"`
Quantity int `json:"quantity"` Quantity int `json:"quantity"`
Note string `json:"note,optional"` Note string `json:"note,optional"`
} }
+6 -6
View File
@@ -11,9 +11,9 @@ import "common.api"
type ( type (
PlayerService { PlayerService {
Id int64 `json:"id,optional"` Id int64 `json:"id,string,optional"`
PlayerId int64 `json:"playerId"` PlayerId int64 `json:"playerId,string"`
GameId int64 `json:"gameId"` GameId int64 `json:"gameId,string"`
GameName string `json:"gameName"` GameName string `json:"gameName"`
Title string `json:"title"` Title string `json:"title"`
Description string `json:"description"` Description string `json:"description"`
@@ -27,7 +27,7 @@ type (
Meta PageMeta `json:"meta"` Meta PageMeta `json:"meta"`
} }
CreateServiceReq { CreateServiceReq {
GameId int64 `json:"gameId,optional"` GameId int64 `json:"gameId,string,optional"`
Title string `json:"title,optional"` Title string `json:"title,optional"`
Description string `json:"description,optional"` Description string `json:"description,optional"`
Price float64 `json:"price"` Price float64 `json:"price"`
@@ -37,7 +37,7 @@ type (
} }
UpdateServiceReq { UpdateServiceReq {
Id int64 `path:"id"` Id int64 `path:"id"`
GameId *int64 `json:"gameId,optional"` GameId *int64 `json:"gameId,string,optional"`
Title *string `json:"title,optional"` Title *string `json:"title,optional"`
Description *string `json:"description,optional"` Description *string `json:"description,optional"`
Price *float64 `json:"price,optional"` Price *float64 `json:"price,optional"`
@@ -46,7 +46,7 @@ type (
Availability []string `json:"availability"` Availability []string `json:"availability"`
} }
PlayerProfile { PlayerProfile {
Id int64 `json:"id"` Id int64 `json:"id,string"`
User UserProfile `json:"user"` User UserProfile `json:"user"`
Rating float64 `json:"rating"` Rating float64 `json:"rating"`
TotalOrders int64 `json:"totalOrders"` TotalOrders int64 `json:"totalOrders"`
+4 -3
View File
@@ -7,9 +7,9 @@ type (
Id int64 `path:"id"` Id int64 `path:"id"`
} }
Review { Review {
Id int64 `json:"id"` Id int64 `json:"id,string"`
OrderId int64 `json:"orderId"` OrderId int64 `json:"orderId,string"`
FromUserId int64 `json:"fromUserId"` FromUserId int64 `json:"fromUserId,string"`
FromUserName string `json:"fromUserName"` FromUserName string `json:"fromUserName"`
Rating int `json:"rating"` Rating int `json:"rating"`
Content string `json:"content"` Content string `json:"content"`
@@ -61,3 +61,4 @@ service review-api {
@handler ListUserReviews @handler ListUserReviews
get /users/:id/reviews (ListUserReviewsReq) returns (ReviewListResp) get /users/:id/reviews (ListUserReviewsReq) returns (ReviewListResp)
} }
+5 -5
View File
@@ -57,7 +57,7 @@ type (
} }
InvitationReq { InvitationReq {
Id int64 `path:"id"` Id int64 `path:"id"`
PlayerId int64 `json:"playerId"` PlayerId int64 `json:"playerId,string"`
} }
) )
@@ -101,11 +101,11 @@ type (
Id int64 `path:"id"` Id int64 `path:"id"`
} }
ShopInvitation { ShopInvitation {
Id int64 `json:"id"` Id int64 `json:"id,string"`
ShopId int64 `json:"shopId"` ShopId int64 `json:"shopId,string"`
PlayerId int64 `json:"playerId"` PlayerId int64 `json:"playerId,string"`
Status string `json:"status"` Status string `json:"status"`
InvitedBy int64 `json:"invitedBy"` InvitedBy int64 `json:"invitedBy,string"`
CreatedAt int64 `json:"createdAt"` CreatedAt int64 `json:"createdAt"`
RespondedAt int64 `json:"respondedAt,optional"` RespondedAt int64 `json:"respondedAt,optional"`
} }
+3 -2
View File
@@ -18,8 +18,8 @@ type (
// 认证记录展示对象 // 认证记录展示对象
// 对应数据库 user_verifications 表 // 对应数据库 user_verifications 表
VerificationItem { VerificationItem {
Id int64 `json:"id"` // 认证记录ID (主键,用于管理员操作) Id int64 `json:"id,string"` // 认证记录ID (主键,用于管理员操作)
UserId int64 `json:"userId"` // 申请人ID (外键) UserId int64 `json:"userId,string"` // 申请人ID (外键)
UserNickname string `json:"userNickname"` // 冗余显示,方便前端展示 UserNickname string `json:"userNickname"` // 冗余显示,方便前端展示
Role string `json:"role"` // 申请角色: player, owner Role string `json:"role"` // 申请角色: player, owner
Status string `json:"status"` // pending, approved, rejected Status string `json:"status"` // pending, approved, rejected
@@ -260,3 +260,4 @@ service users-api {
@handler RejectVerification @handler RejectVerification
post /verifications/:id/reject (RejectVerificationReq) returns (VerificationEmptyResp) post /verifications/:id/reject (RejectVerificationReq) returns (VerificationEmptyResp)
} }
+1 -1
View File
@@ -15,7 +15,7 @@ type (
FrozenBalance string `json:"frozenBalance"` FrozenBalance string `json:"frozenBalance"`
} }
Transaction { Transaction {
Id int64 `json:"id"` Id int64 `json:"id,string"`
Type string `json:"type"` Type string `json:"type"`
Amount string `json:"amount"` Amount string `json:"amount"`
Description string `json:"description"` Description string `json:"description"`