diff --git a/app/hdl/hdl_img_upload.go b/app/hdl/hdl_img_upload.go index e7b0be3..f15bfaf 100644 --- a/app/hdl/hdl_img_upload.go +++ b/app/hdl/hdl_img_upload.go @@ -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 } diff --git a/app/svc/svc_wechat.go b/app/svc/svc_wechat.go index 261b995..d267bd1 100644 --- a/app/svc/svc_wechat.go +++ b/app/svc/svc_wechat.go @@ -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 {