This commit is contained in:
xxj
2022-12-20 21:37:59 +08:00
parent 17a0e73df1
commit ae374975de
2 changed files with 6 additions and 2 deletions

View File

@@ -15,7 +15,6 @@ import (
"github.com/usthooz/gutil"
"github.com/xxjwxc/public/message"
"github.com/xxjwxc/public/mycache"
"github.com/xxjwxc/public/myglobal"
"github.com/xxjwxc/public/myhttp"
"github.com/xxjwxc/public/mylog"
"github.com/xxjwxc/public/tools"
@@ -358,6 +357,7 @@ func (_wx *wxTools) GetFreepublish(max int64) (out []FreepublishiInfo, err error
for {
bo, _ := json.Marshal(req)
resb, _ := myhttp.OnPostJSON(_sendFreepublish+accessToken, string(bo))
fmt.Println(string(resb))
var res FreepublishiInfoResp
json.Unmarshal(resb, &res)
if res.ItemCount == 0 {
@@ -404,7 +404,7 @@ func (_wx *wxTools) GetMaterial(mediaId string) (string, error) {
var res MediaResp
err = json.Unmarshal(resb, &res)
if err != nil {
id := fmt.Sprintf("/file/img/%v.jpg", myglobal.GetNode().GetID())
id := fmt.Sprintf("/file/img/%v.jpg", mediaId)
fileName := path.Join(tools.GetCurrentDirectory(), id)
tools.WriteFileEx(fileName, resb, true)
return id, nil

View File

@@ -127,6 +127,10 @@ type CustomMsg struct {
Text *CustomText `json:"text,omitempty"` // 文本类容
Voice *CustomVoice `json:"voice,omitempty"` // 语音
Music *CustomMusic `json:"music,omitempty"` // 音乐消息
Image *CustomImage `json:"image,omitempty"` // 图片消息
}
type CustomImage struct {
MediaId string `json:"media_id"` // 图片
}
type CustomText struct {