137 lines
4.8 KiB
Plaintext
137 lines
4.8 KiB
Plaintext
syntax = "v1"
|
||
|
||
info (
|
||
title: "后台功能管理服务"
|
||
desc: "后台功能管理相关接口"
|
||
version: "v1"
|
||
)
|
||
|
||
// 功能管理接口
|
||
@server (
|
||
prefix: /api/v1/admin/feature
|
||
group: admin_feature
|
||
middleware: AdminAuthInterceptor
|
||
)
|
||
service main {
|
||
// 创建功能
|
||
@handler AdminCreateFeature
|
||
post /create (AdminCreateFeatureReq) returns (AdminCreateFeatureResp)
|
||
|
||
// 更新功能
|
||
@handler AdminUpdateFeature
|
||
put /update/:id (AdminUpdateFeatureReq) returns (AdminUpdateFeatureResp)
|
||
|
||
// 删除功能
|
||
@handler AdminDeleteFeature
|
||
delete /delete/:id (AdminDeleteFeatureReq) returns (AdminDeleteFeatureResp)
|
||
|
||
// 获取功能列表
|
||
@handler AdminGetFeatureList
|
||
get /list (AdminGetFeatureListReq) returns (AdminGetFeatureListResp)
|
||
|
||
// 获取功能详情
|
||
@handler AdminGetFeatureDetail
|
||
get /detail/:id (AdminGetFeatureDetailReq) returns (AdminGetFeatureDetailResp)
|
||
|
||
// 配置功能示例数据
|
||
@handler AdminConfigFeatureExample
|
||
post /config-example (AdminConfigFeatureExampleReq) returns (AdminConfigFeatureExampleResp)
|
||
|
||
// 查看功能示例数据
|
||
@handler AdminGetFeatureExample
|
||
get /example/:feature_id (AdminGetFeatureExampleReq) returns (AdminGetFeatureExampleResp)
|
||
}
|
||
|
||
type (
|
||
// 创建功能请求
|
||
AdminCreateFeatureReq {
|
||
ApiId string `json:"api_id"` // API标识
|
||
Name string `json:"name"` // 描述
|
||
WhitelistPrice *float64 `json:"whitelist_price,optional"` // 白名单屏蔽价格(单位:元)
|
||
CostPrice *float64 `json:"cost_price,optional"` // 天远API调用成本价(单位:元)
|
||
}
|
||
// 创建功能响应
|
||
AdminCreateFeatureResp {
|
||
Id string `json:"id"` // 功能ID
|
||
}
|
||
// 更新功能请求
|
||
AdminUpdateFeatureReq {
|
||
Id string `path:"id"` // 功能ID
|
||
ApiId *string `json:"api_id,optional"` // API标识
|
||
Name *string `json:"name,optional"` // 描述
|
||
WhitelistPrice *float64 `json:"whitelist_price,optional"` // 白名单屏蔽价格(单位:元)
|
||
CostPrice *float64 `json:"cost_price,optional"` // 天远API调用成本价(单位:元)
|
||
}
|
||
// 更新功能响应
|
||
AdminUpdateFeatureResp {
|
||
Success bool `json:"success"` // 是否成功
|
||
}
|
||
// 删除功能请求
|
||
AdminDeleteFeatureReq {
|
||
Id string `path:"id"` // 功能ID
|
||
}
|
||
// 删除功能响应
|
||
AdminDeleteFeatureResp {
|
||
Success bool `json:"success"` // 是否成功
|
||
}
|
||
// 获取功能列表请求
|
||
AdminGetFeatureListReq {
|
||
Page int64 `form:"page"` // 页码
|
||
PageSize int64 `form:"pageSize"` // 每页数量
|
||
ApiId *string `form:"api_id,optional"` // API标识
|
||
Name *string `form:"name,optional"` // 描述
|
||
}
|
||
// 功能列表项
|
||
FeatureListItem {
|
||
Id string `json:"id"` // 功能ID
|
||
ApiId string `json:"api_id"` // API标识
|
||
Name string `json:"name"` // 描述
|
||
WhitelistPrice float64 `json:"whitelist_price"` // 白名单屏蔽价格(单位:元)
|
||
CostPrice float64 `json:"cost_price"` // 天远API调用成本价(单位:元)
|
||
CreateTime string `json:"create_time"` // 创建时间
|
||
UpdateTime string `json:"update_time"` // 更新时间
|
||
}
|
||
// 获取功能列表响应
|
||
AdminGetFeatureListResp {
|
||
Total int64 `json:"total"` // 总数
|
||
Items []FeatureListItem `json:"items"` // 列表数据
|
||
}
|
||
// 获取功能详情请求
|
||
AdminGetFeatureDetailReq {
|
||
Id string `path:"id"` // 功能ID
|
||
}
|
||
// 获取功能详情响应
|
||
AdminGetFeatureDetailResp {
|
||
Id string `json:"id"` // 功能ID
|
||
ApiId string `json:"api_id"` // API标识
|
||
Name string `json:"name"` // 描述
|
||
WhitelistPrice float64 `json:"whitelist_price"` // 白名单屏蔽价格(单位:元)
|
||
CostPrice float64 `json:"cost_price"` // 天远API调用成本价(单位:元)
|
||
CreateTime string `json:"create_time"` // 创建时间
|
||
UpdateTime string `json:"update_time"` // 更新时间
|
||
}
|
||
// 配置功能示例数据请求
|
||
AdminConfigFeatureExampleReq {
|
||
FeatureId string `json:"feature_id"` // 功能ID
|
||
Data string `json:"data"` // 示例数据JSON
|
||
}
|
||
// 配置功能示例数据响应
|
||
AdminConfigFeatureExampleResp {
|
||
Success bool `json:"success"` // 是否成功
|
||
}
|
||
// 查看功能示例数据请求
|
||
AdminGetFeatureExampleReq {
|
||
FeatureId string `path:"feature_id"` // 功能ID
|
||
}
|
||
// 查看功能示例数据响应
|
||
AdminGetFeatureExampleResp {
|
||
Id string `json:"id"` // 示例数据ID
|
||
FeatureId string `json:"feature_id"` // 功能ID
|
||
ApiId string `json:"api_id"` // API标识
|
||
Data string `json:"data"` // 示例数据JSON
|
||
CreateTime string `json:"create_time"` // 创建时间
|
||
UpdateTime string `json:"update_time"` // 更新时间
|
||
}
|
||
)
|
||
|