175 lines
5.6 KiB
Plaintext
175 lines
5.6 KiB
Plaintext
syntax = "v1"
|
|
|
|
info (
|
|
title: "后台产品管理服务"
|
|
desc: "后台产品管理相关接口"
|
|
author: "Liangzai"
|
|
email: "2440983361@qq.com"
|
|
version: "v1"
|
|
)
|
|
|
|
// 产品管理接口
|
|
@server(
|
|
prefix: /api/v1/admin/product
|
|
group: admin_product
|
|
)
|
|
service main {
|
|
// 创建产品
|
|
@handler AdminCreateProduct
|
|
post /create (AdminCreateProductReq) returns (AdminCreateProductResp)
|
|
|
|
// 更新产品
|
|
@handler AdminUpdateProduct
|
|
put /update/:id (AdminUpdateProductReq) returns (AdminUpdateProductResp)
|
|
|
|
// 删除产品
|
|
@handler AdminDeleteProduct
|
|
delete /delete/:id (AdminDeleteProductReq) returns (AdminDeleteProductResp)
|
|
|
|
// 获取产品列表
|
|
@handler AdminGetProductList
|
|
get /list (AdminGetProductListReq) returns (AdminGetProductListResp)
|
|
|
|
// 获取产品详情
|
|
@handler AdminGetProductDetail
|
|
get /detail/:id (AdminGetProductDetailReq) returns (AdminGetProductDetailResp)
|
|
|
|
// 获取产品功能列表
|
|
@handler AdminGetProductFeatureList
|
|
get /feature/list/:product_id (AdminGetProductFeatureListReq) returns ([]AdminGetProductFeatureListResp)
|
|
|
|
// 更新产品功能关联(批量)
|
|
@handler AdminUpdateProductFeatures
|
|
put /feature/update/:product_id (AdminUpdateProductFeaturesReq) returns (AdminUpdateProductFeaturesResp)
|
|
}
|
|
|
|
type (
|
|
// 创建产品请求
|
|
AdminCreateProductReq {
|
|
ProductName string `json:"product_name"` // 服务名
|
|
ProductEn string `json:"product_en"` // 英文名
|
|
Description string `json:"description"` // 描述
|
|
Notes string `json:"notes,optional"` // 备注
|
|
CostPrice float64 `json:"cost_price"` // 成本
|
|
SellPrice float64 `json:"sell_price"` // 售价
|
|
}
|
|
|
|
// 创建产品响应
|
|
AdminCreateProductResp {
|
|
Id int64 `json:"id"` // 产品ID
|
|
}
|
|
|
|
// 更新产品请求
|
|
AdminUpdateProductReq {
|
|
Id int64 `path:"id"` // 产品ID
|
|
ProductName *string `json:"product_name,optional"` // 服务名
|
|
ProductEn *string `json:"product_en,optional"` // 英文名
|
|
Description *string `json:"description,optional"` // 描述
|
|
Notes *string `json:"notes,optional"` // 备注
|
|
CostPrice *float64 `json:"cost_price,optional"` // 成本
|
|
SellPrice *float64 `json:"sell_price,optional"` // 售价
|
|
}
|
|
|
|
// 更新产品响应
|
|
AdminUpdateProductResp {
|
|
Success bool `json:"success"` // 是否成功
|
|
}
|
|
|
|
// 删除产品请求
|
|
AdminDeleteProductReq {
|
|
Id int64 `path:"id"` // 产品ID
|
|
}
|
|
|
|
// 删除产品响应
|
|
AdminDeleteProductResp {
|
|
Success bool `json:"success"` // 是否成功
|
|
}
|
|
|
|
// 获取产品列表请求
|
|
AdminGetProductListReq {
|
|
Page int64 `form:"page"` // 页码
|
|
PageSize int64 `form:"pageSize"` // 每页数量
|
|
ProductName *string `form:"product_name,optional"` // 服务名
|
|
ProductEn *string `form:"product_en,optional"` // 英文名
|
|
}
|
|
|
|
// 产品列表项
|
|
ProductListItem {
|
|
Id int64 `json:"id"` // 产品ID
|
|
ProductName string `json:"product_name"` // 服务名
|
|
ProductEn string `json:"product_en"` // 英文名
|
|
Description string `json:"description"` // 描述
|
|
Notes string `json:"notes"` // 备注
|
|
CostPrice float64 `json:"cost_price"` // 成本
|
|
SellPrice float64 `json:"sell_price"` // 售价
|
|
CreateTime string `json:"create_time"` // 创建时间
|
|
UpdateTime string `json:"update_time"` // 更新时间
|
|
}
|
|
|
|
// 获取产品列表响应
|
|
AdminGetProductListResp {
|
|
Total int64 `json:"total"` // 总数
|
|
Items []ProductListItem `json:"items"` // 列表数据
|
|
}
|
|
|
|
// 获取产品详情请求
|
|
AdminGetProductDetailReq {
|
|
Id int64 `path:"id"` // 产品ID
|
|
}
|
|
|
|
// 获取产品详情响应
|
|
AdminGetProductDetailResp {
|
|
Id int64 `json:"id"` // 产品ID
|
|
ProductName string `json:"product_name"` // 服务名
|
|
ProductEn string `json:"product_en"` // 英文名
|
|
Description string `json:"description"` // 描述
|
|
Notes string `json:"notes"` // 备注
|
|
CostPrice float64 `json:"cost_price"` // 成本
|
|
SellPrice float64 `json:"sell_price"` // 售价
|
|
CreateTime string `json:"create_time"` // 创建时间
|
|
UpdateTime string `json:"update_time"` // 更新时间
|
|
}
|
|
|
|
// 获取产品功能列表请求
|
|
AdminGetProductFeatureListReq {
|
|
ProductId int64 `path:"product_id"` // 产品ID
|
|
}
|
|
|
|
// 获取产品功能列表响应Item
|
|
AdminGetProductFeatureListResp {
|
|
Id int64 `json:"id"` // 关联ID
|
|
ProductId int64 `json:"product_id"` // 产品ID
|
|
FeatureId int64 `json:"feature_id"` // 功能ID
|
|
ApiId string `json:"api_id"` // API标识
|
|
Name string `json:"name"` // 功能描述
|
|
Sort int64 `json:"sort"` // 排序
|
|
Enable int64 `json:"enable"` // 是否启用
|
|
IsImportant int64 `json:"is_important"` // 是否重要
|
|
CreateTime string `json:"create_time"` // 创建时间
|
|
UpdateTime string `json:"update_time"` // 更新时间
|
|
}
|
|
|
|
// // 获取产品功能列表响应
|
|
// AdminGetProductFeatureListResp {
|
|
// Items []ProductFeatureListItem `json:"items"` // 列表数据
|
|
// }
|
|
|
|
// 产品功能关联项
|
|
ProductFeatureItem {
|
|
FeatureId int64 `json:"feature_id"` // 功能ID
|
|
Sort int64 `json:"sort"` // 排序
|
|
Enable int64 `json:"enable"` // 是否启用
|
|
IsImportant int64 `json:"is_important"` // 是否重要
|
|
}
|
|
|
|
// 更新产品功能关联请求(批量)
|
|
AdminUpdateProductFeaturesReq {
|
|
ProductId int64 `path:"product_id"` // 产品ID
|
|
Features []ProductFeatureItem `json:"features"` // 功能列表
|
|
}
|
|
|
|
// 更新产品功能关联响应
|
|
AdminUpdateProductFeaturesResp {
|
|
Success bool `json:"success"` // 是否成功
|
|
}
|
|
) |