From 111c2f59dda2df81d22330cf8cb7e6a1a7022160 Mon Sep 17 00:00:00 2001 From: zetaloop Date: Sat, 25 Apr 2026 04:53:15 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E8=87=AA=E5=8A=A8=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/email/api/internal/utils/genCode.go | 2 +- .../rpc/internal/svc/serviceContext.go | 2 +- app/order/api/internal/logic/order/helpers.go | 22 ++-- app/order/rpc/internal/config/config.go | 2 +- app/player/rpc/internal/config/config.go | 2 +- app/wallet/rpc/internal/config/config.go | 2 +- deploy/dev/seed.py | 23 +++- deploy/dev/test_all_apis.py | 8 +- desc/api/chat.api | 120 +++++++++--------- desc/api/common.api | 80 ++++++------ desc/api/dispute.api | 103 ++++++++------- desc/api/notification.api | 60 ++++----- desc/api/review.api | 77 ++++++----- desc/api/search.api | 109 ++++++++-------- desc/rpc/chat.proto | 58 ++++----- 15 files changed, 333 insertions(+), 337 deletions(-) diff --git a/app/email/api/internal/utils/genCode.go b/app/email/api/internal/utils/genCode.go index 53e77d1..dce9006 100644 --- a/app/email/api/internal/utils/genCode.go +++ b/app/email/api/internal/utils/genCode.go @@ -13,4 +13,4 @@ func GenCode() string { } return fmt.Sprintf("%06d", n.Int64()) -} \ No newline at end of file +} diff --git a/app/objectstory/rpc/internal/svc/serviceContext.go b/app/objectstory/rpc/internal/svc/serviceContext.go index 350eef4..1ee3cf2 100644 --- a/app/objectstory/rpc/internal/svc/serviceContext.go +++ b/app/objectstory/rpc/internal/svc/serviceContext.go @@ -14,7 +14,7 @@ type ServiceContext struct { func NewServiceContext(c config.Config) *ServiceContext { s3obj := NewObjectStorage(c.S3Conf) - + return &ServiceContext{ Config: c, S3: s3obj.MustNews3Client(context.Background()), diff --git a/app/order/api/internal/logic/order/helpers.go b/app/order/api/internal/logic/order/helpers.go index da3d14e..4b7df4b 100644 --- a/app/order/api/internal/logic/order/helpers.go +++ b/app/order/api/internal/logic/order/helpers.go @@ -39,17 +39,17 @@ func toAPIOrder(in *orderservice.Orders) types.Order { _ = json.Unmarshal([]byte(in.GetServiceSnapshot()), &service) order = types.Order{ - Id: in.GetId(), - ConsumerId: in.GetConsumerId(), - PlayerId: playerID, - ShopId: in.GetShopId(), - Service: service, - Status: in.GetStatus(), - TotalPrice: totalPrice, - Note: in.GetNote(), - CreatedAt: formatUnix(in.GetCreatedAt()), - AcceptedAt: formatUnix(in.GetAcceptedAt()), - CompletedAt: formatUnix(in.GetCompletedAt()), + Id: in.GetId(), + ConsumerId: in.GetConsumerId(), + PlayerId: playerID, + ShopId: in.GetShopId(), + Service: service, + Status: in.GetStatus(), + TotalPrice: totalPrice, + Note: in.GetNote(), + CreatedAt: formatUnix(in.GetCreatedAt()), + AcceptedAt: formatUnix(in.GetAcceptedAt()), + CompletedAt: formatUnix(in.GetCompletedAt()), } return order diff --git a/app/order/rpc/internal/config/config.go b/app/order/rpc/internal/config/config.go index faeb55a..f4107e8 100644 --- a/app/order/rpc/internal/config/config.go +++ b/app/order/rpc/internal/config/config.go @@ -9,7 +9,7 @@ type Config struct { zrpc.RpcServerConf SnowflakeRpcConf zrpc.RpcClientConf - DB struct { + DB struct { Master string Slaves string } diff --git a/app/player/rpc/internal/config/config.go b/app/player/rpc/internal/config/config.go index faeb55a..f4107e8 100644 --- a/app/player/rpc/internal/config/config.go +++ b/app/player/rpc/internal/config/config.go @@ -9,7 +9,7 @@ type Config struct { zrpc.RpcServerConf SnowflakeRpcConf zrpc.RpcClientConf - DB struct { + DB struct { Master string Slaves string } diff --git a/app/wallet/rpc/internal/config/config.go b/app/wallet/rpc/internal/config/config.go index faeb55a..f4107e8 100644 --- a/app/wallet/rpc/internal/config/config.go +++ b/app/wallet/rpc/internal/config/config.go @@ -9,7 +9,7 @@ type Config struct { zrpc.RpcServerConf SnowflakeRpcConf zrpc.RpcClientConf - DB struct { + DB struct { Master string Slaves string } diff --git a/deploy/dev/seed.py b/deploy/dev/seed.py index f37c465..fde778f 100644 --- a/deploy/dev/seed.py +++ b/deploy/dev/seed.py @@ -26,9 +26,26 @@ PASSWORD = "test1234" def psql(sql: str) -> str: r = subprocess.run( - ["docker", "exec", "-i", CONTAINER, "psql", "-U", DB_USER, "-d", DB_NAME, - "-v", "ON_ERROR_STOP=1", "--no-psqlrc", "-t", "-A"], - input=sql, capture_output=True, text=True, timeout=30, + [ + "docker", + "exec", + "-i", + CONTAINER, + "psql", + "-U", + DB_USER, + "-d", + DB_NAME, + "-v", + "ON_ERROR_STOP=1", + "--no-psqlrc", + "-t", + "-A", + ], + input=sql, + capture_output=True, + text=True, + timeout=30, ) if r.returncode != 0: print(f"psql error:\n{r.stderr}", file=sys.stderr) diff --git a/deploy/dev/test_all_apis.py b/deploy/dev/test_all_apis.py index ca5eb25..b2d7f68 100644 --- a/deploy/dev/test_all_apis.py +++ b/deploy/dev/test_all_apis.py @@ -647,7 +647,9 @@ def phase6_player(s: Session, game_id): return player_id, service_id -def phase7_shop(s_owner: Session, s_invited_player: Session, owner_user_id, invited_player_id): +def phase7_shop( + s_owner: Session, s_invited_player: Session, owner_user_id, invited_player_id +): print("\n=== Phase 7: Shop ===") s_owner.post( @@ -1206,7 +1208,9 @@ def main(): phase2_user(s_user, user_id) s_consumer.get(f"{GATEWAY}/healthz") - phase1_register(s_consumer, consumer_name, consumer_email, consumer_pass, label="consumer") + phase1_register( + s_consumer, consumer_name, consumer_email, consumer_pass, label="consumer" + ) consumer_login_resp = phase1_login( s_consumer, consumer_name, diff --git a/desc/api/chat.api b/desc/api/chat.api index 93c1a58..e38ab9d 100644 --- a/desc/api/chat.api +++ b/desc/api/chat.api @@ -1,76 +1,70 @@ syntax = "v1" + import "common.api" type ( - SessionIdReq { - Id int64 `path:"id"` - } - - CreateGroupReq { - Name string `json:"name"` - Participants []int64 `json:"participants,optional"` - } - - CreateDMReq { - TargetId int64 `json:"targetId"` - } - - ChatSession { - Id int64 `json:"id"` - Type string `json:"type"` - Name string `json:"name"` - CreatorId int64 `json:"creatorId"` - Participants []int64 `json:"participants"` - LastMessage string `json:"lastMessage"` - LastMessageAt int64 `json:"lastMessageAt"` - CreatedAt int64 `json:"createdAt"` - } - - ChatSessionListResp { - Items []ChatSession `json:"items"` - } - - ChatMessage { - Id int64 `json:"id"` - SessionId int64 `json:"sessionId"` - SenderId int64 `json:"senderId"` - Type string `json:"type"` - Content string `json:"content"` - CreatedAt int64 `json:"createdAt"` - } - - ChatMessageListResp { - Items []ChatMessage `json:"items"` - } - - ListMessageReq { - SessionIdReq - PageReq - } + SessionIdReq { + Id int64 `path:"id"` + } + CreateGroupReq { + Name string `json:"name"` + Participants []int64 `json:"participants,optional"` + } + CreateDMReq { + TargetId int64 `json:"targetId"` + } + ChatSession { + Id int64 `json:"id"` + Type string `json:"type"` + Name string `json:"name"` + CreatorId int64 `json:"creatorId"` + Participants []int64 `json:"participants"` + LastMessage string `json:"lastMessage"` + LastMessageAt int64 `json:"lastMessageAt"` + CreatedAt int64 `json:"createdAt"` + } + ChatSessionListResp { + Items []ChatSession `json:"items"` + } + ChatMessage { + Id int64 `json:"id"` + SessionId int64 `json:"sessionId"` + SenderId int64 `json:"senderId"` + Type string `json:"type"` + Content string `json:"content"` + CreatedAt int64 `json:"createdAt"` + } + ChatMessageListResp { + Items []ChatMessage `json:"items"` + } + ListMessageReq { + SessionIdReq + PageReq + } ) -@server( - prefix: api/v1/chat - group: chat +@server ( + prefix: api/v1/chat + group: chat ) service chat-api { - @doc "create group session" - @handler CreateGroup - post /sessions/group (CreateGroupReq) returns (ChatSession) + @doc "create group session" + @handler CreateGroup + post /sessions/group (CreateGroupReq) returns (ChatSession) - @doc "create dm session" - @handler CreateDM - post /sessions/dm (CreateDMReq) returns (ChatSession) + @doc "create dm session" + @handler CreateDM + post /sessions/dm (CreateDMReq) returns (ChatSession) - @doc "list user sessions" - @handler ListSessions - get /sessions (PageReq) returns (ChatSessionListResp) + @doc "list user sessions" + @handler ListSessions + get /sessions (PageReq) returns (ChatSessionListResp) - @doc "get session detail" - @handler GetSession - get /sessions/:id (SessionIdReq) returns (ChatSession) + @doc "get session detail" + @handler GetSession + get /sessions/:id (SessionIdReq) returns (ChatSession) - @doc "get message history" - @handler ListMessages - get /sessions/:id/messages (ListMessageReq) returns (ChatMessageListResp) + @doc "get message history" + @handler ListMessages + get /sessions/:id/messages (ListMessageReq) returns (ChatMessageListResp) } diff --git a/desc/api/common.api b/desc/api/common.api index 4ffa5c8..1dc9b62 100644 --- a/desc/api/common.api +++ b/desc/api/common.api @@ -1,47 +1,43 @@ syntax = "v1" -info( - title: "公共定义" - desc: "Common structures" - author: "Juwan Team" - version: "1.0" +info ( + title: "公共定义" + desc: "Common structures" + author: "Juwan Team" + version: "1.0" ) type ( - // 分页请求基础 - PageReq { - Offset int64 `form:"offset,default=0"` - Limit int64 `form:"limit,default=20"` - } - - // 分页响应元数据 - PageMeta { - Total int64 `json:"total"` - Offset int64 `json:"offset"` - Limit int64 `json:"limit"` - } - - // 空响应 - EmptyResp {} - - // 核心用户画像 (被 Auth, Community, Shop 等多个服务引用) - UserProfile { - Id string `json:"id"` - Username string `json:"username"` - Nickname string `json:"nickname"` - Avatar string `json:"avatar"` - Role string `json:"role"` // consumer, player, owner, admin - VerifiedRoles []string `json:"verifiedRoles"` - VerificationStatus map[string]string `json:"verificationStatus"` - Phone string `json:"phone,optional"` - Bio string `json:"bio,optional"` - CreatedAt string `json:"createdAt"` - } - - // 简略用户信息 (用于列表、聊天头像等) - SimpleUser { - Id string `json:"id"` - Nickname string `json:"nickname"` - Avatar string `json:"avatar"` - } -) \ No newline at end of file + // 分页请求基础 + PageReq { + Offset int64 `form:"offset,default=0"` + Limit int64 `form:"limit,default=20"` + } + // 分页响应元数据 + PageMeta { + Total int64 `json:"total"` + Offset int64 `json:"offset"` + Limit int64 `json:"limit"` + } + // 空响应 + EmptyResp {} + // 核心用户画像 (被 Auth, Community, Shop 等多个服务引用) + UserProfile { + Id string `json:"id"` + Username string `json:"username"` + Nickname string `json:"nickname"` + Avatar string `json:"avatar"` + Role string `json:"role"` // consumer, player, owner, admin + VerifiedRoles []string `json:"verifiedRoles"` + VerificationStatus map[string]string `json:"verificationStatus"` + Phone string `json:"phone,optional"` + Bio string `json:"bio,optional"` + CreatedAt string `json:"createdAt"` + } + // 简略用户信息 (用于列表、聊天头像等) + SimpleUser { + Id string `json:"id"` + Nickname string `json:"nickname"` + Avatar string `json:"avatar"` + } +) diff --git a/desc/api/dispute.api b/desc/api/dispute.api index c20463d..0be559d 100644 --- a/desc/api/dispute.api +++ b/desc/api/dispute.api @@ -1,65 +1,62 @@ syntax = "v1" + import "common.api" type ( - PathId { - Id int64 `path:"id"` - } - Dispute { - 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"` - } - - CreateDisputeReq { - PathId - Reason string `json:"reason"` - Evidence []string `json:"evidence"` - } - - DisputeResponseReq { - PathId - Reason string `json:"reason"` - Evidence []string `json:"evidence"` - } - - AppealReq { - PathId - Reason string `json:"reason"` - } + PathId { + Id int64 `path:"id"` + } + Dispute { + 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"` + } + CreateDisputeReq { + PathId + Reason string `json:"reason"` + Evidence []string `json:"evidence"` + } + DisputeResponseReq { + PathId + Reason string `json:"reason"` + Evidence []string `json:"evidence"` + } + AppealReq { + PathId + Reason string `json:"reason"` + } ) -@server( - prefix: api/v1 - group: dispute +@server ( + prefix: api/v1 + group: dispute ) service dispute-api { - @doc "获取争议列表" - @handler ListDisputes - get /disputes (PageReq) returns (DisputeListResp) + @doc "获取争议列表" + @handler ListDisputes + get /disputes (PageReq) returns (DisputeListResp) - @doc "获取订单争议" - @handler GetOrderDispute - get /orders/:id/dispute (PathId) returns (Dispute) + @doc "获取订单争议" + @handler GetOrderDispute + get /orders/:id/dispute (PathId) returns (Dispute) - @doc "发起争议" - @handler CreateDispute - post /orders/:id/dispute (CreateDisputeReq) returns (EmptyResp) + @doc "发起争议" + @handler CreateDispute + post /orders/:id/dispute (CreateDisputeReq) returns (EmptyResp) - @doc "回应争议" - @handler RespondDispute - post /disputes/:id/response (DisputeResponseReq) returns (EmptyResp) + @doc "回应争议" + @handler RespondDispute + post /disputes/:id/response (DisputeResponseReq) returns (EmptyResp) - @doc "申诉" - @handler AppealDispute - post /disputes/:id/appeal (AppealReq) returns (EmptyResp) -} \ No newline at end of file + @doc "申诉" + @handler AppealDispute + post /disputes/:id/appeal (AppealReq) returns (EmptyResp) +} diff --git a/desc/api/notification.api b/desc/api/notification.api index 6d30e48..4ceb8f4 100644 --- a/desc/api/notification.api +++ b/desc/api/notification.api @@ -1,40 +1,40 @@ syntax = "v1" + import "common.api" type ( - PathId { - Id int64 `path:"id"` - } - Notification { - Id int64 `json:"id"` - Type string `json:"type"` - Title string `json:"title"` - Content string `json:"content"` - Read bool `json:"read"` - Link string `json:"link,optional"` - CreatedAt string `json:"createdAt"` - } - - NotificationListResp { - Items []Notification `json:"items"` - Meta PageMeta `json:"meta"` - } + PathId { + Id int64 `path:"id"` + } + Notification { + Id int64 `json:"id"` + Type string `json:"type"` + Title string `json:"title"` + Content string `json:"content"` + Read bool `json:"read"` + Link string `json:"link,optional"` + CreatedAt string `json:"createdAt"` + } + NotificationListResp { + Items []Notification `json:"items"` + Meta PageMeta `json:"meta"` + } ) -@server( - prefix: api/v1 - group: notification +@server ( + prefix: api/v1 + group: notification ) service notifi-api { - @doc "获取通知列表" - @handler ListNotifications - get /notifications (PageReq) returns (NotificationListResp) + @doc "获取通知列表" + @handler ListNotifications + get /notifications (PageReq) returns (NotificationListResp) - @doc "标记已读" - @handler ReadNotification - put /notifications/:id/read (PathId) returns (EmptyResp) + @doc "标记已读" + @handler ReadNotification + put /notifications/:id/read (PathId) returns (EmptyResp) - @doc "全部已读" - @handler ReadAllNotifications - put /notifications/read-all (EmptyResp) returns (EmptyResp) -} \ No newline at end of file + @doc "全部已读" + @handler ReadAllNotifications + put /notifications/read-all (EmptyResp) returns (EmptyResp) +} diff --git a/desc/api/review.api b/desc/api/review.api index 7e24421..cbff4f1 100644 --- a/desc/api/review.api +++ b/desc/api/review.api @@ -1,53 +1,52 @@ syntax = "v1" + import "common.api" type ( - Review { - Id int64 `json:"id"` - OrderId int64 `json:"orderId"` - FromUserId int64 `json:"fromUserId"` - FromUserName string `json:"fromUserName"` - Rating int `json:"rating"` - Content string `json:"content"` - Sealed bool `json:"sealed"` - CreatedAt string `json:"createdAt"` - } - - ReviewListResp { - Items []Review `json:"items"` - Meta PageMeta `json:"meta"` - } - - SubmitReviewReq { - Rating int `json:"rating"` - Content string `json:"content,optional"` - } + Review { + Id int64 `json:"id"` + OrderId int64 `json:"orderId"` + FromUserId int64 `json:"fromUserId"` + FromUserName string `json:"fromUserName"` + Rating int `json:"rating"` + Content string `json:"content"` + Sealed bool `json:"sealed"` + CreatedAt string `json:"createdAt"` + } + ReviewListResp { + Items []Review `json:"items"` + Meta PageMeta `json:"meta"` + } + SubmitReviewReq { + Rating int `json:"rating"` + Content string `json:"content,optional"` + } ) -@server( - prefix: api/v1 - group: review +@server ( + prefix: api/v1 + group: review ) service review-api { - @doc "提交评价" - @handler SubmitReview - post /orders/:id/review (SubmitReviewReq) returns (EmptyResp) + @doc "提交评价" + @handler SubmitReview + post /orders/:id/review (SubmitReviewReq) returns (EmptyResp) - @doc "获取订单评价" - @handler GetOrderReviews - get /orders/:id/reviews (EmptyResp) returns ([]Review) + @doc "获取订单评价" + @handler GetOrderReviews + get /orders/:id/reviews (EmptyResp) returns ([]Review) } -@server( - prefix: api/v1 - group: review +@server ( + prefix: api/v1 + group: review ) service review-api { - @doc "获取公开评价列表" - @handler ListReviews - get /reviews (PageReq) returns (ReviewListResp) + @doc "获取公开评价列表" + @handler ListReviews + get /reviews (PageReq) returns (ReviewListResp) - @doc "获取用户收到的评价" - @handler ListUserReviews - get /users/:id/reviews (PageReq) returns (ReviewListResp) -} \ No newline at end of file + @doc "获取用户收到的评价" + @handler ListUserReviews + get /users/:id/reviews (PageReq) returns (ReviewListResp) +} diff --git a/desc/api/search.api b/desc/api/search.api index 9b1bc51..bb0ca72 100644 --- a/desc/api/search.api +++ b/desc/api/search.api @@ -1,72 +1,69 @@ syntax = "v1" + import "common.api" type ( - PathIDReq { - Id int64 `path:"id"` - } - SearchReq { - PageReq - Q string `form:"q"` - MinPrice float64 `form:"min,optional"` - MaxPrice float64 `form:"max,optional"` - OnlyOnline bool `form:"onlyOnline,optional"` - Sort string `form:"sort,optional"` - } - - SearchResp { - Items []interface{} `json:"items"` // Mixed items - Meta PageMeta `json:"meta"` - } - - FavoriteReq { - TargetType string `json:"targetType"` // player, shop - TargetId int64 `json:"targetId"` - } - - FavoriteCheckReq { - PathIDReq - TargetType string `form:"targetType"` - TargetId int64 `form:"targetId"` - } - - FavoriteCheckResp { - Favorited bool `json:"favorited"` - } + PathIDReq { + Id int64 `path:"id"` + } + SearchReq { + PageReq + Q string `form:"q"` + MinPrice float64 `form:"min,optional"` + MaxPrice float64 `form:"max,optional"` + OnlyOnline bool `form:"onlyOnline,optional"` + Sort string `form:"sort,optional"` + } + SearchResp { + Items []interface{} `json:"items"` // Mixed items + Meta PageMeta `json:"meta"` + } + FavoriteReq { + TargetType string `json:"targetType"` // player, shop + TargetId int64 `json:"targetId"` + } + FavoriteCheckReq { + PathIDReq + TargetType string `form:"targetType"` + TargetId int64 `form:"targetId"` + } + FavoriteCheckResp { + Favorited bool `json:"favorited"` + } ) -@server( - prefix: api/v1 - group: search +@server ( + prefix: api/v1 + group: search ) service search-api { - @doc "统一搜索" - @handler Search - get /search (SearchReq) returns (SearchResp) + @doc "统一搜索" + @handler Search + get /search (SearchReq) returns (SearchResp) - @doc "首页推荐" - @handler Recommendations - get /recommendations/home (PageReq) returns (SearchResp) + @doc "首页推荐" + @handler Recommendations + get /recommendations/home (PageReq) returns (SearchResp) } -@server( - prefix: api/v1 - group: favorites +@server ( + prefix: api/v1 + group: favorites ) service search-api { - @doc "获取收藏列表" - @handler ListFavorites - get /favorites (PageReq) returns (SearchResp) + @doc "获取收藏列表" + @handler ListFavorites + get /favorites (PageReq) returns (SearchResp) - @doc "添加收藏" - @handler AddFavorite - post /favorites (FavoriteReq) returns (EmptyResp) + @doc "添加收藏" + @handler AddFavorite + post /favorites (FavoriteReq) returns (EmptyResp) - @doc "取消收藏" - @handler RemoveFavorite - delete /favorites/:id (PathIDReq) returns (EmptyResp) + @doc "取消收藏" + @handler RemoveFavorite + delete /favorites/:id (PathIDReq) returns (EmptyResp) - @doc "检查收藏状态" - @handler CheckFavorite - get /users/:id/favorites/check (FavoriteCheckReq) returns (FavoriteCheckResp) -} \ No newline at end of file + @doc "检查收藏状态" + @handler CheckFavorite + get /users/:id/favorites/check (FavoriteCheckReq) returns (FavoriteCheckResp) +} diff --git a/desc/rpc/chat.proto b/desc/rpc/chat.proto index ce88542..df7ae8f 100644 --- a/desc/rpc/chat.proto +++ b/desc/rpc/chat.proto @@ -1,12 +1,12 @@ syntax = "proto3"; -option go_package ="./pb"; - package pb; -// ------------------------------------ +option go_package = "./pb"; + +// ------------------------------------ // Messages -// ------------------------------------ +// ------------------------------------ //--------------------------------chatSessions-------------------------------- message ChatSessions { @@ -39,15 +39,13 @@ message UpdateChatSessionsReq { optional int64 lastMessageAt = 4; //lastMessageAt } -message UpdateChatSessionsResp { -} +message UpdateChatSessionsResp {} message DelChatSessionsReq { int64 id = 1; //id } -message DelChatSessionsResp { -} +message DelChatSessionsResp {} message GetChatSessionsByIdReq { int64 id = 1; //id @@ -73,16 +71,14 @@ message AddParticipantReq { int64 userId = 2; //userId } -message AddParticipantResp { -} +message AddParticipantResp {} message RemoveParticipantReq { int64 sessionId = 1; //sessionId int64 userId = 2; //userId } -message RemoveParticipantResp { -} +message RemoveParticipantResp {} //--------------------------------chatMessages-------------------------------- message ChatMessages { @@ -109,8 +105,7 @@ message DelChatMessagesReq { int64 id = 1; //id } -message DelChatMessagesResp { -} +message DelChatMessagesResp {} message GetChatMessagesByIdReq { int64 id = 1; //id @@ -131,25 +126,22 @@ message SearchChatMessagesResp { repeated ChatMessages chatMessages = 1; //chatMessages } - -// ------------------------------------ +// ------------------------------------ // Rpc Func -// ------------------------------------ - -service chatService{ - - //-----------------------chatSessions----------------------- - rpc AddChatSessions(AddChatSessionsReq) returns (AddChatSessionsResp); - rpc UpdateChatSessions(UpdateChatSessionsReq) returns (UpdateChatSessionsResp); - rpc DelChatSessions(DelChatSessionsReq) returns (DelChatSessionsResp); - rpc GetChatSessionsById(GetChatSessionsByIdReq) returns (GetChatSessionsByIdResp); - rpc SearchChatSessions(SearchChatSessionsReq) returns (SearchChatSessionsResp); - rpc AddParticipant(AddParticipantReq) returns (AddParticipantResp); - rpc RemoveParticipant(RemoveParticipantReq) returns (RemoveParticipantResp); - //-----------------------chatMessages----------------------- - rpc AddChatMessages(AddChatMessagesReq) returns (AddChatMessagesResp); - rpc DelChatMessages(DelChatMessagesReq) returns (DelChatMessagesResp); - rpc GetChatMessagesById(GetChatMessagesByIdReq) returns (GetChatMessagesByIdResp); - rpc SearchChatMessages(SearchChatMessagesReq) returns (SearchChatMessagesResp); +// ------------------------------------ +service chatService { + //-----------------------chatSessions----------------------- + rpc AddChatSessions(AddChatSessionsReq) returns (AddChatSessionsResp); + rpc UpdateChatSessions(UpdateChatSessionsReq) returns (UpdateChatSessionsResp); + rpc DelChatSessions(DelChatSessionsReq) returns (DelChatSessionsResp); + rpc GetChatSessionsById(GetChatSessionsByIdReq) returns (GetChatSessionsByIdResp); + rpc SearchChatSessions(SearchChatSessionsReq) returns (SearchChatSessionsResp); + rpc AddParticipant(AddParticipantReq) returns (AddParticipantResp); + rpc RemoveParticipant(RemoveParticipantReq) returns (RemoveParticipantResp); + //-----------------------chatMessages----------------------- + rpc AddChatMessages(AddChatMessagesReq) returns (AddChatMessagesResp); + rpc DelChatMessages(DelChatMessagesReq) returns (DelChatMessagesResp); + rpc GetChatMessagesById(GetChatMessagesByIdReq) returns (GetChatMessagesByIdResp); + rpc SearchChatMessages(SearchChatMessagesReq) returns (SearchChatMessagesResp); }