胡轶钦 6 年之前
父節點
當前提交
82d4b30770
共有 2 個檔案被更改,包括 1 行新增10 行删除
  1. 0
    8
      controllers/file.go
  2. 1
    2
      controllers/wechatimg/wechatimt.go

+ 0
- 8
controllers/file.go 查看文件

22
 	})
22
 	})
23
 }
23
 }
24
 
24
 
25
-func (c *BaseController) FileUploadForMatrial() (string, error) {
26
-	file, err := c.uploadFileToOSS("media")
27
-	if err != nil {
28
-		return "", err
29
-	}
30
-	return file, nil
31
-}
32
-
33
 func (c *BaseController) uploadFileToOSS(field string) (string, error) {
25
 func (c *BaseController) uploadFileToOSS(field string) (string, error) {
34
 	aliConf, ok := c.Configer[AliYunConf]
26
 	aliConf, ok := c.Configer[AliYunConf]
35
 	if !ok {
27
 	if !ok {

+ 1
- 2
controllers/wechatimg/wechatimt.go 查看文件

155
 		fmt.Println("文件保存失败")
155
 		fmt.Println("文件保存失败")
156
 		return
156
 		return
157
 	}
157
 	}
158
-	url, err := c.BaseController.FileUploadForMatrial()
159
 	if err != nil {
158
 	if err != nil {
160
 		c.ResponseError(err)
159
 		c.ResponseError(err)
161
 	}
160
 	}
184
 	}
183
 	}
185
 	c.ResponseJSON(map[string]interface{}{
184
 	c.ResponseJSON(map[string]interface{}{
186
 		"media_id": img.MediaId,
185
 		"media_id": img.MediaId,
187
-		"url":      url,
186
+		"url":      img.Url,
188
 	})
187
 	})
189
 
188
 
190
 }
189
 }