From cf639f1bca8b6255e7315fd70b0dd3831c61bca4 Mon Sep 17 00:00:00 2001 From: zetaloop Date: Sun, 3 May 2026 05:54:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20int64=20ID=20=E5=AD=97=E6=AE=B5=E5=BA=8F?= =?UTF-8?q?=E5=88=97=E5=8C=96=E4=B8=BA=20JSON=20string?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/community/api/internal/types/types.go | 6 +++--- app/dispute/api/internal/types/types.go | 10 +++++----- app/game/api/internal/handler/routes.go | 2 +- app/game/api/internal/types/types.go | 2 +- app/notification/api/internal/types/types.go | 2 +- app/order/api/internal/types/types.go | 18 +++++++++--------- app/player/api/internal/types/types.go | 12 ++++++------ app/review/api/internal/types/types.go | 6 +++--- app/shop/api/internal/types/types.go | 10 +++++----- app/users/api/internal/types/types.go | 18 +++++++++--------- app/wallet/api/internal/handler/routes.go | 2 +- app/wallet/api/internal/types/types.go | 4 ++-- desc/api/community.api | 6 +++--- desc/api/dispute.api | 11 ++++++----- desc/api/game.api | 2 +- desc/api/notification.api | 3 ++- desc/api/order.api | 18 +++++++++--------- desc/api/player.api | 12 ++++++------ desc/api/review.api | 7 ++++--- desc/api/shop.api | 10 +++++----- desc/api/users.api | 5 +++-- desc/api/wallet.api | 2 +- 22 files changed, 86 insertions(+), 82 deletions(-) diff --git a/app/community/api/internal/types/types.go b/app/community/api/internal/types/types.go index 123dc3e..40da84d 100644 --- a/app/community/api/internal/types/types.go +++ b/app/community/api/internal/types/types.go @@ -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"` diff --git a/app/dispute/api/internal/types/types.go b/app/dispute/api/internal/types/types.go index db505c5..36340dd 100644 --- a/app/dispute/api/internal/types/types.go +++ b/app/dispute/api/internal/types/types.go @@ -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"` diff --git a/app/game/api/internal/handler/routes.go b/app/game/api/internal/handler/routes.go index 1c6b860..bf1b933 100644 --- a/app/game/api/internal/handler/routes.go +++ b/app/game/api/internal/handler/routes.go @@ -1,5 +1,5 @@ // Code generated by goctl. DO NOT EDIT. -// goctl 1.9.2 +// goctl 1.10.1 package handler diff --git a/app/game/api/internal/types/types.go b/app/game/api/internal/types/types.go index 2fd9e9b..805a41a 100644 --- a/app/game/api/internal/types/types.go +++ b/app/game/api/internal/types/types.go @@ -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"` diff --git a/app/notification/api/internal/types/types.go b/app/notification/api/internal/types/types.go index 22f7e56..54a8d82 100644 --- a/app/notification/api/internal/types/types.go +++ b/app/notification/api/internal/types/types.go @@ -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"` diff --git a/app/order/api/internal/types/types.go b/app/order/api/internal/types/types.go index 44788c7..54f1904 100644 --- a/app/order/api/internal/types/types.go +++ b/app/order/api/internal/types/types.go @@ -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"` diff --git a/app/player/api/internal/types/types.go b/app/player/api/internal/types/types.go index a0c92fa..1b8b2f2 100644 --- a/app/player/api/internal/types/types.go +++ b/app/player/api/internal/types/types.go @@ -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"` diff --git a/app/review/api/internal/types/types.go b/app/review/api/internal/types/types.go index fa9084c..c6807c9 100644 --- a/app/review/api/internal/types/types.go +++ b/app/review/api/internal/types/types.go @@ -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"` diff --git a/app/shop/api/internal/types/types.go b/app/shop/api/internal/types/types.go index be92690..3e5f1e6 100644 --- a/app/shop/api/internal/types/types.go +++ b/app/shop/api/internal/types/types.go @@ -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"` } diff --git a/app/users/api/internal/types/types.go b/app/users/api/internal/types/types.go index ff07a52..5371a3c 100644 --- a/app/users/api/internal/types/types.go +++ b/app/users/api/internal/types/types.go @@ -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"` // 审核时间 } diff --git a/app/wallet/api/internal/handler/routes.go b/app/wallet/api/internal/handler/routes.go index eb775d4..901a7e9 100644 --- a/app/wallet/api/internal/handler/routes.go +++ b/app/wallet/api/internal/handler/routes.go @@ -1,5 +1,5 @@ // Code generated by goctl. DO NOT EDIT. -// goctl 1.9.2 +// goctl 1.10.1 package handler diff --git a/app/wallet/api/internal/types/types.go b/app/wallet/api/internal/types/types.go index 4c3a113..78174d3 100644 --- a/app/wallet/api/internal/types/types.go +++ b/app/wallet/api/internal/types/types.go @@ -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"` diff --git a/desc/api/community.api b/desc/api/community.api index 9c8fdbe..b8018db 100644 --- a/desc/api/community.api +++ b/desc/api/community.api @@ -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"` diff --git a/desc/api/dispute.api b/desc/api/dispute.api index 54b3654..d17420e 100644 --- a/desc/api/dispute.api +++ b/desc/api/dispute.api @@ -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) } + diff --git a/desc/api/game.api b/desc/api/game.api index f7fde6b..423b8d3 100644 --- a/desc/api/game.api +++ b/desc/api/game.api @@ -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"` diff --git a/desc/api/notification.api b/desc/api/notification.api index 4ceb8f4..608e4e0 100644 --- a/desc/api/notification.api +++ b/desc/api/notification.api @@ -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) } + diff --git a/desc/api/order.api b/desc/api/order.api index 3cfb7fd..34b47f7 100644 --- a/desc/api/order.api +++ b/desc/api/order.api @@ -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"` } diff --git a/desc/api/player.api b/desc/api/player.api index 1fc78d3..be19ec9 100644 --- a/desc/api/player.api +++ b/desc/api/player.api @@ -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"` diff --git a/desc/api/review.api b/desc/api/review.api index ae4e3fa..7a67046 100644 --- a/desc/api/review.api +++ b/desc/api/review.api @@ -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) } + diff --git a/desc/api/shop.api b/desc/api/shop.api index d9aff29..96278e1 100644 --- a/desc/api/shop.api +++ b/desc/api/shop.api @@ -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"` } diff --git a/desc/api/users.api b/desc/api/users.api index cadf9af..cda3ab5 100644 --- a/desc/api/users.api +++ b/desc/api/users.api @@ -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) } + diff --git a/desc/api/wallet.api b/desc/api/wallet.api index ff5eef2..812f1f8 100644 --- a/desc/api/wallet.api +++ b/desc/api/wallet.api @@ -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"`