148 lines
3.9 KiB
Plaintext
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 (UpdateShopReq) 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)
|
|
}
|
|
|