2025-01-10 00:09:25 +08:00
|
|
|
syntax = "v1"
|
|
|
|
|
|
|
|
info (
|
2025-03-17 15:59:09 +08:00
|
|
|
title: "产品服务"
|
|
|
|
desc: "产品服务"
|
|
|
|
author: "Liangzai"
|
|
|
|
email: "2440983361@qq.com"
|
|
|
|
version: "v1"
|
2025-01-10 00:09:25 +08:00
|
|
|
)
|
2025-03-17 15:59:09 +08:00
|
|
|
type Feature {
|
|
|
|
ID int64 `json:"id"` // 功能ID
|
|
|
|
ApiID string `json:"api_id"` // API标识
|
|
|
|
Name string `json:"name"` // 功能描述
|
|
|
|
}
|
|
|
|
// 产品基本类型定义
|
|
|
|
type Product {
|
|
|
|
ProductName string `json:"product_name"`
|
|
|
|
ProductEn string `json:"product_en"`
|
|
|
|
Description string `json:"description"`
|
|
|
|
Notes string `json:"notes,optional"`
|
|
|
|
SellPrice float64 `json:"sell_price"`
|
|
|
|
Features []Feature `json:"features"` // 关联功能列表
|
|
|
|
}
|
|
|
|
|
2025-01-10 00:09:25 +08:00
|
|
|
@server (
|
2025-03-17 15:59:09 +08:00
|
|
|
prefix: api/v1/product
|
|
|
|
group: product
|
|
|
|
jwt: JwtAuth
|
2025-01-10 00:09:25 +08:00
|
|
|
)
|
|
|
|
service main {
|
2025-03-17 15:59:09 +08:00
|
|
|
@handler GetProductByID
|
|
|
|
get /:id (GetProductByIDRequest) returns (ProductResponse)
|
|
|
|
|
|
|
|
@handler GetProductByEn
|
|
|
|
get /en/:product_en (GetProductByEnRequest) returns (ProductResponse)
|
|
|
|
}
|
2025-01-10 00:09:25 +08:00
|
|
|
|
2025-03-17 15:59:09 +08:00
|
|
|
type GetProductByIDRequest {
|
|
|
|
Id int64 `path:"id"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type GetProductByEnRequest {
|
|
|
|
ProductEn string `path:"product_en"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type ProductResponse {
|
|
|
|
Product
|
2025-01-10 00:09:25 +08:00
|
|
|
}
|
|
|
|
|
2025-03-14 02:56:27 +08:00
|
|
|
@server (
|
2025-03-17 15:59:09 +08:00
|
|
|
prefix: api/v1/product
|
|
|
|
group: product
|
2025-03-14 02:56:27 +08:00
|
|
|
)
|
|
|
|
service main {
|
2025-03-17 15:59:09 +08:00
|
|
|
@handler GetProductAppByEn
|
|
|
|
get /app_en/:product_en (GetProductByEnRequest) returns (ProductResponse)
|
|
|
|
}
|