新增获取接口列表
This commit is contained in:
@@ -16,6 +16,12 @@ type getApiPage struct {
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||
}
|
||||
|
||||
// getApiList 获取接口列表
|
||||
type getApiList struct {
|
||||
APIID string `json:"api_id"` // 主键id
|
||||
APIName string `json:"api_name"` // api名称
|
||||
}
|
||||
|
||||
// 接口详情
|
||||
type getApi struct {
|
||||
APIID string `json:"api_id"` // 主键id
|
||||
@@ -53,6 +59,27 @@ func GetApiPageResponse(adminApi []*model.AdminAPI) []getApiPage {
|
||||
return getApiPageResponses
|
||||
}
|
||||
|
||||
// GetApiListResponse 获取接口列表
|
||||
func GetApiListResponse(adminApi []*model.AdminAPI) []getApiList {
|
||||
// 处理返回值
|
||||
getApiListResponses := make([]getApiList, len(adminApi))
|
||||
|
||||
if len(adminApi) > 0 {
|
||||
for i, v := range adminApi {
|
||||
// 将原始结构体转换为新结构体
|
||||
getApiListResponse := getApiList{
|
||||
APIID: strconv.Itoa(int(v.APIID)),
|
||||
APIName: v.APIName,
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
getApiListResponses[i] = getApiListResponse
|
||||
}
|
||||
}
|
||||
|
||||
return getApiListResponses
|
||||
}
|
||||
|
||||
// GetApiResponse 接口详情
|
||||
func GetApiResponse(adminApi *model.AdminAPI) *getApi {
|
||||
return &getApi{
|
||||
|
||||
Reference in New Issue
Block a user