Browse Source

更新

master
huangjiajun 1 year ago
parent
commit
33a8b7e273
2 changed files with 6 additions and 5 deletions
  1. +5
    -4
      app/hdl/hdl_img_upload.go
  2. +1
    -1
      app/svc/svc_wechat.go

+ 5
- 4
app/hdl/hdl_img_upload.go View File

@@ -26,11 +26,12 @@ func ImgUpload(c *gin.Context) {
e.OutErr(c, 400, err.Error())
return
}
uri := "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token" + token + "&type=image"
postFile, err := utils.PostFile("media", res["fileName"], uri)
fmt.Println(postFile)
fmt.Println(token)
uri := "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=" + token + "&type=image"
postFile, err := utils.PostFile("media", fileStr, uri)
fmt.Println(string(postFile))
fmt.Println(err)
res["media_id"] = gjson.Get(string(postFile), "media_id").String()
res["mediaId"] = gjson.Get(string(postFile), "media_id").String()
e.OutSuc(c, res, nil)
return
}

+ 1
- 1
app/svc/svc_wechat.go View File

@@ -132,7 +132,7 @@ func GetWechatToken() (string, error) {
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
res := sysCfgDb.SysCfgFindWithDb(enum.WxOfficialAccountAppId, enum.WxOfficialAccountAppSecret)
key := "wechat_token"
key := "wechat_token1"
redisStr, err := cache.GetString(key)
token := redisStr
if redisStr == "" || err != nil {


Loading…
Cancel
Save