57 lines
1.2 KiB
Plaintext
57 lines
1.2 KiB
Plaintext
|
syntax = "v1"
|
||
|
|
||
|
info (
|
||
|
title: "产品服务"
|
||
|
desc: "产品服务"
|
||
|
author: "Liangzai"
|
||
|
email: "2440983361@qq.com"
|
||
|
version: "v1"
|
||
|
)
|
||
|
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"` // 关联功能列表
|
||
|
}
|
||
|
|
||
|
@server (
|
||
|
prefix: api/v1/product
|
||
|
group: product
|
||
|
jwt: JwtAuth
|
||
|
)
|
||
|
service main {
|
||
|
@handler GetProductByID
|
||
|
get /:id (GetProductByIDRequest) returns (ProductResponse)
|
||
|
|
||
|
@handler GetProductByEn
|
||
|
get /en/:product_en (GetProductByEnRequest) returns (ProductResponse)
|
||
|
}
|
||
|
|
||
|
type GetProductByIDRequest {
|
||
|
Id int64 `path:"id"`
|
||
|
}
|
||
|
|
||
|
type GetProductByEnRequest {
|
||
|
ProductEn string `path:"product_en"`
|
||
|
}
|
||
|
|
||
|
type ProductResponse {
|
||
|
Product
|
||
|
}
|
||
|
|
||
|
@server (
|
||
|
prefix: api/v1/product
|
||
|
group: product
|
||
|
)
|
||
|
service main {
|
||
|
@handler GetProductAppByEn
|
||
|
get /app_en/:product_en (GetProductByEnRequest) returns (ProductResponse)
|
||
|
}
|