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"`
}
+2 -2
View File
@@ -125,8 +125,8 @@ type VerificationIdReq struct {
}
type VerificationItem struct {
Id int64 `json:"id"` // 认证记录ID (主键,用于管理员操作)
UserId int64 `json:"userId"` // 申请人ID (外键)
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
+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"`
+3 -3
View File
@@ -7,12 +7,12 @@ type (
Id int64 `path:"id"`
}
Post {
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"`
@@ -37,7 +37,7 @@ type (
Meta PageMeta `json:"meta"`
}
Comment {
Id int64 `json:"id"`
Id int64 `json:"id,string"`
Content string `json:"content"`
Author UserProfile `json:"author"`
LikeCount int64 `json:"likeCount"`
+6 -5
View File
@@ -7,11 +7,11 @@ type (
Id int64 `path:"id"`
}
Dispute {
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"`
@@ -20,7 +20,7 @@ type (
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"`
@@ -74,3 +74,4 @@ service dispute-api {
@handler AppealDispute
post /disputes/:id/appeal (AppealReq) returns (EmptyResp)
}
+1 -1
View File
@@ -4,7 +4,7 @@ import "common.api"
type (
Game {
Id int64 `json:"id,optional"`
Id int64 `json:"id,string,optional"`
Name string `json:"name"`
Icon string `json:"icon"`
Category string `json:"category"`
+2 -1
View File
@@ -7,7 +7,7 @@ type (
Id int64 `path:"id"`
}
Notification {
Id int64 `json:"id"`
Id int64 `json:"id,string"`
Type string `json:"type"`
Title string `json:"title"`
Content string `json:"content"`
@@ -38,3 +38,4 @@ service notifi-api {
@handler ReadAllNotifications
put /notifications/read-all (EmptyResp) returns (EmptyResp)
}
+9 -9
View File
@@ -14,9 +14,9 @@ type (
Id int64 `path:"id"`
}
PlayerService {
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"`
@@ -26,10 +26,10 @@ type (
Availability []string `json:"availability"`
}
Order {
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"`
@@ -48,9 +48,9 @@ type (
Meta PageMeta `json:"meta"`
}
CreateOrderReq {
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"`
}
+6 -6
View File
@@ -11,9 +11,9 @@ import "common.api"
type (
PlayerService {
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"`
@@ -27,7 +27,7 @@ type (
Meta PageMeta `json:"meta"`
}
CreateServiceReq {
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"`
@@ -37,7 +37,7 @@ type (
}
UpdateServiceReq {
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"`
@@ -46,7 +46,7 @@ type (
Availability []string `json:"availability"`
}
PlayerProfile {
Id int64 `json:"id"`
Id int64 `json:"id,string"`
User UserProfile `json:"user"`
Rating float64 `json:"rating"`
TotalOrders int64 `json:"totalOrders"`
+4 -3
View File
@@ -7,9 +7,9 @@ type (
Id int64 `path:"id"`
}
Review {
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"`
@@ -61,3 +61,4 @@ service review-api {
@handler ListUserReviews
get /users/:id/reviews (ListUserReviewsReq) returns (ReviewListResp)
}
+5 -5
View File
@@ -57,7 +57,7 @@ type (
}
InvitationReq {
Id int64 `path:"id"`
PlayerId int64 `json:"playerId"`
PlayerId int64 `json:"playerId,string"`
}
)
@@ -101,11 +101,11 @@ type (
Id int64 `path:"id"`
}
ShopInvitation {
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"`
}
+3 -2
View File
@@ -18,8 +18,8 @@ type (
// 认证记录展示对象
// 对应数据库 user_verifications 表
VerificationItem {
Id int64 `json:"id"` // 认证记录ID (主键,用于管理员操作)
UserId int64 `json:"userId"` // 申请人ID (外键)
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
@@ -260,3 +260,4 @@ service users-api {
@handler RejectVerification
post /verifications/:id/reject (RejectVerificationReq) returns (VerificationEmptyResp)
}
+1 -1
View File
@@ -15,7 +15,7 @@ type (
FrozenBalance string `json:"frozenBalance"`
}
Transaction {
Id int64 `json:"id"`
Id int64 `json:"id,string"`
Type string `json:"type"`
Amount string `json:"amount"`
Description string `json:"description"`