Update handler.go

This commit is contained in:
徐俊杰 2025-06-14 15:04:51 +08:00
parent 94f01d2ee1
commit e01ea1d9c2

View File

@ -373,6 +373,7 @@ func (cr ChatHandler) Upload(c *gin.Context) {
service.ErrWithCode(c, code)
return
}
fmt.Printf("chatUser is %#v\n", chatUser)
//获取文件对象
file, err := c.FormFile("file")
if err != nil {
@ -427,7 +428,7 @@ func (cr ChatHandler) Upload(c *gin.Context) {
defer tmp.Close()
fileBuffer := bytes.NewBuffer(fileContent)
var bosUrl string
bosUrl, err = upload.UploadWithBuffer(fileBuffer, fmt.Sprintf("%d/%v%v", chatUser.ID, filename, fileExt))
bosUrl, err = upload.UploadWithBuffer(fileBuffer, fmt.Sprintf("fiee/%d/%v%v", chatUser.ID, filename, fileExt))
if err != nil {
service.Error(c, err)
return