✨ 添加了office接口
This commit is contained in:
22
server/controllers/offie_preview.go
Normal file
22
server/controllers/offie_preview.go
Normal file
@ -0,0 +1,22 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/Xhofe/alist/alidrive"
|
||||
"github.com/gin-gonic/gin"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func OfficePreview(c *gin.Context) {
|
||||
var req alidrive.OfficePreviewUrlReq
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
c.JSON(200, MetaResponse(400,"Bad Request"))
|
||||
return
|
||||
}
|
||||
log.Debugf("preview_req:%+v",req)
|
||||
preview,err:=alidrive.GetOfficePreviewUrl(req.FileId)
|
||||
if err!=nil {
|
||||
c.JSON(200, MetaResponse(500,err.Error()))
|
||||
return
|
||||
}
|
||||
c.JSON(200, DataResponse(preview))
|
||||
}
|
@ -25,6 +25,7 @@ func InitApiRouter(engine *gin.Engine) {
|
||||
v2.POST("/get",controllers.Get)
|
||||
v2.POST("/list",controllers.List)
|
||||
v2.POST("/search",controllers.Search)
|
||||
v2.POST("/office_preview",controllers.OfficePreview)
|
||||
}
|
||||
engine.GET("/d/*file_id",controllers.Down)
|
||||
engine.GET("/cache/:password",controllers.RefreshCache)
|
||||
|
Reference in New Issue
Block a user