@@ -25,76 +25,76 @@ func (s *Server) SendMsg(v interface{}) *WxErr {
25
25
if err != nil {
26
26
return & WxErr {- 1 , err .Error ()}
27
27
}
28
- Printf ("发送消息:%+v\n 回执 :%+v" , v , * rst )
28
+ Printf ("[*] 发送消息:%+v\n [*] 回执 :%+v" , v , * rst )
29
29
return rst
30
30
}
31
31
32
32
// SendText 发送客服text消息,过长时按500长度自动拆分
33
- func (s * Server ) SendText (to string , agentId int , msg string , safe ... int ) (e * WxErr ) {
34
- if len (safe ) > 0 && safe [0 ] == 1 {
35
- s .SafeOpen ()
36
- defer s .SafeClose ()
37
- }
38
- // m := strings.Join(msg, "")
33
+ func (s * Server ) SendText (to , msg string ) (e * WxErr ) {
39
34
leng := utf8 .RuneCountInString (msg )
40
35
n := leng / 500 + 1
41
36
42
37
if n == 1 {
43
- return s .SendMsg (s .NewText (to , agentId , msg ))
38
+ return s .SendMsg (s .NewText (to , msg ))
44
39
}
45
40
for i := 0 ; i < n ; i ++ {
46
- e = s .SendMsg (s .NewText (to , agentId , fmt .Sprintf ("%s\n (%v/%v)" , util .Substr (msg , i * 500 , (i + 1 )* 500 ), i + 1 , n )))
41
+ e = s .SendMsg (s .NewText (to , fmt .Sprintf ("%s\n (%v/%v)" , util .Substr (msg , i * 500 , (i + 1 )* 500 ), i + 1 , n )))
47
42
}
48
43
49
44
return
50
45
}
51
46
52
47
// SendImage 发送客服Image消息
53
- func (s * Server ) SendImage (to string , id int , mediaId string ) * WxErr {
54
- return s .SendMsg (s .NewImage (to , id , mediaId ))
48
+ func (s * Server ) SendImage (to string , mediaId string ) * WxErr {
49
+ return s .SendMsg (s .NewImage (to , mediaId ))
55
50
}
56
51
57
52
// SendVoice 发送客服Voice消息
58
- func (s * Server ) SendVoice (to string , id int , mediaId string ) * WxErr {
59
- return s .SendMsg (s .NewVoice (to , id , mediaId ))
53
+ func (s * Server ) SendVoice (to string , mediaId string ) * WxErr {
54
+ return s .SendMsg (s .NewVoice (to , mediaId ))
60
55
}
61
56
62
57
// SendFile 发送客服File消息
63
- func (s * Server ) SendFile (to string , id int , mediaId string ) * WxErr {
64
- return s .SendMsg (s .NewFile (to , id , mediaId ))
58
+ func (s * Server ) SendFile (to string , mediaId string ) * WxErr {
59
+ return s .SendMsg (s .NewFile (to , mediaId ))
65
60
}
66
61
67
62
// SendVideo 发送客服Video消息
68
- func (s * Server ) SendVideo (to string , id int , mediaId , title , desc string ) * WxErr {
69
- return s .SendMsg (s .NewVideo (to , id , mediaId , title , desc ))
63
+ func (s * Server ) SendVideo (to string , mediaId , title , desc string ) * WxErr {
64
+ return s .SendMsg (s .NewVideo (to , mediaId , title , desc ))
70
65
}
71
66
72
67
// SendTextcard 发送客服extcard消息
73
- func (s * Server ) SendTextcard (to string , id int , title , desc , url string ) * WxErr {
74
- return s .SendMsg (s .NewTextcard (to , id , title , desc , url ))
68
+ func (s * Server ) SendTextcard (to string , title , desc , url string ) * WxErr {
69
+ return s .SendMsg (s .NewTextcard (to , title , desc , url ))
75
70
}
76
71
77
72
// SendMusic 发送客服Music消息
78
- func (s * Server ) SendMusic (to string , id int , mediaId , title , desc , musicUrl , qhMusicUrl string ) * WxErr {
79
- return s .SendMsg (s .NewMusic (to , id , mediaId , title , desc , musicUrl , qhMusicUrl ))
73
+ func (s * Server ) SendMusic (to string , mediaId , title , desc , musicUrl , qhMusicUrl string ) * WxErr {
74
+ return s .SendMsg (s .NewMusic (to , mediaId , title , desc , musicUrl , qhMusicUrl ))
80
75
}
81
76
82
77
// SendNews 发送客服news消息
83
- func (s * Server ) SendNews (to string , id int , arts ... Article ) * WxErr {
84
- return s .SendMsg (s .NewNews (to , id , arts ... ))
78
+ func (s * Server ) SendNews (to string , arts ... Article ) * WxErr {
79
+ return s .SendMsg (s .NewNews (to , arts ... ))
85
80
}
86
81
87
82
// SendMpNews 发送加密新闻mpnews消息(仅企业号可用)
88
- func (s * Server ) SendMpNews (to string , id int , arts ... MpArticle ) * WxErr {
89
- return s .SendMsg (s .NewMpNews (to , id , arts ... ))
83
+ func (s * Server ) SendMpNews (to string , arts ... MpArticle ) * WxErr {
84
+ return s .SendMsg (s .NewMpNews (to , arts ... ))
90
85
}
91
86
92
87
// SendMpNewsId 发送加密新闻mpnews消息(直接使用mediaId)
93
- func (s * Server ) SendMpNewsId (to string , id int , mediaId string ) * WxErr {
94
- return s .SendMsg (s .NewMpNewsId (to , id , mediaId ))
88
+ func (s * Server ) SendMpNewsId (to string , mediaId string ) * WxErr {
89
+ return s .SendMsg (s .NewMpNewsId (to , mediaId ))
90
+ }
91
+
92
+ // SendMarkDown 发送加密新闻mpnews消息(直接使用mediaId)
93
+ func (s * Server ) SendMarkDown (to string , content string ) * WxErr {
94
+ return s .SendMsg (s .NewMarkDown (to , content ))
95
95
}
96
96
97
- // SendMarkdown 发送加密新闻mpnews消息(直接使用mediaId)
98
- func (s * Server ) SendMarkDown (to string , id int , content string ) * WxErr {
99
- return s .SendMsg (s .NewMarkDown (to , id , content ))
97
+ // SendTaskCard 发送任务卡片taskcard消息
98
+ func (s * Server ) SendTaskCard (to string , Title , Desc , Url , TaskId , Btn string ) * WxErr {
99
+ return s .SendMsg (s .NewTaskCard (to , Title , Desc , Url , TaskId , Btn ))
100
100
}
0 commit comments