fix: api descript
This commit is contained in:
+14
-5
@@ -2,8 +2,12 @@ syntax = "v1"
|
||||
import "common.api"
|
||||
|
||||
type (
|
||||
SessionIdReq {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
|
||||
ChatSession {
|
||||
Id string `json:"id"`
|
||||
Id int64 `json:"id"`
|
||||
Type string `json:"type"` // order, consultation
|
||||
OrderId string `json:"orderId,optional"`
|
||||
Participants []SimpleUser `json:"participants"`
|
||||
@@ -17,7 +21,7 @@ type (
|
||||
}
|
||||
|
||||
ChatMessage {
|
||||
Id string `json:"id"`
|
||||
Id int64 `json:"id"`
|
||||
SessionId string `json:"sessionId"`
|
||||
SenderId string `json:"senderId"`
|
||||
Type string `json:"type"` // text, image, system
|
||||
@@ -31,15 +35,20 @@ type (
|
||||
}
|
||||
|
||||
SendMessageReq {
|
||||
SessionIdReq
|
||||
Type string `json:"type"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
ListMessageReq {
|
||||
SessionIdReq
|
||||
PageReq
|
||||
}
|
||||
)
|
||||
|
||||
@server(
|
||||
prefix: api/v1/chat
|
||||
group: chat
|
||||
jwt: Auth
|
||||
)
|
||||
service juwan-api {
|
||||
@doc "获取会话列表"
|
||||
@@ -48,11 +57,11 @@ service juwan-api {
|
||||
|
||||
@doc "获取会话详情"
|
||||
@handler GetSession
|
||||
get /sessions/:id (EmptyResp) returns (ChatSession)
|
||||
get /sessions/:id (SessionIdReq) returns (ChatSession)
|
||||
|
||||
@doc "获取消息历史"
|
||||
@handler ListMessages
|
||||
get /sessions/:id/messages (PageReq) returns (ChatMessageListResp)
|
||||
get /sessions/:id/messages (ListMessageReq) returns (ChatMessageListResp)
|
||||
|
||||
@doc "发送消息"
|
||||
@handler SendMessage
|
||||
|
||||
+18
-12
@@ -2,8 +2,11 @@ syntax = "v1"
|
||||
import "common.api"
|
||||
|
||||
type (
|
||||
PathId {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
Post {
|
||||
Id string `json:"id"`
|
||||
Id int64 `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Content string `json:"content"`
|
||||
Images []string `json:"images"`
|
||||
@@ -35,7 +38,7 @@ type (
|
||||
}
|
||||
|
||||
Comment {
|
||||
Id string `json:"id"`
|
||||
Id int64 `json:"id"`
|
||||
Content string `json:"content"`
|
||||
Author UserProfile `json:"author"`
|
||||
LikeCount int64 `json:"likeCount"`
|
||||
@@ -51,6 +54,10 @@ type (
|
||||
CreateCommentReq {
|
||||
Content string `json:"content"`
|
||||
}
|
||||
ListCommentsReq {
|
||||
PathId
|
||||
PageReq
|
||||
}
|
||||
)
|
||||
|
||||
@server(
|
||||
@@ -64,21 +71,20 @@ service juwan-api {
|
||||
|
||||
@doc "获取帖子详情"
|
||||
@handler GetPost
|
||||
get /posts/:id (EmptyResp) returns (Post)
|
||||
get /posts/:id (PathId) returns (Post)
|
||||
|
||||
@doc "获取帖子评论"
|
||||
@handler ListComments
|
||||
get /posts/:id/comments (PageReq) returns (CommentListResp)
|
||||
get /posts/:id/comments (ListCommentsReq ) returns (CommentListResp)
|
||||
|
||||
@doc "获取用户帖子"
|
||||
@handler ListUserPosts
|
||||
get /users/:id/posts (PageReq) returns (PostListResp)
|
||||
get /users/:id/posts (ListCommentsReq ) returns (PostListResp)
|
||||
}
|
||||
|
||||
@server(
|
||||
prefix: api/v1
|
||||
group: community
|
||||
jwt: Auth
|
||||
)
|
||||
service juwan-api {
|
||||
@doc "发布帖子"
|
||||
@@ -87,19 +93,19 @@ service juwan-api {
|
||||
|
||||
@doc "点赞帖子"
|
||||
@handler LikePost
|
||||
post /posts/:id/like (EmptyResp) returns (EmptyResp)
|
||||
post /posts/:id/like (PathId) returns (EmptyResp)
|
||||
|
||||
@doc "取消点赞帖子"
|
||||
@handler UnlikePost
|
||||
delete /posts/:id/like (EmptyResp) returns (EmptyResp)
|
||||
delete /posts/:id/like (PathId) returns (EmptyResp)
|
||||
|
||||
@doc "置顶帖子"
|
||||
@handler PinPost
|
||||
post /posts/:id/pin (EmptyResp) returns (EmptyResp)
|
||||
post /posts/:id/pin (PathId) returns (EmptyResp)
|
||||
|
||||
@doc "取消置顶"
|
||||
@handler UnpinPost
|
||||
delete /posts/:id/pin (EmptyResp) returns (EmptyResp)
|
||||
delete /posts/:id/pin (PathId) returns (EmptyResp)
|
||||
|
||||
@doc "发表评论"
|
||||
@handler CreateComment
|
||||
@@ -107,9 +113,9 @@ service juwan-api {
|
||||
|
||||
@doc "点赞评论"
|
||||
@handler LikeComment
|
||||
post /comments/:id/like (EmptyResp) returns (EmptyResp)
|
||||
post /comments/:id/like (PathId) returns (EmptyResp)
|
||||
|
||||
@doc "取消点赞评论"
|
||||
@handler UnlikeComment
|
||||
delete /comments/:id/like (EmptyResp) returns (EmptyResp)
|
||||
delete /comments/:id/like (PathId) returns (EmptyResp)
|
||||
}
|
||||
+17
-12
@@ -2,32 +2,38 @@ syntax = "v1"
|
||||
import "common.api"
|
||||
|
||||
type (
|
||||
PathId {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
Dispute {
|
||||
Id string `json:"id"`
|
||||
OrderId string `json:"orderId"`
|
||||
Reason string `json:"reason"`
|
||||
Status string `json:"status"`
|
||||
Evidence []string `json:"evidence"`
|
||||
Result string `json:"result,optional"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
Id int64 `json:"id"`
|
||||
OrderId int64 `json:"orderId"`
|
||||
Reason string `json:"reason"`
|
||||
Status string `json:"status"`
|
||||
Evidence []string `json:"evidence"`
|
||||
Result string `json:"result,optional"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
}
|
||||
|
||||
DisputeListResp {
|
||||
Items []Dispute `json:"items"`
|
||||
Meta PageMeta `json:"meta"`
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
|
||||
CreateDisputeReq {
|
||||
Reason string `json:"reason"`
|
||||
PathId
|
||||
Reason string `json:"reason"`
|
||||
Evidence []string `json:"evidence"`
|
||||
}
|
||||
|
||||
DisputeResponseReq {
|
||||
Reason string `json:"reason"`
|
||||
PathId
|
||||
Reason string `json:"reason"`
|
||||
Evidence []string `json:"evidence"`
|
||||
}
|
||||
|
||||
AppealReq {
|
||||
PathId
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
)
|
||||
@@ -35,7 +41,6 @@ type (
|
||||
@server(
|
||||
prefix: api/v1
|
||||
group: dispute
|
||||
jwt: Auth
|
||||
)
|
||||
service juwan-api {
|
||||
@doc "获取争议列表"
|
||||
@@ -44,7 +49,7 @@ service juwan-api {
|
||||
|
||||
@doc "获取订单争议"
|
||||
@handler GetOrderDispute
|
||||
get /orders/:id/dispute (EmptyResp) returns (Dispute)
|
||||
get /orders/:id/dispute (PathId) returns (Dispute)
|
||||
|
||||
@doc "发起争议"
|
||||
@handler CreateDispute
|
||||
|
||||
+26
-22
@@ -1,30 +1,34 @@
|
||||
syntax = "v1"
|
||||
|
||||
import "common.api"
|
||||
|
||||
type (
|
||||
Game {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Icon string `json:"icon"`
|
||||
Category string `json:"category"`
|
||||
}
|
||||
|
||||
GameListResp {
|
||||
Items []Game `json:"items"`
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
Game {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Icon string `json:"icon"`
|
||||
Category string `json:"category"`
|
||||
}
|
||||
GameListResp {
|
||||
Items []Game `json:"items"`
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
GetGameReq {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
)
|
||||
|
||||
@server(
|
||||
prefix: api/v1/games
|
||||
group: game
|
||||
@server (
|
||||
prefix: api/v1/games
|
||||
group: game
|
||||
)
|
||||
service juwan-api {
|
||||
@doc "获取游戏列表"
|
||||
@handler ListGames
|
||||
get / (PageReq) returns (GameListResp)
|
||||
service game-api {
|
||||
@doc "获取游戏列表"
|
||||
@handler ListGames
|
||||
get / (PageReq) returns (GameListResp)
|
||||
|
||||
@doc "获取游戏详情"
|
||||
@handler GetGame
|
||||
get /:id (GetGameReq) returns (Game)
|
||||
}
|
||||
|
||||
@doc "获取游戏详情"
|
||||
@handler GetGame
|
||||
get /:id (EmptyResp) returns (Game)
|
||||
}
|
||||
@@ -2,8 +2,11 @@ syntax = "v1"
|
||||
import "common.api"
|
||||
|
||||
type (
|
||||
PathId {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
Notification {
|
||||
Id string `json:"id"`
|
||||
Id int64 `json:"id"`
|
||||
Type string `json:"type"`
|
||||
Title string `json:"title"`
|
||||
Content string `json:"content"`
|
||||
@@ -21,7 +24,6 @@ type (
|
||||
@server(
|
||||
prefix: api/v1
|
||||
group: notification
|
||||
jwt: Auth
|
||||
)
|
||||
service juwan-api {
|
||||
@doc "获取通知列表"
|
||||
@@ -30,7 +32,7 @@ service juwan-api {
|
||||
|
||||
@doc "标记已读"
|
||||
@handler ReadNotification
|
||||
put /notifications/:id/read (EmptyResp) returns (EmptyResp)
|
||||
put /notifications/:id/read (PathId) returns (EmptyResp)
|
||||
|
||||
@doc "全部已读"
|
||||
@handler ReadAllNotifications
|
||||
|
||||
@@ -25,7 +25,6 @@ type (
|
||||
@server (
|
||||
prefix: /api/v1
|
||||
group: file
|
||||
jwt: Logger
|
||||
middleware: FileSizeLimit // 建议添加中间件限制文件大小
|
||||
)
|
||||
service file-api {
|
||||
|
||||
+16
-14
@@ -3,13 +3,16 @@ import "common.api"
|
||||
import "player.api" // 为了使用 PlayerService 定义
|
||||
|
||||
type (
|
||||
PathId {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
Order {
|
||||
Id string `json:"id"`
|
||||
ConsumerId string `json:"consumerId"`
|
||||
Id int64 `json:"id"`
|
||||
ConsumerId int64 `json:"consumerId"`
|
||||
ConsumerName string `json:"consumerName"`
|
||||
PlayerId string `json:"playerId"`
|
||||
PlayerName string `json:"playerName"`
|
||||
ShopId string `json:"shopId,optional"`
|
||||
ShopId int64 `json:"shopId,optional"`
|
||||
ShopName string `json:"shopName,optional"`
|
||||
Service PlayerService `json:"service"`
|
||||
Status string `json:"status"`
|
||||
@@ -32,9 +35,9 @@ type (
|
||||
}
|
||||
|
||||
CreateOrderReq {
|
||||
PlayerId string `json:"playerId"`
|
||||
ShopId string `json:"shopId,optional"`
|
||||
ServiceId string `json:"serviceId"`
|
||||
PlayerId int64 `json:"playerId"`
|
||||
ShopId int64 `json:"shopId,optional"`
|
||||
ServiceId int64 `json:"serviceId"`
|
||||
Quantity int `json:"quantity"`
|
||||
Note string `json:"note,optional"`
|
||||
}
|
||||
@@ -48,7 +51,6 @@ type (
|
||||
@server(
|
||||
prefix: api/v1/orders
|
||||
group: order
|
||||
jwt: Auth
|
||||
)
|
||||
service juwan-api {
|
||||
@doc "获取订单列表"
|
||||
@@ -57,7 +59,7 @@ service juwan-api {
|
||||
|
||||
@doc "获取订单详情"
|
||||
@handler GetOrder
|
||||
get /:id (EmptyResp) returns (Order)
|
||||
get /:id (PathId) returns (Order)
|
||||
|
||||
@doc "创建订单"
|
||||
@handler CreateOrder
|
||||
@@ -69,25 +71,25 @@ service juwan-api {
|
||||
|
||||
@doc "支付订单"
|
||||
@handler PayOrder
|
||||
post /:id/pay (EmptyResp) returns (EmptyResp)
|
||||
post /:id/pay (PathId) returns (EmptyResp)
|
||||
|
||||
@doc "接单"
|
||||
@handler AcceptOrder
|
||||
post /:id/accept (EmptyResp) returns (EmptyResp)
|
||||
post /:id/accept (PathId) returns (EmptyResp)
|
||||
|
||||
@doc "申请结算"
|
||||
@handler RequestCloseOrder
|
||||
post /:id/request-close (EmptyResp) returns (EmptyResp)
|
||||
post /:id/request-close (PathId) returns (EmptyResp)
|
||||
|
||||
@doc "确认结算"
|
||||
@handler ConfirmCloseOrder
|
||||
post /:id/confirm-close (EmptyResp) returns (EmptyResp)
|
||||
post /:id/confirm-close (PathId) returns (EmptyResp)
|
||||
|
||||
@doc "取消订单"
|
||||
@handler CancelOrder
|
||||
post /:id/cancel (EmptyResp) returns (EmptyResp)
|
||||
post /:id/cancel (PathId) returns (EmptyResp)
|
||||
|
||||
@doc "再来一单"
|
||||
@handler Reorder
|
||||
post /:id/reorder (EmptyResp) returns (CreateOrderResp)
|
||||
post /:id/reorder (PathId) returns (CreateOrderResp)
|
||||
}
|
||||
+116
-91
@@ -1,110 +1,135 @@
|
||||
syntax = "v1"
|
||||
|
||||
import "common.api"
|
||||
|
||||
type (
|
||||
PlayerService {
|
||||
Id string `json:"id"`
|
||||
PlayerId string `json:"playerId"`
|
||||
GameId string `json:"gameId"`
|
||||
GameName string `json:"gameName"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Price float64 `json:"price"`
|
||||
Unit string `json:"unit"`
|
||||
RankRange string `json:"rankRange,optional"`
|
||||
Availability []string `json:"availability"`
|
||||
}
|
||||
|
||||
PlayerServiceListResp {
|
||||
Items []PlayerService `json:"items"`
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
|
||||
CreateServiceReq {
|
||||
GameId string `json:"gameId"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description,optional"`
|
||||
Price float64 `json:"price"`
|
||||
Unit string `json:"unit"`
|
||||
RankRange string `json:"rankRange,optional"`
|
||||
Availability []string `json:"availability,optional"`
|
||||
}
|
||||
|
||||
PlayerProfile {
|
||||
Id string `json:"id"`
|
||||
User UserProfile `json:"user"`
|
||||
Rating float64 `json:"rating"`
|
||||
TotalOrders int64 `json:"totalOrders"`
|
||||
CompletionRate float64 `json:"completionRate"`
|
||||
Status string `json:"status"`
|
||||
Games []string `json:"games"`
|
||||
Services []PlayerService `json:"services"`
|
||||
ShopId string `json:"shopId,optional"`
|
||||
ShopName string `json:"shopName,optional"`
|
||||
Tags []string `json:"tags"`
|
||||
}
|
||||
|
||||
PlayerListReq {
|
||||
PageReq
|
||||
GameId string `form:"gameId,optional"`
|
||||
Gender int `form:"gender,optional"`
|
||||
}
|
||||
|
||||
PlayerListResp {
|
||||
Items []PlayerProfile `json:"items"`
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
|
||||
UpdatePlayerStatusReq {
|
||||
Status string `json:"status"`
|
||||
}
|
||||
PlayerService {
|
||||
Id int64 `json:"id"`
|
||||
PlayerId int64 `json:"playerId"`
|
||||
GameId int64 `json:"gameId"`
|
||||
GameName string `json:"gameName"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Price float64 `json:"price"`
|
||||
Unit string `json:"unit"`
|
||||
RankRange string `json:"rankRange,optional"`
|
||||
Availability []string `json:"availability"`
|
||||
}
|
||||
PlayerServiceListResp {
|
||||
Items []PlayerService `json:"items"`
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
CreateServiceReq {
|
||||
Id int64 `path:"id"`
|
||||
GameId int64 `json:"gameId, optional"`
|
||||
Title string `json:"title,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
Price float64 `json:"price"`
|
||||
Unit string `json:"unit"`
|
||||
RankRange string `json:"rankRange,optional"`
|
||||
Availability []string `json:"availability,optional"`
|
||||
}
|
||||
UpdateServiceReq {
|
||||
Id int64 `path:"id"`
|
||||
GameId *int64 `json:"gameId, optional"`
|
||||
Title *string `json:"title,optional"`
|
||||
Description *string `json:"description,optional"`
|
||||
Price *float64 `json:"price,optional"`
|
||||
Unit *string `json:"unit,optional"`
|
||||
RankRange *string `json:"rankRange,optional"`
|
||||
Availability []string `json:"availability"`
|
||||
}
|
||||
PlayerProfile {
|
||||
Id int64 `json:"id"`
|
||||
User UserProfile `json:"user"`
|
||||
Rating float64 `json:"rating"`
|
||||
TotalOrders int64 `json:"totalOrders"`
|
||||
CompletionRate float64 `json:"completionRate"`
|
||||
Status string `json:"status"`
|
||||
Games []string `json:"games"`
|
||||
Services []PlayerService `json:"services"`
|
||||
ShopId string `json:"shopId,optional"`
|
||||
ShopName string `json:"shopName,optional"`
|
||||
Tags []string `json:"tags"`
|
||||
}
|
||||
PlayerListReq {
|
||||
PageReq
|
||||
GameId int64 `form:"gameId,optional"`
|
||||
Gender int `form:"gender,optional"`
|
||||
}
|
||||
PlayerListResp {
|
||||
Items []PlayerProfile `json:"items"`
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
UpdatePlayerStatusReq {
|
||||
Status string `json:"status"`
|
||||
}
|
||||
)
|
||||
|
||||
@server(
|
||||
prefix: api/v1
|
||||
group: player
|
||||
type (
|
||||
GetServiceReq {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
GetPlayerReq {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
ListPlayerServicesReq {
|
||||
PageReq
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
)
|
||||
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: player
|
||||
)
|
||||
service juwan-api {
|
||||
@doc "获取打手列表"
|
||||
@handler ListPlayers
|
||||
get /players (PlayerListReq) returns (PlayerListResp)
|
||||
@doc "获取打手列表"
|
||||
@handler ListPlayers
|
||||
get /players (PlayerListReq) returns (PlayerListResp)
|
||||
|
||||
@doc "获取打手详情"
|
||||
@handler GetPlayer
|
||||
get /players/:id (EmptyResp) returns (PlayerProfile)
|
||||
@doc "获取打手详情"
|
||||
@handler GetPlayer
|
||||
get /players/:id (GetPlayerReq) returns (PlayerProfile)
|
||||
|
||||
@doc "获取所有服务列表"
|
||||
@handler ListServices
|
||||
get /services (PageReq) returns (PlayerServiceListResp)
|
||||
@doc "获取所有服务列表"
|
||||
@handler ListServices
|
||||
get /services (PageReq) returns (PlayerServiceListResp)
|
||||
|
||||
@doc "获取服务详情"
|
||||
@handler GetService
|
||||
get /services/:id (EmptyResp) returns (PlayerService)
|
||||
@doc "获取服务详情"
|
||||
@handler GetService
|
||||
get /services/:id (GetServiceReq) returns (PlayerService)
|
||||
|
||||
@doc "获取指定打手的服务列表"
|
||||
@handler ListPlayerServices
|
||||
get /players/:id/services (PageReq) returns (PlayerServiceListResp)
|
||||
@doc "获取指定打手的服务列表"
|
||||
@handler ListPlayerServices
|
||||
get /players/:id/services (ListPlayerServicesReq) returns (PlayerServiceListResp)
|
||||
}
|
||||
|
||||
@server(
|
||||
prefix: api/v1
|
||||
group: player
|
||||
jwt: Auth
|
||||
type (
|
||||
DeleteServiceReq {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
)
|
||||
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: player
|
||||
)
|
||||
service juwan-api {
|
||||
@doc "更新接单状态"
|
||||
@handler UpdatePlayerStatus
|
||||
put /players/me/status (UpdatePlayerStatusReq) returns (EmptyResp)
|
||||
@doc "更新接单状态"
|
||||
@handler UpdatePlayerStatus
|
||||
put /players/me/status (UpdatePlayerStatusReq) returns (EmptyResp)
|
||||
|
||||
@doc "创建服务"
|
||||
@handler CreateService
|
||||
post /services (CreateServiceReq) returns (PlayerService)
|
||||
@doc "创建服务"
|
||||
@handler CreateService
|
||||
post /services (CreateServiceReq) returns (PlayerService)
|
||||
|
||||
@doc "更新服务"
|
||||
@handler UpdateService
|
||||
put /services/:id (CreateServiceReq) returns (PlayerService)
|
||||
@doc "更新服务"
|
||||
@handler UpdateService
|
||||
put /services/:id (UpdateServiceReq) returns (PlayerService)
|
||||
|
||||
@doc "删除服务"
|
||||
@handler DeleteService
|
||||
delete /services/:id (DeleteServiceReq) returns (EmptyResp)
|
||||
}
|
||||
|
||||
@doc "删除服务"
|
||||
@handler DeleteService
|
||||
delete /services/:id (EmptyResp) returns (EmptyResp)
|
||||
}
|
||||
+3
-4
@@ -3,9 +3,9 @@ import "common.api"
|
||||
|
||||
type (
|
||||
Review {
|
||||
Id string `json:"id"`
|
||||
OrderId string `json:"orderId"`
|
||||
FromUserId string `json:"fromUserId"`
|
||||
Id int64 `json:"id"`
|
||||
OrderId int64 `json:"orderId"`
|
||||
FromUserId int64 `json:"fromUserId"`
|
||||
FromUserName string `json:"fromUserName"`
|
||||
Rating int `json:"rating"`
|
||||
Content string `json:"content"`
|
||||
@@ -27,7 +27,6 @@ type (
|
||||
@server(
|
||||
prefix: api/v1
|
||||
group: review
|
||||
jwt: Auth
|
||||
)
|
||||
service juwan-api {
|
||||
@doc "提交评价"
|
||||
|
||||
+7
-4
@@ -2,6 +2,9 @@ syntax = "v1"
|
||||
import "common.api"
|
||||
|
||||
type (
|
||||
PathIDReq {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
SearchReq {
|
||||
PageReq
|
||||
Q string `form:"q"`
|
||||
@@ -18,12 +21,13 @@ type (
|
||||
|
||||
FavoriteReq {
|
||||
TargetType string `json:"targetType"` // player, shop
|
||||
TargetId string `json:"targetId"`
|
||||
TargetId int64 `json:"targetId"`
|
||||
}
|
||||
|
||||
FavoriteCheckReq {
|
||||
PathIDReq
|
||||
TargetType string `form:"targetType"`
|
||||
TargetId string `form:"targetId"`
|
||||
TargetId int64 `form:"targetId"`
|
||||
}
|
||||
|
||||
FavoriteCheckResp {
|
||||
@@ -48,7 +52,6 @@ service juwan-api {
|
||||
@server(
|
||||
prefix: api/v1
|
||||
group: favorites
|
||||
jwt: Auth
|
||||
)
|
||||
service juwan-api {
|
||||
@doc "获取收藏列表"
|
||||
@@ -61,7 +64,7 @@ service juwan-api {
|
||||
|
||||
@doc "取消收藏"
|
||||
@handler RemoveFavorite
|
||||
delete /favorites/:id (EmptyResp) returns (EmptyResp)
|
||||
delete /favorites/:id (PathIDReq) returns (EmptyResp)
|
||||
|
||||
@doc "检查收藏状态"
|
||||
@handler CheckFavorite
|
||||
|
||||
+123
-106
@@ -1,130 +1,147 @@
|
||||
syntax = "v1"
|
||||
|
||||
import "common.api"
|
||||
|
||||
type (
|
||||
ShopProfile {
|
||||
Id string `json:"id"`
|
||||
Owner UserProfile `json:"owner"`
|
||||
Name string `json:"name"`
|
||||
Banner string `json:"banner,optional"`
|
||||
Description string `json:"description"`
|
||||
Rating float64 `json:"rating"`
|
||||
TotalOrders int64 `json:"totalOrders"`
|
||||
PlayerCount int64 `json:"playerCount"`
|
||||
CommissionType string `json:"commissionType"`
|
||||
CommissionValue float64 `json:"commissionValue"`
|
||||
Announcements []string `json:"announcements"`
|
||||
TemplateConfig interface{} `json:"templateConfig"`
|
||||
}
|
||||
|
||||
ShopListResp {
|
||||
Items []ShopProfile `json:"items"`
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
|
||||
CreateShopReq {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
CommissionType string `json:"commissionType"`
|
||||
CommissionValue float64 `json:"commissionValue"`
|
||||
}
|
||||
|
||||
UpdateShopReq {
|
||||
Name string `json:"name,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
CommissionType string `json:"commissionType,optional"`
|
||||
CommissionValue float64 `json:"commissionValue,optional"`
|
||||
AllowMultiShop bool `json:"allowMultiShop,optional"`
|
||||
AllowIndependentOrders bool `json:"allowIndependentOrders,optional"`
|
||||
DispatchMode string `json:"dispatchMode,optional"`
|
||||
}
|
||||
|
||||
UpdateTemplateReq {
|
||||
Sections interface{} `json:"sections"`
|
||||
}
|
||||
|
||||
AnnouncementReq {
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
IncomeStatsResp {
|
||||
MonthlyIncome float64 `json:"monthlyIncome"`
|
||||
PendingSettlement float64 `json:"pendingSettlement"`
|
||||
TotalWithdrawn float64 `json:"totalWithdrawn"`
|
||||
TotalOrders int64 `json:"totalOrders"`
|
||||
CompletedOrders int64 `json:"completedOrders"`
|
||||
}
|
||||
|
||||
InvitationReq {
|
||||
PlayerId string `json:"playerId"`
|
||||
}
|
||||
ShopProfile {
|
||||
Id string `json:"id"`
|
||||
Owner UserProfile `json:"owner"`
|
||||
Name string `json:"name"`
|
||||
Banner string `json:"banner,optional"`
|
||||
Description string `json:"description"`
|
||||
Rating float64 `json:"rating"`
|
||||
TotalOrders int64 `json:"totalOrders"`
|
||||
PlayerCount int64 `json:"playerCount"`
|
||||
CommissionType string `json:"commissionType"`
|
||||
CommissionValue float64 `json:"commissionValue"`
|
||||
Announcements []string `json:"announcements"`
|
||||
TemplateConfig interface{} `json:"templateConfig"`
|
||||
}
|
||||
ShopListResp {
|
||||
Items []ShopProfile `json:"items"`
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
CreateShopReq {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
CommissionType string `json:"commissionType"`
|
||||
CommissionValue float64 `json:"commissionValue"`
|
||||
}
|
||||
UpdateShopReq {
|
||||
Id int64 `path:"id"`
|
||||
Name string `json:"name,optional"`
|
||||
Description string `json:"description,optional"`
|
||||
CommissionType string `json:"commissionType,optional"`
|
||||
CommissionValue float64 `json:"commissionValue,optional"`
|
||||
AllowMultiShop bool `json:"allowMultiShop,optional"`
|
||||
AllowIndependentOrders bool `json:"allowIndependentOrders,optional"`
|
||||
DispatchMode string `json:"dispatchMode,optional"`
|
||||
}
|
||||
UpdateTemplateReq {
|
||||
Id int64 `path:"id"`
|
||||
Sections interface{} `json:"sections"`
|
||||
}
|
||||
AnnouncementReq {
|
||||
Id int64 `path:"id"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
IncomeStatsResp {
|
||||
MonthlyIncome float64 `json:"monthlyIncome"`
|
||||
PendingSettlement float64 `json:"pendingSettlement"`
|
||||
TotalWithdrawn float64 `json:"totalWithdrawn"`
|
||||
TotalOrders int64 `json:"totalOrders"`
|
||||
CompletedOrders int64 `json:"completedOrders"`
|
||||
}
|
||||
InvitationReq {
|
||||
Id int64 `path:"id"`
|
||||
PlayerId int64 `json:"playerId"`
|
||||
}
|
||||
)
|
||||
|
||||
@server(
|
||||
prefix: api/v1
|
||||
group: shop
|
||||
type (
|
||||
ShopIdReq {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
UserIdReq {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
)
|
||||
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: shop
|
||||
)
|
||||
service juwan-api {
|
||||
@doc "获取店铺列表"
|
||||
@handler ListShops
|
||||
get /shops (PageReq) returns (ShopListResp)
|
||||
@doc "获取店铺列表"
|
||||
@handler ListShops
|
||||
get /shops (PageReq) returns (ShopListResp)
|
||||
|
||||
@doc "获取店铺详情"
|
||||
@handler GetShop
|
||||
get /shops/:id (EmptyResp) returns (ShopProfile)
|
||||
@doc "获取店铺详情"
|
||||
@handler GetShop
|
||||
get /shops/:id (ShopIdReq) returns (ShopProfile)
|
||||
|
||||
@doc "获取店长的店铺"
|
||||
@handler GetUserShop
|
||||
get /users/:id/shop (EmptyResp) returns (ShopProfile)
|
||||
@doc "获取店长的店铺"
|
||||
@handler GetUserShop
|
||||
get /users/:id/shop (UserIdReq) returns (ShopProfile)
|
||||
}
|
||||
|
||||
@server(
|
||||
prefix: api/v1
|
||||
group: shop
|
||||
jwt: Auth
|
||||
type (
|
||||
DeleteAnnouncementReq {
|
||||
Id int64 `path:"id"`
|
||||
index int64 `path:"index"`
|
||||
}
|
||||
AcceptInvitationReq {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
)
|
||||
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: shop
|
||||
)
|
||||
service juwan-api {
|
||||
@doc "创建店铺"
|
||||
@handler CreateShop
|
||||
post /shops (CreateShopReq) returns (ShopProfile)
|
||||
@doc "创建店铺"
|
||||
@handler CreateShop
|
||||
post /shops (CreateShopReq) returns (ShopProfile)
|
||||
|
||||
@doc "获取当前用户的店铺"
|
||||
@handler GetMyShop
|
||||
get /shops/mine (EmptyResp) returns (ShopProfile)
|
||||
@doc "获取当前用户的店铺"
|
||||
@handler GetMyShop
|
||||
get /shops/mine (EmptyResp) returns (ShopProfile)
|
||||
|
||||
@doc "更新店铺信息"
|
||||
@handler UpdateShop
|
||||
put /shops/:id (UpdateShopReq) returns (ShopProfile)
|
||||
@doc "更新店铺信息"
|
||||
@handler UpdateShop
|
||||
put /shops/:id (ShopIdReq) returns (ShopProfile)
|
||||
|
||||
@doc "更新店铺模板"
|
||||
@handler UpdateShopTemplate
|
||||
put /shops/:id/template (UpdateTemplateReq) returns (EmptyResp)
|
||||
@doc "更新店铺模板"
|
||||
@handler UpdateShopTemplate
|
||||
put /shops/:id/template (UpdateTemplateReq) returns (EmptyResp)
|
||||
|
||||
@doc "新增店铺公告"
|
||||
@handler AddAnnouncement
|
||||
post /shops/:id/announcements (AnnouncementReq) returns (EmptyResp)
|
||||
@doc "新增店铺公告"
|
||||
@handler AddAnnouncement
|
||||
post /shops/:id/announcements (AnnouncementReq) returns (EmptyResp)
|
||||
|
||||
@doc "删除店铺公告"
|
||||
@handler DeleteAnnouncement
|
||||
delete /shops/:id/announcements/:index (EmptyResp) returns (EmptyResp)
|
||||
@doc "删除店铺公告"
|
||||
@handler DeleteAnnouncement
|
||||
delete /shops/:id/announcements/:index (DeleteAnnouncementReq) returns (EmptyResp)
|
||||
|
||||
@doc "邀请打手"
|
||||
@handler InvitePlayer
|
||||
post /shops/:id/invitations (InvitationReq) returns (EmptyResp)
|
||||
@doc "邀请打手"
|
||||
@handler InvitePlayer
|
||||
post /shops/:id/invitations (InvitationReq) returns (EmptyResp)
|
||||
|
||||
@doc "接受邀请"
|
||||
@handler AcceptInvitation
|
||||
post /shops/invitations/:id/accept (EmptyResp) returns (EmptyResp)
|
||||
@doc "接受邀请"
|
||||
@handler AcceptInvitation
|
||||
post /shops/invitations/:id/accept (AcceptInvitationReq) returns (EmptyResp)
|
||||
|
||||
@doc "拒绝邀请"
|
||||
@handler RejectInvitation
|
||||
delete /shops/invitations/:id (EmptyResp) returns (EmptyResp)
|
||||
@doc "拒绝邀请"
|
||||
@handler RejectInvitation
|
||||
delete /shops/invitations/:id (AcceptInvitationReq) returns (EmptyResp)
|
||||
|
||||
@doc "移除打手"
|
||||
@handler RemovePlayer
|
||||
delete /shops/:id/players/:playerId (EmptyResp) returns (EmptyResp)
|
||||
@doc "移除打手"
|
||||
@handler RemovePlayer
|
||||
delete /shops/:id/players/:playerId (InvitationReq) returns (EmptyResp)
|
||||
|
||||
@doc "获取收入统计"
|
||||
@handler GetShopIncomeStats
|
||||
get /shops/:id/income-stats (AcceptInvitationReq) returns (IncomeStatsResp)
|
||||
}
|
||||
|
||||
@doc "获取收入统计"
|
||||
@handler GetShopIncomeStats
|
||||
get /shops/:id/income-stats (EmptyResp) returns (IncomeStatsResp)
|
||||
}
|
||||
@@ -18,7 +18,6 @@ info (
|
||||
@server (
|
||||
group: verification_user
|
||||
prefix: /api/v1/users
|
||||
jwt: Auth // 必须登录
|
||||
)
|
||||
service verification-api {
|
||||
@doc "提交或修改角色认证申请 (支持幂等更新)"
|
||||
@@ -37,7 +36,6 @@ service verification-api {
|
||||
@server (
|
||||
group: verification_admin
|
||||
prefix: /api/v1/admin
|
||||
jwt: Auth // 需要登录,且 Logic 层需校验 IsAdmin
|
||||
)
|
||||
service verification-api {
|
||||
@doc "管理员获取认证申请列表 (分页)"
|
||||
|
||||
+1
-2
@@ -8,7 +8,7 @@ type (
|
||||
}
|
||||
|
||||
Transaction {
|
||||
Id string `json:"id"`
|
||||
Id int64 `json:"id"`
|
||||
Type string `json:"type"`
|
||||
Amount float64 `json:"amount"`
|
||||
Description string `json:"description"`
|
||||
@@ -30,7 +30,6 @@ type (
|
||||
@server(
|
||||
prefix: api/v1/wallet
|
||||
group: wallet
|
||||
jwt: Auth
|
||||
)
|
||||
service juwan-api {
|
||||
@doc "获取余额"
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package ="./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
// ------------------------------------
|
||||
// Messages
|
||||
// ------------------------------------
|
||||
|
||||
//--------------------------------games--------------------------------
|
||||
message Games {
|
||||
int64 id = 1; //id
|
||||
string name = 2; //name
|
||||
string icon = 3; //icon
|
||||
string category = 4; //category
|
||||
int64 sortOrder = 5; //sortOrder
|
||||
bool isActive = 6; //isActive
|
||||
int64 createdAt = 7; //createdAt
|
||||
int64 updatedAt = 8; //updatedAt
|
||||
}
|
||||
|
||||
message AddGamesReq {
|
||||
string name = 1; //name
|
||||
string icon = 2; //icon
|
||||
string category = 3; //category
|
||||
int64 sortOrder = 4; //sortOrder
|
||||
bool isActive = 5; //isActive
|
||||
int64 createdAt = 6; //createdAt
|
||||
int64 updatedAt = 7; //updatedAt
|
||||
}
|
||||
|
||||
message AddGamesResp {
|
||||
}
|
||||
|
||||
message UpdateGamesReq {
|
||||
int64 id = 1; //id
|
||||
string name = 2; //name
|
||||
string icon = 3; //icon
|
||||
string category = 4; //category
|
||||
int64 sortOrder = 5; //sortOrder
|
||||
bool isActive = 6; //isActive
|
||||
int64 createdAt = 7; //createdAt
|
||||
int64 updatedAt = 8; //updatedAt
|
||||
}
|
||||
|
||||
message UpdateGamesResp {
|
||||
}
|
||||
|
||||
message DelGamesReq {
|
||||
int64 id = 1; //id
|
||||
}
|
||||
|
||||
message DelGamesResp {
|
||||
}
|
||||
|
||||
message GetGamesByIdReq {
|
||||
int64 id = 1; //id
|
||||
}
|
||||
|
||||
message GetGamesByIdResp {
|
||||
Games games = 1; //games
|
||||
}
|
||||
|
||||
message SearchGamesReq {
|
||||
int64 page = 1; //page
|
||||
int64 limit = 2; //limit
|
||||
int64 id = 3; //id
|
||||
string name = 4; //name
|
||||
string icon = 5; //icon
|
||||
string category = 6; //category
|
||||
int64 sortOrder = 7; //sortOrder
|
||||
bool isActive = 8; //isActive
|
||||
int64 createdAt = 9; //createdAt
|
||||
int64 updatedAt = 10; //updatedAt
|
||||
}
|
||||
|
||||
message SearchGamesResp {
|
||||
repeated Games games = 1; //games
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ------------------------------------
|
||||
// Rpc Func
|
||||
// ------------------------------------
|
||||
|
||||
service public{
|
||||
|
||||
//-----------------------games-----------------------
|
||||
rpc AddGames(AddGamesReq) returns (AddGamesResp);
|
||||
rpc UpdateGames(UpdateGamesReq) returns (UpdateGamesResp);
|
||||
rpc DelGames(DelGamesReq) returns (DelGamesResp);
|
||||
rpc GetGamesById(GetGamesByIdReq) returns (GetGamesByIdResp);
|
||||
rpc SearchGames(SearchGamesReq) returns (SearchGamesResp);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package ="./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
// ------------------------------------
|
||||
// Messages
|
||||
// ------------------------------------
|
||||
|
||||
//--------------------------------playerServices--------------------------------
|
||||
message PlayerServices {
|
||||
int64 id = 1; //id
|
||||
int64 playerId = 2; //playerId
|
||||
int64 gameId = 3; //gameId
|
||||
string title = 4; //title
|
||||
string description = 5; //description
|
||||
double price = 6; //price
|
||||
string unit = 7; //unit
|
||||
string rankRange = 8; //rankRange
|
||||
repeated string availability = 9; //availability
|
||||
double rating = 10; //rating
|
||||
bool isActive = 11; //isActive
|
||||
int64 createdAt = 12; //createdAt
|
||||
int64 updatedAt = 13; //updatedAt
|
||||
}
|
||||
|
||||
message AddPlayerServicesReq {
|
||||
int64 playerId = 1; //playerId
|
||||
int64 gameId = 2; //gameId
|
||||
string title = 3; //title
|
||||
string description = 4; //description
|
||||
double price = 5; //price
|
||||
string unit = 6; //unit
|
||||
string rankRange = 7; //rankRange
|
||||
repeated string availability = 8; //availability
|
||||
double rating = 9; //rating
|
||||
bool isActive = 10; //isActive
|
||||
int64 createdAt = 11; //createdAt
|
||||
int64 updatedAt = 12; //updatedAt
|
||||
}
|
||||
|
||||
message AddPlayerServicesResp {
|
||||
}
|
||||
|
||||
message UpdatePlayerServicesReq {
|
||||
int64 id = 1; //id
|
||||
optional int64 playerId = 2; //playerId
|
||||
optional int64 gameId = 3; //gameId
|
||||
optional string title = 4; //title
|
||||
optional string description = 5; //description
|
||||
optional double price = 6; //price
|
||||
optional string unit = 7; //unit
|
||||
optional string rankRange = 8; //rankRange
|
||||
repeated string availability = 9; //availability
|
||||
optional double rating = 10; //rating
|
||||
optional bool isActive = 11; //isActive
|
||||
optional int64 createdAt = 12; //createdAt
|
||||
optional int64 updatedAt = 13; //updatedAt
|
||||
}
|
||||
|
||||
message UpdatePlayerServicesResp {
|
||||
}
|
||||
|
||||
message DelPlayerServicesReq {
|
||||
int64 id = 1; //id
|
||||
}
|
||||
|
||||
message DelPlayerServicesResp {
|
||||
}
|
||||
|
||||
message GetPlayerServicesByIdReq {
|
||||
int64 id = 1; //id
|
||||
}
|
||||
|
||||
message GetPlayerServicesByIdResp {
|
||||
PlayerServices playerServices = 1; //playerServices
|
||||
}
|
||||
|
||||
message SearchPlayerServicesReq {
|
||||
int64 page = 1; //page
|
||||
int64 limit = 2; //limit
|
||||
int64 id = 3; //id
|
||||
int64 playerId = 4; //playerId
|
||||
int64 gameId = 5; //gameId
|
||||
string title = 6; //title
|
||||
string description = 7; //description
|
||||
double price = 8; //price
|
||||
string unit = 9; //unit
|
||||
string rankRange = 10; //rankRange
|
||||
repeated string availability = 11; //availability
|
||||
double rating = 12; //rating
|
||||
bool isActive = 13; //isActive
|
||||
int64 createdAt = 14; //createdAt
|
||||
int64 updatedAt = 15; //updatedAt
|
||||
}
|
||||
|
||||
message SearchPlayerServicesResp {
|
||||
repeated PlayerServices playerServices = 1; //playerServices
|
||||
}
|
||||
|
||||
//--------------------------------players--------------------------------
|
||||
message Players {
|
||||
int64 id = 1; //id
|
||||
int64 userId = 2; //userId
|
||||
string status = 3; //status
|
||||
double rating = 4; //rating
|
||||
int64 totalOrders = 5; //totalOrders
|
||||
int64 completedOrders = 6; //completedOrders
|
||||
int64 shopId = 7; //shopId
|
||||
repeated string tags = 8; //tags
|
||||
repeated int64 games = 9; //games
|
||||
int64 createdAt = 10; //createdAt
|
||||
int64 updatedAt = 11; //updatedAt
|
||||
int64 gender = 12; //gender
|
||||
}
|
||||
|
||||
message AddPlayersReq {
|
||||
int64 userId = 1; //userId
|
||||
string status = 2; //status
|
||||
double rating = 3; //rating
|
||||
int64 totalOrders = 4; //totalOrders
|
||||
int64 completedOrders = 5; //completedOrders
|
||||
int64 shopId = 6; //shopId
|
||||
repeated string tags = 7; //tags
|
||||
repeated int64 games = 8; //games
|
||||
int64 createdAt = 9; //createdAt
|
||||
int64 updatedAt = 10; //updatedAt
|
||||
int64 gender = 11; //gender
|
||||
}
|
||||
|
||||
message AddPlayersResp {
|
||||
}
|
||||
|
||||
message UpdatePlayersReq {
|
||||
int64 id = 1; //id
|
||||
optional int64 userId = 2; //userId
|
||||
optional string status = 3; //status
|
||||
optional double rating = 4; //rating
|
||||
optional int64 totalOrders = 5; //totalOrders
|
||||
optional int64 completedOrders = 6; //completedOrders
|
||||
optional int64 shopId = 7; //shopId
|
||||
repeated string tags = 8; //tags
|
||||
repeated int64 games = 9; //games
|
||||
optional int64 createdAt = 10; //createdAt
|
||||
optional int64 updatedAt = 11; //updatedAt
|
||||
optional int64 gender = 12; //gender
|
||||
}
|
||||
|
||||
message UpdatePlayersResp {
|
||||
}
|
||||
|
||||
message DelPlayersReq {
|
||||
int64 id = 1; //id
|
||||
}
|
||||
|
||||
message DelPlayersResp {
|
||||
}
|
||||
|
||||
message GetPlayersByIdReq {
|
||||
int64 id = 1; //id
|
||||
}
|
||||
|
||||
message GetPlayersByIdResp {
|
||||
Players players = 1; //players
|
||||
}
|
||||
|
||||
message SearchPlayersReq {
|
||||
int64 page = 1; //page
|
||||
int64 limit = 2; //limit
|
||||
int64 id = 3; //id
|
||||
int64 userId = 4; //userId
|
||||
string status = 5; //status
|
||||
double rating = 6; //rating
|
||||
int64 totalOrders = 7; //totalOrders
|
||||
int64 completedOrders = 8; //completedOrders
|
||||
int64 shopId = 9; //shopId
|
||||
repeated string tags = 10; //tags
|
||||
repeated int64 games = 11; //games
|
||||
int64 createdAt = 12; //createdAt
|
||||
int64 updatedAt = 13; //updatedAt
|
||||
int64 gender = 14; //gender
|
||||
}
|
||||
|
||||
message SearchPlayersResp {
|
||||
repeated Players players = 1; //players
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------
|
||||
// Rpc Func
|
||||
// ------------------------------------
|
||||
|
||||
service playerService{
|
||||
|
||||
//-----------------------playerServices-----------------------
|
||||
rpc AddPlayerServices(AddPlayerServicesReq) returns (AddPlayerServicesResp);
|
||||
rpc UpdatePlayerServices(UpdatePlayerServicesReq) returns (UpdatePlayerServicesResp);
|
||||
rpc DelPlayerServices(DelPlayerServicesReq) returns (DelPlayerServicesResp);
|
||||
rpc GetPlayerServicesById(GetPlayerServicesByIdReq) returns (GetPlayerServicesByIdResp);
|
||||
rpc SearchPlayerServices(SearchPlayerServicesReq) returns (SearchPlayerServicesResp);
|
||||
//-----------------------players-----------------------
|
||||
rpc AddPlayers(AddPlayersReq) returns (AddPlayersResp);
|
||||
rpc UpdatePlayers(UpdatePlayersReq) returns (UpdatePlayersResp);
|
||||
rpc DelPlayers(DelPlayersReq) returns (DelPlayersResp);
|
||||
rpc GetPlayersById(GetPlayersByIdReq) returns (GetPlayersByIdResp);
|
||||
rpc SearchPlayers(SearchPlayersReq) returns (SearchPlayersResp);
|
||||
}
|
||||
@@ -0,0 +1,272 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package ="./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
// ------------------------------------
|
||||
// Messages
|
||||
// ------------------------------------
|
||||
|
||||
//--------------------------------shopInvitations--------------------------------
|
||||
message ShopInvitations {
|
||||
int64 id = 1; //id
|
||||
int64 shopId = 2; //shopId
|
||||
int64 playerId = 3; //playerId
|
||||
string status = 4; //status
|
||||
int64 invitedBy = 5; //invitedBy
|
||||
int64 createdAt = 6; //createdAt
|
||||
int64 respondedAt = 7; //respondedAt
|
||||
}
|
||||
|
||||
message AddShopInvitationsReq {
|
||||
int64 shopId = 1; //shopId
|
||||
int64 playerId = 2; //playerId
|
||||
string status = 3; //status
|
||||
int64 invitedBy = 4; //invitedBy
|
||||
int64 createdAt = 5; //createdAt
|
||||
int64 respondedAt = 6; //respondedAt
|
||||
}
|
||||
|
||||
message AddShopInvitationsResp {
|
||||
}
|
||||
|
||||
message UpdateShopInvitationsReq {
|
||||
int64 id = 1; //id
|
||||
int64 shopId = 2; //shopId
|
||||
int64 playerId = 3; //playerId
|
||||
string status = 4; //status
|
||||
int64 invitedBy = 5; //invitedBy
|
||||
int64 createdAt = 6; //createdAt
|
||||
int64 respondedAt = 7; //respondedAt
|
||||
}
|
||||
|
||||
message UpdateShopInvitationsResp {
|
||||
}
|
||||
|
||||
message DelShopInvitationsReq {
|
||||
int64 id = 1; //id
|
||||
}
|
||||
|
||||
message DelShopInvitationsResp {
|
||||
}
|
||||
|
||||
message GetShopInvitationsByIdReq {
|
||||
int64 id = 1; //id
|
||||
}
|
||||
|
||||
message GetShopInvitationsByIdResp {
|
||||
ShopInvitations shopInvitations = 1; //shopInvitations
|
||||
}
|
||||
|
||||
message SearchShopInvitationsReq {
|
||||
int64 page = 1; //page
|
||||
int64 limit = 2; //limit
|
||||
int64 id = 3; //id
|
||||
int64 shopId = 4; //shopId
|
||||
int64 playerId = 5; //playerId
|
||||
string status = 6; //status
|
||||
int64 invitedBy = 7; //invitedBy
|
||||
int64 createdAt = 8; //createdAt
|
||||
int64 respondedAt = 9; //respondedAt
|
||||
}
|
||||
|
||||
message SearchShopInvitationsResp {
|
||||
repeated ShopInvitations shopInvitations = 1; //shopInvitations
|
||||
}
|
||||
|
||||
//--------------------------------shopPlayers--------------------------------
|
||||
message ShopPlayers {
|
||||
int64 shopId = 1; //shopId
|
||||
int64 playerId = 2; //playerId
|
||||
bool isPrimary = 3; //isPrimary
|
||||
int64 joinedAt = 4; //joinedAt
|
||||
int64 leftAt = 5; //leftAt
|
||||
}
|
||||
|
||||
message AddShopPlayersReq {
|
||||
int64 shopId = 1; //shopId
|
||||
int64 playerId = 2; //playerId
|
||||
bool isPrimary = 3; //isPrimary
|
||||
int64 joinedAt = 4; //joinedAt
|
||||
int64 leftAt = 5; //leftAt
|
||||
}
|
||||
|
||||
message AddShopPlayersResp {
|
||||
}
|
||||
|
||||
message UpdateShopPlayersReq {
|
||||
int64 shopId = 1; //shopId
|
||||
int64 playerId = 2; //playerId
|
||||
bool isPrimary = 3; //isPrimary
|
||||
int64 joinedAt = 4; //joinedAt
|
||||
int64 leftAt = 5; //leftAt
|
||||
}
|
||||
|
||||
message UpdateShopPlayersResp {
|
||||
}
|
||||
|
||||
message DelShopPlayersReq {
|
||||
int64 id = 1; //id
|
||||
}
|
||||
|
||||
message DelShopPlayersResp {
|
||||
}
|
||||
|
||||
message GetShopPlayersByIdReq {
|
||||
int64 id = 1; //id
|
||||
}
|
||||
|
||||
message GetShopPlayersByIdResp {
|
||||
ShopPlayers shopPlayers = 1; //shopPlayers
|
||||
}
|
||||
|
||||
message SearchShopPlayersReq {
|
||||
int64 page = 1; //page
|
||||
int64 limit = 2; //limit
|
||||
int64 shopId = 3; //shopId
|
||||
int64 playerId = 4; //playerId
|
||||
bool isPrimary = 5; //isPrimary
|
||||
int64 joinedAt = 6; //joinedAt
|
||||
int64 leftAt = 7; //leftAt
|
||||
}
|
||||
|
||||
message SearchShopPlayersResp {
|
||||
repeated ShopPlayers shopPlayers = 1; //shopPlayers
|
||||
}
|
||||
|
||||
//--------------------------------shops--------------------------------
|
||||
message Shops {
|
||||
int64 id = 1; //id
|
||||
int64 ownerId = 2; //ownerId
|
||||
string name = 3; //name
|
||||
string banner = 4; //banner
|
||||
string description = 5; //description
|
||||
double rating = 6; //rating
|
||||
int64 totalOrders = 7; //totalOrders
|
||||
int64 playerCount = 8; //playerCount
|
||||
string commissionType = 9; //commissionType
|
||||
double commissionValue = 10; //commissionValue
|
||||
bool allowMultiShop = 11; //allowMultiShop
|
||||
bool allowIndependentOrders = 12; //allowIndependentOrders
|
||||
string dispatchMode = 13; //dispatchMode
|
||||
repeated string announcements = 14; //announcements
|
||||
string templateConfig = 15; //templateConfig
|
||||
int64 createdAt = 16; //createdAt
|
||||
int64 updatedAt = 17; //updatedAt
|
||||
}
|
||||
|
||||
message AddShopsReq {
|
||||
int64 ownerId = 1; //ownerId
|
||||
string name = 2; //name
|
||||
string banner = 3; //banner
|
||||
string description = 4; //description
|
||||
double rating = 5; //rating
|
||||
int64 totalOrders = 6; //totalOrders
|
||||
int64 playerCount = 7; //playerCount
|
||||
string commissionType = 8; //commissionType
|
||||
double commissionValue = 9; //commissionValue
|
||||
bool allowMultiShop = 10; //allowMultiShop
|
||||
bool allowIndependentOrders = 11; //allowIndependentOrders
|
||||
string dispatchMode = 12; //dispatchMode
|
||||
repeated string announcements = 13; //announcements
|
||||
string templateConfig = 14; //templateConfig
|
||||
int64 createdAt = 15; //createdAt
|
||||
int64 updatedAt = 16; //updatedAt
|
||||
}
|
||||
|
||||
message AddShopsResp {
|
||||
}
|
||||
|
||||
message UpdateShopsReq {
|
||||
int64 id = 1; //id
|
||||
int64 ownerId = 2; //ownerId
|
||||
string name = 3; //name
|
||||
string banner = 4; //banner
|
||||
string description = 5; //description
|
||||
double rating = 6; //rating
|
||||
int64 totalOrders = 7; //totalOrders
|
||||
int64 playerCount = 8; //playerCount
|
||||
string commissionType = 9; //commissionType
|
||||
double commissionValue = 10; //commissionValue
|
||||
bool allowMultiShop = 11; //allowMultiShop
|
||||
bool allowIndependentOrders = 12; //allowIndependentOrders
|
||||
string dispatchMode = 13; //dispatchMode
|
||||
repeated string announcements = 14; //announcements
|
||||
string templateConfig = 15; //templateConfig
|
||||
int64 createdAt = 16; //createdAt
|
||||
int64 updatedAt = 17; //updatedAt
|
||||
}
|
||||
|
||||
message UpdateShopsResp {
|
||||
}
|
||||
|
||||
message DelShopsReq {
|
||||
int64 id = 1; //id
|
||||
}
|
||||
|
||||
message DelShopsResp {
|
||||
}
|
||||
|
||||
message GetShopsByIdReq {
|
||||
int64 id = 1; //id
|
||||
}
|
||||
|
||||
message GetShopsByIdResp {
|
||||
Shops shops = 1; //shops
|
||||
}
|
||||
|
||||
message SearchShopsReq {
|
||||
int64 page = 1; //page
|
||||
int64 limit = 2; //limit
|
||||
int64 id = 3; //id
|
||||
int64 ownerId = 4; //ownerId
|
||||
string name = 5; //name
|
||||
string banner = 6; //banner
|
||||
string description = 7; //description
|
||||
double rating = 8; //rating
|
||||
int64 totalOrders = 9; //totalOrders
|
||||
int64 playerCount = 10; //playerCount
|
||||
string commissionType = 11; //commissionType
|
||||
double commissionValue = 12; //commissionValue
|
||||
bool allowMultiShop = 13; //allowMultiShop
|
||||
bool allowIndependentOrders = 14; //allowIndependentOrders
|
||||
string dispatchMode = 15; //dispatchMode
|
||||
repeated string announcements = 16; //announcements
|
||||
string templateConfig = 17; //templateConfig
|
||||
int64 createdAt = 18; //createdAt
|
||||
int64 updatedAt = 19; //updatedAt
|
||||
}
|
||||
|
||||
message SearchShopsResp {
|
||||
repeated Shops shops = 1; //shops
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ------------------------------------
|
||||
// Rpc Func
|
||||
// ------------------------------------
|
||||
|
||||
service shopService{
|
||||
|
||||
//-----------------------shopInvitations-----------------------
|
||||
rpc AddShopInvitations(AddShopInvitationsReq) returns (AddShopInvitationsResp);
|
||||
rpc UpdateShopInvitations(UpdateShopInvitationsReq) returns (UpdateShopInvitationsResp);
|
||||
rpc DelShopInvitations(DelShopInvitationsReq) returns (DelShopInvitationsResp);
|
||||
rpc GetShopInvitationsById(GetShopInvitationsByIdReq) returns (GetShopInvitationsByIdResp);
|
||||
rpc SearchShopInvitations(SearchShopInvitationsReq) returns (SearchShopInvitationsResp);
|
||||
//-----------------------shopPlayers-----------------------
|
||||
rpc AddShopPlayers(AddShopPlayersReq) returns (AddShopPlayersResp);
|
||||
rpc UpdateShopPlayers(UpdateShopPlayersReq) returns (UpdateShopPlayersResp);
|
||||
rpc DelShopPlayers(DelShopPlayersReq) returns (DelShopPlayersResp);
|
||||
rpc GetShopPlayersById(GetShopPlayersByIdReq) returns (GetShopPlayersByIdResp);
|
||||
rpc SearchShopPlayers(SearchShopPlayersReq) returns (SearchShopPlayersResp);
|
||||
//-----------------------shops-----------------------
|
||||
rpc AddShops(AddShopsReq) returns (AddShopsResp);
|
||||
rpc UpdateShops(UpdateShopsReq) returns (UpdateShopsResp);
|
||||
rpc DelShops(DelShopsReq) returns (DelShopsResp);
|
||||
rpc GetShopsById(GetShopsByIdReq) returns (GetShopsByIdResp);
|
||||
rpc SearchShops(SearchShopsReq) returns (SearchShopsResp);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
CREATE EXTENSION IF NOT EXISTS pg_trgm;
|
||||
CREATE EXTENSION IF NOT EXISTS btree_gin;
|
||||
CREATE EXTENSION IF NOT EXISTS btree_gist;
|
||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
||||
|
||||
CREATE OR REPLACE FUNCTION update_updated_at_column()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
NEW.updated_at = CURRENT_TIMESTAMP;
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ language 'plpgsql';
|
||||
@@ -1,49 +0,0 @@
|
||||
CREATE TABLE player_services (
|
||||
id BIGINT PRIMARY KEY,
|
||||
player_id BIGINT NOT NULL REFERENCES players(id),
|
||||
game_id BIGINT NOT NULL,
|
||||
title VARCHAR(200) NOT NULL,
|
||||
description TEXT,
|
||||
price DECIMAL(10,2) NOT NULL,
|
||||
unit VARCHAR(20) NOT NULL,
|
||||
rank_range VARCHAR(100),
|
||||
availability TEXT[] DEFAULT ARRAY[]::TEXT[],
|
||||
rating DECIMAL(3,2) DEFAULT 5.00,
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
|
||||
CONSTRAINT chk_price_positive CHECK (price > 0),
|
||||
CONSTRAINT chk_service_rating CHECK (rating >= 0 AND rating <= 5)
|
||||
);
|
||||
|
||||
-- 基础索引
|
||||
CREATE INDEX idx_services_player ON player_services(player_id) WHERE is_active = TRUE;
|
||||
CREATE INDEX idx_services_game ON player_services(game_id) WHERE is_active = TRUE;
|
||||
CREATE INDEX idx_services_price ON player_services(price);
|
||||
|
||||
-- 三元组索引用于服务标题模糊搜索
|
||||
CREATE INDEX idx_services_title_trgm ON player_services USING gin(title gin_trgm_ops)
|
||||
WHERE is_active = TRUE;
|
||||
|
||||
-- 全文搜索索引
|
||||
CREATE INDEX idx_services_fulltext ON player_services USING gin(
|
||||
to_tsvector('simple', title || ' ' || coalesce(description, ''))
|
||||
) WHERE is_active = TRUE;
|
||||
|
||||
-- 复合索引优化价格区间查询
|
||||
CREATE INDEX idx_services_game_price ON player_services(game_id, price, rating DESC)
|
||||
WHERE is_active = TRUE;
|
||||
|
||||
-- 打手+游戏复合索引
|
||||
CREATE INDEX idx_services_player_game ON player_services(player_id, game_id)
|
||||
WHERE is_active = TRUE;
|
||||
|
||||
-- GIN 索引优化时间段查询
|
||||
CREATE INDEX idx_services_availability ON player_services USING gin(availability)
|
||||
WHERE is_active = TRUE;
|
||||
|
||||
CREATE TRIGGER trigger_services_updated_at
|
||||
BEFORE UPDATE ON player_services
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION update_updated_at_column();
|
||||
@@ -1,17 +0,0 @@
|
||||
CREATE TABLE shop_invitations (
|
||||
id BIGINT PRIMARY KEY,
|
||||
shop_id BIGINT NOT NULL REFERENCES shops(id),
|
||||
player_id BIGINT NOT NULL,
|
||||
status VARCHAR(20) NOT NULL DEFAULT 'pending',
|
||||
invited_by BIGINT NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
responded_at TIMESTAMPTZ,
|
||||
|
||||
CONSTRAINT chk_invitation_status CHECK (status IN ('pending', 'accepted', 'rejected', 'cancelled')),
|
||||
UNIQUE(shop_id, player_id, status) WHERE status = 'pending'
|
||||
);
|
||||
|
||||
CREATE INDEX idx_invitations_shop ON shop_invitations(shop_id);
|
||||
CREATE INDEX idx_invitations_player ON shop_invitations(player_id) WHERE status = 'pending';
|
||||
CREATE INDEX idx_invitations_player_status ON shop_invitations(player_id, status, created_at DESC);
|
||||
CREATE INDEX idx_invitations_shop_status ON shop_invitations(shop_id, status, created_at DESC);
|
||||
@@ -0,0 +1,51 @@
|
||||
CREATE TABLE player_services
|
||||
(
|
||||
id BIGINT PRIMARY KEY,
|
||||
player_id BIGINT NOT NULL REFERENCES players (id),
|
||||
game_id BIGINT NOT NULL,
|
||||
title VARCHAR(200) NOT NULL,
|
||||
description TEXT,
|
||||
price DECIMAL(10, 2) NOT NULL,
|
||||
unit VARCHAR(20) NOT NULL,
|
||||
rank_range VARCHAR(100),
|
||||
availability TEXT[] DEFAULT ARRAY []::TEXT[],
|
||||
rating DECIMAL(3, 2) DEFAULT 5.00,
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
|
||||
CONSTRAINT chk_price_positive CHECK (price > 0),
|
||||
CONSTRAINT chk_service_rating CHECK (rating >= 0 AND rating <= 5)
|
||||
);
|
||||
|
||||
-- 基础索引
|
||||
CREATE INDEX idx_services_player ON player_services (player_id) WHERE is_active = TRUE;
|
||||
CREATE INDEX idx_services_game ON player_services (game_id) WHERE is_active = TRUE;
|
||||
CREATE INDEX idx_services_price ON player_services (price);
|
||||
|
||||
-- 三元组索引用于服务标题模糊搜索
|
||||
CREATE INDEX idx_services_title_trgm ON player_services USING gin (title gin_trgm_ops)
|
||||
WHERE is_active = TRUE;
|
||||
|
||||
-- 全文搜索索引
|
||||
CREATE INDEX idx_services_fulltext ON player_services USING gin (
|
||||
to_tsvector('simple', title || ' ' || coalesce(description, ''))
|
||||
) WHERE is_active = TRUE;
|
||||
|
||||
-- 复合索引优化价格区间查询
|
||||
CREATE INDEX idx_services_game_price ON player_services (game_id, price, rating DESC)
|
||||
WHERE is_active = TRUE;
|
||||
|
||||
-- 打手+游戏复合索引
|
||||
CREATE INDEX idx_services_player_game ON player_services (player_id, game_id)
|
||||
WHERE is_active = TRUE;
|
||||
|
||||
-- GIN 索引优化时间段查询
|
||||
CREATE INDEX idx_services_availability ON player_services USING gin (availability)
|
||||
WHERE is_active = TRUE;
|
||||
|
||||
CREATE TRIGGER trigger_services_updated_at
|
||||
BEFORE UPDATE
|
||||
ON player_services
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION update_updated_at_column();
|
||||
@@ -1,7 +1,5 @@
|
||||
CREATE TABLE players
|
||||
(
|
||||
id BIGINT PRIMARY KEY,
|
||||
CREATE TABLE players (
|
||||
id BIGINT PRIMARY KEY,
|
||||
user_id BIGINT NOT NULL UNIQUE,
|
||||
status VARCHAR(20) NOT NULL DEFAULT 'offline',
|
||||
@@ -11,12 +9,13 @@ CREATE TABLE players
|
||||
|
||||
-- [注意] 此字段为冗余缓存,通过消息队列与 shop_players 表保持一致
|
||||
shop_id BIGINT,
|
||||
|
||||
gender bool default 1 not null ,
|
||||
tags TEXT[] DEFAULT ARRAY[]::TEXT[],
|
||||
games BIGINT[] DEFAULT ARRAY[]::BIGINT[],
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- 基础索引
|
||||
CREATE INDEX idx_players_user ON players (user_id);
|
||||
CREATE INDEX idx_players_shop ON players (shop_id) WHERE shop_id IS NOT NULL;
|
||||
@@ -33,8 +32,8 @@ CREATE INDEX idx_players_tags_gin ON players USING gin(tags);
|
||||
-- 店铺+状态复合索引
|
||||
CREATE INDEX idx_players_shop_status ON players (shop_id, status, rating DESC) WHERE shop_id IS NOT NULL;
|
||||
|
||||
-- CREATE TRIGGER trigger_players_updated_at
|
||||
-- BEFORE UPDATE
|
||||
-- ON players
|
||||
-- FOR EACH ROW
|
||||
-- EXECUTE FUNCTION update_updated_at_column();
|
||||
CREATE TRIGGER trigger_players_updated_at
|
||||
BEFORE UPDATE
|
||||
ON players
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION update_updated_at_column();
|
||||
@@ -0,0 +1,20 @@
|
||||
CREATE TABLE shop_invitations
|
||||
(
|
||||
id BIGINT PRIMARY KEY,
|
||||
shop_id BIGINT NOT NULL REFERENCES shops (id),
|
||||
player_id BIGINT NOT NULL,
|
||||
status VARCHAR(20) NOT NULL DEFAULT 'pending',
|
||||
invited_by BIGINT NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
responded_at TIMESTAMPTZ,
|
||||
|
||||
CONSTRAINT chk_invitation_status CHECK (status IN ('pending', 'accepted', 'rejected', 'cancelled'))
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX idx_unique_pending_invitation
|
||||
ON shop_invitations (shop_id, player_id)
|
||||
WHERE status = 'pending';
|
||||
CREATE INDEX idx_invitations_shop ON shop_invitations (shop_id);
|
||||
CREATE INDEX idx_invitations_player ON shop_invitations (player_id) WHERE status = 'pending';
|
||||
CREATE INDEX idx_invitations_player_status ON shop_invitations (player_id, status, created_at DESC);
|
||||
CREATE INDEX idx_invitations_shop_status ON shop_invitations (shop_id, status, created_at DESC);
|
||||
@@ -3,9 +3,8 @@ CREATE TABLE shop_players
|
||||
shop_id BIGINT NOT NULL REFERENCES shops (id),
|
||||
player_id BIGINT NOT NULL,
|
||||
|
||||
-- [新增] 标记是否为主店铺。用于个人主页展示和 players.shop_id 缓存源
|
||||
-- 标记是否为主店铺。用于个人主页展示和 players.shop_id 缓存源
|
||||
is_primary BOOLEAN DEFAULT FALSE,
|
||||
|
||||
joined_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
left_at TIMESTAMPTZ, -- 软删除,表示已离职
|
||||
|
||||
Reference in New Issue
Block a user