Feat: upyun callback & authentication

This commit is contained in:
HFO4
2020-01-18 10:40:03 +08:00
parent 21ec3fc710
commit 5befbc21d0
9 changed files with 138 additions and 16 deletions

View File

@@ -2,6 +2,7 @@ package controllers
import (
"github.com/HFO4/cloudreve/pkg/serializer"
"github.com/HFO4/cloudreve/pkg/util"
"github.com/HFO4/cloudreve/service/callback"
"github.com/gin-gonic/gin"
)
@@ -45,3 +46,22 @@ func OSSCallback(c *gin.Context) {
c.JSON(200, ErrorResponse(err))
}
}
// UpyunCallback 又拍云上传回调
func UpyunCallback(c *gin.Context) {
var callbackBody callback.UpyunCallbackService
if err := c.ShouldBind(&callbackBody); err == nil {
if callbackBody.Code != 200 {
util.Log().Debug(
"又拍云回调返回错误代码%d信息%s",
callbackBody.Code,
callbackBody.Message,
)
return
}
res := callback.ProcessCallback(callbackBody, c)
c.JSON(200, res)
} else {
c.JSON(200, ErrorResponse(err))
}
}