108 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
		
		
			
		
	
	
			108 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
|  | syntax = "v1" | ||
|  | 
 | ||
|  | info ( | ||
|  | 	title:   "后台功能管理服务" | ||
|  | 	desc:    "后台功能管理相关接口" | ||
|  | 	author:  "Liangzai" | ||
|  | 	email:   "2440983361@qq.com" | ||
|  | 	version: "v1" | ||
|  | ) | ||
|  | 
 | ||
|  | // 功能管理接口 | ||
|  | @server( | ||
|  | 	prefix: /api/v1/admin/feature | ||
|  | 	group: admin_feature | ||
|  | ) | ||
|  | 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) | ||
|  | } | ||
|  | 
 | ||
|  | type ( | ||
|  | 	// 创建功能请求 | ||
|  | 	AdminCreateFeatureReq { | ||
|  | 		ApiId string `json:"api_id"` // API标识 | ||
|  | 		Name  string `json:"name"`   // 描述 | ||
|  | 	} | ||
|  | 
 | ||
|  | 	// 创建功能响应 | ||
|  | 	AdminCreateFeatureResp { | ||
|  | 		Id int64 `json:"id"` // 功能ID | ||
|  | 	} | ||
|  | 
 | ||
|  | 	// 更新功能请求 | ||
|  | 	AdminUpdateFeatureReq { | ||
|  | 		Id    int64   `path:"id"`              // 功能ID | ||
|  | 		ApiId *string `json:"api_id,optional"` // API标识 | ||
|  | 		Name  *string `json:"name,optional"`   // 描述 | ||
|  | 	} | ||
|  | 
 | ||
|  | 	// 更新功能响应 | ||
|  | 	AdminUpdateFeatureResp { | ||
|  | 		Success bool `json:"success"` // 是否成功 | ||
|  | 	} | ||
|  | 
 | ||
|  | 	// 删除功能请求 | ||
|  | 	AdminDeleteFeatureReq { | ||
|  | 		Id int64 `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         int64  `json:"id"`          // 功能ID | ||
|  | 		ApiId      string `json:"api_id"`      // API标识 | ||
|  | 		Name       string `json:"name"`        // 描述 | ||
|  | 		CreateTime string `json:"create_time"` // 创建时间 | ||
|  | 		UpdateTime string `json:"update_time"` // 更新时间 | ||
|  | 	} | ||
|  | 
 | ||
|  | 	// 获取功能列表响应 | ||
|  | 	AdminGetFeatureListResp { | ||
|  | 		Total int64             `json:"total"` // 总数 | ||
|  | 		Items []FeatureListItem `json:"items"` // 列表数据 | ||
|  | 	} | ||
|  | 
 | ||
|  | 	// 获取功能详情请求 | ||
|  | 	AdminGetFeatureDetailReq { | ||
|  | 		Id int64 `path:"id"` // 功能ID | ||
|  | 	} | ||
|  | 
 | ||
|  | 	// 获取功能详情响应 | ||
|  | 	AdminGetFeatureDetailResp { | ||
|  | 		Id         int64  `json:"id"`          // 功能ID | ||
|  | 		ApiId      string `json:"api_id"`      // API标识 | ||
|  | 		Name       string `json:"name"`        // 描述 | ||
|  | 		CreateTime string `json:"create_time"` // 创建时间 | ||
|  | 		UpdateTime string `json:"update_time"` // 更新时间 | ||
|  | 	} | ||
|  | ) |