mirror of
https://github.com/skyle1995/NetworkAuth.git
synced 2026-05-25 02:24:05 +08:00
修改项目为前后端分离方案
This commit is contained in:
@@ -21,17 +21,6 @@ import (
|
||||
// 创建基础控制器实例
|
||||
var apiBaseController = controllers.NewBaseController()
|
||||
|
||||
// ============================================================================
|
||||
// 页面处理器
|
||||
// ============================================================================
|
||||
|
||||
// APIFragmentHandler 接口列表页面片段处理器
|
||||
func APIFragmentHandler(c *gin.Context) {
|
||||
c.HTML(http.StatusOK, "apis.html", gin.H{
|
||||
"Title": "接口设置",
|
||||
})
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// API处理器
|
||||
// ============================================================================
|
||||
@@ -122,18 +111,12 @@ func APIListHandler(c *gin.Context) {
|
||||
responseAPIs = append(responseAPIs, responseAPI)
|
||||
}
|
||||
|
||||
// 计算分页信息
|
||||
totalPages := (total + int64(limit) - 1) / int64(limit)
|
||||
|
||||
// 返回结果
|
||||
response := gin.H{
|
||||
"success": true,
|
||||
"data": gin.H{
|
||||
"apis": responseAPIs,
|
||||
"total": total,
|
||||
"page": page,
|
||||
"limit": limit,
|
||||
"total_pages": totalPages,
|
||||
},
|
||||
"code": 0,
|
||||
"msg": "success",
|
||||
"count": total,
|
||||
"data": responseAPIs,
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, response)
|
||||
|
||||
Reference in New Issue
Block a user