Skip to content

Commit

Permalink
Merge pull request #43 from suyuan32/fix-error-code
Browse files Browse the repository at this point in the history
Fix error code
  • Loading branch information
suyuan32 authored Nov 13, 2022
2 parents 987b3da + 205dace commit 4bc282a
Show file tree
Hide file tree
Showing 128 changed files with 2,649 additions and 1,290 deletions.
17 changes: 12 additions & 5 deletions api/desc/apis.api
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,24 @@ type (

// The response data of API list | API列表数据
ApiListResp {
// The total number of data | 数据总数
Total uint64 `json:"total"`
BaseDataInfo

// API list data | API 列表数据
Data ApiListInfo `json:"data"`
}

// API list data | API 列表数据
ApiListInfo {
BaseListInfo

// The API list data | API列表数据
// in: body
Data []ApiInfo `json:"data"`
}

// Get API list request params | API列表请求参数
ApiListReq {
PageInfo

// API path | API路径
// Max length: 100
Path string `json:"path,optional" validate:"omitempty,max=100"`
Expand Down Expand Up @@ -101,11 +108,11 @@ type (
service core {
// Create or update API information | 创建或更新API
@handler createOrUpdateApi
post /api (CreateOrUpdateApiReq) returns (SimpleMsg)
post /api (CreateOrUpdateApiReq) returns (BaseMsgResp)

// Delete API information | 删除API信息
@handler deleteApi
delete /api (IDReq) returns (SimpleMsg)
delete /api (IDReq) returns (BaseMsgResp)

// Get API list | 获取API列表
@handler getApiList
Expand Down
27 changes: 16 additions & 11 deletions api/desc/authority.api
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@ type (
Data []ApiAuthorityInfo `json:"data"`
}

// The response data of api authorization list | API授权列表数据
// The response data of api authorization list | API授权列表返回数据
ApiAuthorityListResp {
// The total number of data | 数据总数
Total uint64 `json:"total"`
BaseDataInfo

// The api authorization list data | API授权列表数据
Data ApiAuthorityListInfo `json:"data"`
}

// The data of api authorization list | API授权列表数据
ApiAuthorityListInfo {
BaseListInfo

// The api authorization list data | API授权列表数据
// in: body
Data []ApiAuthorityInfo `json:"data"`
}

Expand All @@ -55,13 +61,12 @@ type (
MenuIds []uint64 `json:"menuIds"`
}

// Create or update menu authorization information request params | 创建或更新菜单授权信息参数
// Menu authorization response data | 菜单授权信息数据
MenuAuthorityInfoResp {
// role ID | 角色ID
RoleId uint64 `json:"roleId"`
BaseDataInfo

// menu ID array | 菜单ID数组
MenuIds []uint64 `json:"menuIds"`
// The menu authorization data | 菜单授权信息数据
Data MenuAuthorityInfoReq `json:"data"`
}
)

Expand All @@ -74,15 +79,15 @@ type (
service core {
// Create or update API authorization information | 创建或更新API权限
@handler createOrUpdateApiAuthority
post /authority/api (CreateOrUpdateApiAuthorityReq) returns (SimpleMsg)
post /authority/api (CreateOrUpdateApiAuthorityReq) returns (BaseMsgResp)

// Get role's API authorization list | 获取角色api权限列表
@handler getApiAuthority
post /authority/api/role (IDReq) returns (ApiAuthorityListResp)

// Create or update menu authorization information | 创建或更新菜单权限
@handler createOrUpdateMenuAuthority
post /authority/menu (MenuAuthorityInfoReq) returns (SimpleMsg)
post /authority/menu (MenuAuthorityInfoReq) returns (BaseMsgResp)

// Get role's menu authorization list | 获取角色菜单权限列表
@handler getMenuAuthority
Expand Down
28 changes: 22 additions & 6 deletions api/desc/base.api
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,32 @@ info(
)

// The basic response with data | 基础带数据信息
// swagger:response BaseMsg
type BaseMsg {
Code int32 `json:"code"`
type BaseDataInfo {
// Error code | 错误代码
Code int `json:"code"`

// Message | 提示信息
Msg string `json:"msg"`
Data string `json:"data"`

// Data | 数据
Data string `json:"data,omitempty"`
}

// The basic response with data | 基础带数据信息
type BaseListInfo {
// The total number of data | 数据总数
Total uint64 `json:"total"`

// Data | 数据
Data string `json:"data,omitempty"`
}

// The basic response without data | 基础不带数据信息
type BaseResp {
Code int32 `json:"code"`
type BaseMsgResp {
// Error code | 错误代码
Code int `json:"code"`

// Message | 提示信息
Msg string `json:"msg"`
}

Expand Down
12 changes: 10 additions & 2 deletions api/desc/captcha.api
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,26 @@ info(

import "base.api"

// The response data of captcha | 验证码返回数据
// The information of captcha | 验证码数据
type CaptchaInfo {
CaptchaId string `json:"captchaId"`
ImgPath string `json:"imgPath"`
}

// The response data of captcha | 验证码返回数据
type CaptchaResp {
BaseDataInfo

// The menu authorization data | 菜单授权信息数据
Data CaptchaInfo `json:"data"`
}

@server(
group: captcha
)

service core {
// Get captcha | 获取验证码
@handler getCaptcha
get /captcha returns (CaptchaInfo)
get /captcha returns (CaptchaResp)
}
2 changes: 1 addition & 1 deletion api/desc/core.api
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ service core {

// Initialize database | 初始化数据库
@handler initDatabase
get /core/init/database returns (SimpleMsg)
get /core/init/database returns (BaseMsgResp)
}
32 changes: 22 additions & 10 deletions api/desc/dictionary.api
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,17 @@ type (

// The response data of dictionary list | 字典列表数据
DictionaryListResp {
// The total number of data | 数据总数
Total uint64 `json:"total"`
BaseDataInfo

// The dictionary list data | 字典列表数据
Data DictionaryListInfo `json:"data"`
}

// The response data of dictionary list | 字典列表数据
DictionaryListInfo {
BaseListInfo

// The dictionary list data | 字典列表数据
// in: body
Data []DictionaryInfo `json:"data"`
}

Expand Down Expand Up @@ -98,11 +104,17 @@ type (

// The response data of dictionary KV list | 字典值的列表数据
DictionaryDetailListResp {
// The total number of data | 数据总数
Total uint64 `json:"total"`
BaseDataInfo

// The dictionary list data | 字典列表数据
Data DictionaryDetailListInfo `json:"data"`
}

// The data of dictionary KV list | 字典值的列表数据
DictionaryDetailListInfo {
BaseListInfo

// The dictionary list data | 字典列表数据
// in: body
Data []DictionaryDetailInfo `json:"data"`
}

Expand Down Expand Up @@ -153,23 +165,23 @@ type (
service core {
// Create or update dictionary information | 创建或更新字典信息
@handler createOrUpdateDictionary
post /dict (CreateOrUpdateDictionaryReq) returns (SimpleMsg)
post /dict (CreateOrUpdateDictionaryReq) returns (BaseMsgResp)

// Delete dictionary information | 删除字典信息
@handler deleteDictionary
delete /dict (IDReq) returns (SimpleMsg)
delete /dict (IDReq) returns (BaseMsgResp)

// Get dictionary list | 获取字典列表
@handler getDictionaryList
post /dict/list (DictionaryListReq) returns (DictionaryListResp)

// Create or update dictionary KV information | 创建或更新字典键值信息
@handler createOrUpdateDictionaryDetail
post /dict/detail (CreateOrUpdateDictionaryDetailReq) returns (SimpleMsg)
post /dict/detail (CreateOrUpdateDictionaryDetailReq) returns (BaseMsgResp)

// Delete dictionary KV information | 删除字典键值信息
@handler deleteDictionaryDetail
delete /dict/detail (IDReq) returns (SimpleMsg)
delete /dict/detail (IDReq) returns (BaseMsgResp)

// Get dictionary detail list by dictionary name | 根据字典名获取字典键值列表
@handler getDetailByDictionaryName
Expand Down
67 changes: 52 additions & 15 deletions api/desc/menu.api
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type (
}

// The meta data of menu | 菜单的meta数据
// swagger:response Meta
// swagger:model Meta
Meta {
// Menu title show in page | 菜单显示名
// Max length: 50
Expand Down Expand Up @@ -100,20 +100,27 @@ type (
RealPath string `json:"realPath,omitempty" validate:"max=200"`
}

// The response data of menu list | 菜单列表数据
// The response data of menu list | 菜单列表返回数据
MenuListResp {
// The total number of data | 数据总数
Total uint64 `json:"total"`
BaseDataInfo

// The menu list data | 菜单列表数据
Data MenuListInfo `json:"data"`
}

// The data of menu list | 菜单列表数据
MenuListInfo {
BaseListInfo

// The menu list data | 菜单列表数据
// in: body
Data []*MenuInfo `json:"data"`
}

// The response data of role menu list, show after user login | 角色菜单列表数据, 登录后自动获取
// The response data of role menu list data | 角色菜单列表数据
GetMenuListBase {
// Menu type: directory or menu | 菜单类型: 目录或菜单
menuType uint32 `json:"type"`

// Parent menu ID | 父级菜单ID
ParentId uint64 `json:"parentId"`

Expand Down Expand Up @@ -146,6 +153,22 @@ type (
Children []*GetMenuListBase `json:"children"`
}

// The response data of role menu list, show after user login | 角色菜单列表数据, 登录后自动获取
GetMenuListBaseResp {
BaseDataInfo

// The data of role menu list data | 角色菜单列表数据
Data GetMenuListBaseInfo `json:"data"`
}

// The data of role menu list, show after user login | 角色菜单列表数据
GetMenuListBaseInfo {
BaseListInfo

// The response data of role menu list data | 角色菜单列表数据
Data []*GetMenuListBase `json:"data"`
}

// Create or update menu information request params | 创建或更新菜单信息参数
CreateOrUpdateMenuReq {
// ID
Expand Down Expand Up @@ -226,8 +249,16 @@ type (
Value string `json:"value" validate:"min=1,max=100"`
}

// The response data of menu parameters | 菜单参数列表数据
// The response data of menu parameters | 菜单参数返回数据
MenuParamResp {
BaseDataInfo

// The information of menu parameter | 菜单参数数据
Data MenuParamInfo `json:"data"`
}

// The information of menu parameter | 菜单参数数据
MenuParamInfo {
BaseInfo

// Data Type | 数据类型
Expand All @@ -242,12 +273,18 @@ type (

// The response data of menu parameters list which belong to some menu | 某个菜单的菜单参数列表数据
MenuParamListByMenuIdResp {
// The total number of data | 数据总数
Total uint64 `json:"total"`
BaseDataInfo

// The menu list data | 菜单列表数据
// in: body
Data []MenuParamResp `json:"data"`
Data MenuParamListByMenuIdInfo `json:"data"`
}

// The response data of menu parameters list which belong to some menu | 某个菜单的菜单参数列表数据
MenuParamListByMenuIdInfo {
BaseListInfo

// The menu list data | 菜单列表数据
Data []MenuParamInfo `json:"data"`
}
)

Expand All @@ -260,11 +297,11 @@ type (
service core {
// Create or update menu information | 创建或更新菜单
@handler createOrUpdateMenu
post /menu (CreateOrUpdateMenuReq) returns (SimpleMsg)
post /menu (CreateOrUpdateMenuReq) returns (BaseMsgResp)

// Delete menu information | 删除菜单信息
@handler deleteMenu
delete /menu (IDReq) returns (SimpleMsg)
delete /menu (IDReq) returns (BaseMsgResp)

// Get menu list | 获取菜单列表
@handler getMenuList
Expand All @@ -276,13 +313,13 @@ service core {

// Create or update menu parameters | 创建或更新菜单参数
@handler createOrUpdateMenuParam
post /menu/param (CreateOrUpdateMenuParamReq) returns (SimpleMsg)
post /menu/param (CreateOrUpdateMenuParamReq) returns (BaseMsgResp)

// Get menu extra parameters by menu ID | 获取某个菜单的额外参数列表
@handler getMenuParamListByMenuId
post /menu/param/list (IDReq) returns (MenuParamListByMenuIdResp)

// Delete menu extra parameters | 删除菜单额外参数
@handler deleteMenuParam
delete /menu/param (IDReq) returns (SimpleMsg)
delete /menu/param (IDReq) returns (BaseMsgResp)
}
Loading

0 comments on commit 4bc282a

Please sign in to comment.