feat: 完善上传接口。
This commit is contained in:
parent
74a043a5c9
commit
bb8483ebbb
@ -37,6 +37,11 @@ func UploadFile(c *gin.Context) {
|
|||||||
tag, _ = c.GetPostForm("type")
|
tag, _ = c.GetPostForm("type")
|
||||||
fileType = c.DefaultQuery("file_type", "images")
|
fileType = c.DefaultQuery("file_type", "images")
|
||||||
|
|
||||||
|
if fileType != "images" && fileType != "files" {
|
||||||
|
app.Error(c, -1, fmt.Errorf("上传接口目前,仅支持图片上传和文件上传"), "")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if viper.GetBool("settings.domain.getHost") {
|
if viper.GetBool("settings.domain.getHost") {
|
||||||
urlPrefix = fmt.Sprintf("http://%s/", c.Request.Host)
|
urlPrefix = fmt.Sprintf("http://%s/", c.Request.Host)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user