From 33a8b7e27351ef880998f9d4c0b4de17e2a35056 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 15 Aug 2023 09:17:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/hdl/hdl_img_upload.go | 9 +++++---- app/svc/svc_wechat.go | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) 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 {