From db726b078ee12b2b452fe0ae06a0aeefd00f2be8 Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Fri, 30 Aug 2024 15:13:23 +0800 Subject: [PATCH] upload type --- handler/tool.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/handler/tool.go b/handler/tool.go index 505c3d2..c98bc2f 100644 --- a/handler/tool.go +++ b/handler/tool.go @@ -1,7 +1,6 @@ package handler import ( - "fmt" "github.com/gin-gonic/gin" "net/http" "videoplayer/dao" @@ -31,12 +30,11 @@ func UploadFile(c *gin.Context) { id, _ := c.Get("id") id1 := int(id.(float64)) //从请求头获取upload_type - uploadType := c.Request.Header.Get("upload_type") - fmt.Println("header:", c.Request.Header) - //if uploadType == "" { - // c.JSON(http.StatusOK, gin.H{"error": "upload_type is empty", "code": proto.ParameterError, "message": "failed"}) - // return - //} + uploadType := c.PostForm("upload_type") + if uploadType == "" { + c.JSON(http.StatusOK, gin.H{"error": "upload_type is empty", "code": proto.ParameterError, "message": "failed"}) + return + } user := dao.FindUserByUserID(id1) if user.Upload == false {