mirror of
https://github.com/xxjwxc/public.git
synced 2025-09-26 20:01:19 +08:00
1
This commit is contained in:
@@ -15,16 +15,17 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
_getTicket = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=wx_card&access_token="
|
||||
_getJsurl = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token="
|
||||
_getToken = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="
|
||||
_getSubscribe = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token="
|
||||
_getTempMsg = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="
|
||||
_createMenu = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token="
|
||||
_deleteMenu = "https://api.weixin.qq.com/cgi-bin/menu/delete?access_token="
|
||||
_sendCustom = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token="
|
||||
_cacheToken = "wx_access_token"
|
||||
_cacheTicket = "weixin_card_ticket"
|
||||
_getTicket = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=wx_card&access_token="
|
||||
_getJsurl = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token="
|
||||
_getToken = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="
|
||||
_getSubscribe = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token="
|
||||
_getTempMsg = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="
|
||||
_createMenu = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token="
|
||||
_deleteMenu = "https://api.weixin.qq.com/cgi-bin/menu/delete?access_token="
|
||||
_sendCustom = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token="
|
||||
_setGuideConfig = "https://api.weixin.qq.com/cgi-bin/guide/setguideconfig?access_token="
|
||||
_cacheToken = "wx_access_token"
|
||||
_cacheTicket = "weixin_card_ticket"
|
||||
)
|
||||
|
||||
// GetAccessToken 获取微信accesstoken
|
||||
@@ -257,3 +258,22 @@ func (_wx *wxTools) SendCustomMsg(msg CustomMsg) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetGuideConfig 快捷回复与关注自动回复
|
||||
func (_wx *wxTools) SetGuideConfig(guideConfig GuideConfig) error {
|
||||
accessToken, err := _wx.GetAccessToken()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
bo, _ := json.Marshal(guideConfig)
|
||||
resb, _ := myhttp.OnPostJSON(_setGuideConfig+accessToken, string(bo))
|
||||
|
||||
var res ResTempMsg
|
||||
json.Unmarshal(resb, &res)
|
||||
b := res.Errcode == 0
|
||||
if !b {
|
||||
return fmt.Errorf("SetGuideConfig error: res:%v", res)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@@ -144,3 +144,21 @@ type CustomMusic struct {
|
||||
HQMusicUrl string `json:"hqmusicurl"` // 链接
|
||||
ThumbMediaId string `json:"thumb_media_id"` // 缩略图
|
||||
}
|
||||
|
||||
type GuideConfig struct {
|
||||
GuideAccount string `json:"guide_account"` // 顾问号
|
||||
IsDelete bool `json:"is_delete"` // 操作类型,false表示添加 true表示删除
|
||||
GuideFastReplyList []GuideFastReplyList `json:"guide_fast_reply_list"` // 快捷回复列表
|
||||
GuideAutoReply GuideAutoReply `json:"guide_auto_reply"` // 第一条新客户关注自动回复
|
||||
GuideAutoReplyPlus GuideAutoReply `json:"guide_auto_reply_plus"` // 第二条新客户关注自动回复
|
||||
}
|
||||
|
||||
// GuideFastReplyList 快捷回复列表
|
||||
type GuideFastReplyList struct {
|
||||
Content string `json:"content"` // 快捷回复
|
||||
}
|
||||
|
||||
type GuideAutoReply struct {
|
||||
Content string `json:"content"` // 新客户关注自动回复内容,图片填mediaid,获取方式同图片素材,小程序卡片填下面请求demo中字段的json格式
|
||||
Msgtype int `json:"msgtype"` // 1表示文字,2表示图片,3表示小程序卡片
|
||||
}
|
||||
|
@@ -40,6 +40,7 @@ type WxTools interface {
|
||||
SendWebTemplateMsg(msg TempWebMsg) error // 发送公众号模板消息
|
||||
CreateMenu(menu WxMenu) error // 创建自定义菜单
|
||||
DeleteMenu() error // 删除自定义菜单
|
||||
SetGuideConfig(guideConfig GuideConfig) error // 快捷回复与关注自动回复
|
||||
|
||||
SendCustomMsg(msg CustomMsg) error // 发送客服消息
|
||||
// ----------------------------------------------------
|
||||
|
Reference in New Issue
Block a user