微信相关接口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
981 B

package wechat
import (
"fmt"
)
//发送订阅消息返回结果
type SendSubscribeMessageData struct {
Errcode int `json:"errcode"`
Errmsg string `json:"errmsg"`
}
//发送统一消息返回结果
type SendUniformMessageData struct {
Errcode int `json:"errcode"`
Errmsg string `json:"errmsg"`
}
func SendSubscribeMessage(access_token string, message []byte) (SendSubscribeMessageData, error) {
url := fmt.Sprintf(MINIAPP_SUBSCRIBE_MESSAGE_SEND_API, access_token)
ret, err := PostJson(url, message)
var data SendSubscribeMessageData
if err != nil {
return data, err
}
err = json.Unmarshal(ret, &data)
return data, err
}
func SendUniformMessage(access_token string, message []byte) (SendUniformMessageData, error) {
url := fmt.Sprintf(MINIAPP_UNIFORM_MESSAGE_API, access_token)
ret, err := PostJson(url, message)
var data SendUniformMessageData
if err != nil {
return data, err
}
err = json.Unmarshal(ret, &data)
return data, err
}