mirror of
https://github.com/cloudreve/cloudreve.git
synced 2025-11-02 20:14:02 +08:00
Feat: admin dashboard homepage
This commit is contained in:
@ -1,8 +1,10 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/HFO4/cloudreve/pkg/request"
|
||||
"github.com/HFO4/cloudreve/service/admin"
|
||||
"github.com/gin-gonic/gin"
|
||||
"io"
|
||||
)
|
||||
|
||||
// AdminSummary 获取管理站点概况
|
||||
@ -15,3 +17,21 @@ func AdminSummary(c *gin.Context) {
|
||||
c.JSON(200, ErrorResponse(err))
|
||||
}
|
||||
}
|
||||
|
||||
// AdminNews 获取社区新闻
|
||||
func AdminNews(c *gin.Context) {
|
||||
r := request.HTTPClient{}
|
||||
res := r.Request("GET", "https://forum.cloudreve.org/api/discussions?include=startUser%2ClastUser%2CstartPost%2Ctags&filter%5Bq%5D=%20tag%3Anotice&sort=-startTime&", nil)
|
||||
io.Copy(c.Writer, res.Response.Body)
|
||||
}
|
||||
|
||||
// AdminChangeSetting 获取站点设定项
|
||||
func AdminChangeSetting(c *gin.Context) {
|
||||
var service admin.BatchSettingChangeService
|
||||
if err := c.ShouldBindJSON(&service); err == nil {
|
||||
res := service.Change()
|
||||
c.JSON(200, res)
|
||||
} else {
|
||||
c.JSON(200, ErrorResponse(err))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user