新增获取接口列表
This commit is contained in:
@@ -55,6 +55,43 @@ func (r *AdminApi) GetApiPage(c *gin.Context) {
|
||||
responses.OkWithData(result, c)
|
||||
}
|
||||
|
||||
// GetApiList 获取api列表
|
||||
func (r *AdminApi) GetApiList(c *gin.Context) {
|
||||
apiRequest := requests.ApiRequest{}
|
||||
if err := c.ShouldBind(&apiRequest.GetApiList); err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 参数验证
|
||||
if err := global.Validate.Struct(apiRequest.GetApiList); err != nil {
|
||||
responses.FailWithMessage(utils.Translate(err), c)
|
||||
return
|
||||
}
|
||||
|
||||
adminApiDao := dao.AdminApiDao{}
|
||||
|
||||
maps := make(map[string]interface{})
|
||||
if apiRequest.GetApiList.ApiName != "" {
|
||||
maps["api_name"] = apiRequest.GetApiList.ApiName
|
||||
}
|
||||
adminApis, err := adminApiDao.GetAdminApiList(maps)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
if len(adminApis) == 0 {
|
||||
responses.Ok(c)
|
||||
return
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
getApiPageResponses := apiResponse.GetApiListResponse(adminApis)
|
||||
|
||||
responses.OkWithData(getApiPageResponses, c)
|
||||
}
|
||||
|
||||
// AddApi 新增接口
|
||||
func (r *AdminApi) AddApi(c *gin.Context) {
|
||||
apiRequest := requests.ApiRequest{}
|
||||
|
||||
Reference in New Issue
Block a user