Files
juwan-backend/desc/api/shop.api
T
wwweww 19cc7a778c Refactor: Remove deprecated gRPC service files and implement new API structure
- Deleted old gRPC service definitions in `game_grpc.pb.go` and `public.go`.
- Added new API server implementations for objectstory, player, and shop services.
- Introduced configuration files for new APIs in `etc/*.yaml`.
- Created main entry points for each service in `objectstory.go`, `player.go`, and `shop.go`.
- Removed unused user update handler and user API files.
- Added utility functions for context management and HTTP header parsing.
- Introduced PostgreSQL backup configuration in `backup/postgreSql.yaml`.
2026-02-28 18:35:56 +08:00

148 lines
3.9 KiB
Plaintext

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 string `json:"rating"`
TotalOrders int64 `json:"totalOrders"`
PlayerCount int64 `json:"playerCount"`
CommissionType string `json:"commissionType"`
CommissionValue string `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 string `json:"commissionValue"`
}
UpdateShopReq {
Id int64 `path:"id"`
Name string `json:"name,optional"`
Description string `json:"description,optional"`
CommissionType string `json:"commissionType,optional"`
CommissionValue string `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 string `json:"monthlyIncome"`
PendingSettlement string `json:"pendingSettlement"`
TotalWithdrawn string `json:"totalWithdrawn"`
TotalOrders int64 `json:"totalOrders"`
CompletedOrders int64 `json:"completedOrders"`
}
InvitationReq {
Id int64 `path:"id"`
PlayerId int64 `json:"playerId"`
}
)
type (
ShopIdReq {
Id int64 `path:"id"`
}
UserIdReq {
Id int64 `path:"id"`
}
)
@server (
prefix: api/v1
group: shop
)
service shop-api {
@doc "获取店铺列表"
@handler ListShops
get /shops (PageReq) returns (ShopListResp)
@doc "获取店铺详情"
@handler GetShop
get /shops/:id (ShopIdReq) returns (ShopProfile)
@doc "获取店长的店铺"
@handler GetUserShop
get /users/:id/shop (UserIdReq) returns (ShopProfile)
}
type (
DeleteAnnouncementReq {
Id int64 `path:"id"`
index int64 `path:"index"`
}
AcceptInvitationReq {
Id int64 `path:"id"`
}
)
@server (
prefix: api/v1
group: shop
)
service shop-api {
@doc "创建店铺"
@handler CreateShop
post /shops (CreateShopReq) returns (ShopProfile)
@doc "获取当前用户的店铺"
@handler GetMyShop
get /shops/mine (EmptyResp) returns (ShopProfile)
@doc "更新店铺信息"
@handler UpdateShop
put /shops/:id (ShopIdReq) returns (ShopProfile)
@doc "更新店铺模板"
@handler UpdateShopTemplate
put /shops/:id/template (UpdateTemplateReq) returns (EmptyResp)
@doc "新增店铺公告"
@handler AddAnnouncement
post /shops/:id/announcements (AnnouncementReq) 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 AcceptInvitation
post /shops/invitations/:id/accept (AcceptInvitationReq) returns (EmptyResp)
@doc "拒绝邀请"
@handler RejectInvitation
delete /shops/invitations/:id (AcceptInvitationReq) returns (EmptyResp)
@doc "移除打手"
@handler RemovePlayer
delete /shops/:id/players/:playerId (InvitationReq) returns (EmptyResp)
@doc "获取收入统计"
@handler GetShopIncomeStats
get /shops/:id/income-stats (AcceptInvitationReq) returns (IncomeStatsResp)
}