Comments (7)
能把代码贴下吗,看下是怎么发送消息的,怎么配置的?
from wechat.
func Wechat(c echo.Context) error {
wc := wechat.NewWechat(&wechat.Config{
Token: "tttttt",
EncodingAESKey: "PrIlmjPSar2cn4ObdrAqMdc82srylFUvMECaUkuM50B",
})
server := wc.GetServer(c.Request(), c.Response().Writer())
server.SetMessageHandler(askForInv)
if err := server.Serve(); err != nil {
return err
}
return server.Send()
}
func askForInv(msg message.MixMessage) *message.Reply {
article := []*message.Article{}
print("aaa")
switch msg.Content {
case "调查问卷2":
article = append(article, message.NewArticle("调查问卷", "2016年热点问题微调查(第2期)", "", "http://lancelot96/inv1"))
case "调查问卷3":
article = append(article, message.NewArticle("调查问卷", "2016年热点问题微调查(第3期)", "", "http://lancelot96/inv2"))
case "调查统计2":
article = append(article, message.NewArticle("问卷调查统计", "", "", "http://lancelot96/count1"))
case "调查统计3":
article = append(article, message.NewArticle("问卷调查统计", "", "", "http://lancelot96/count2"))
default:
text := message.NewText("参与调查问卷请发送: 调查问卷2或者调查问卷3")
return &message.Reply{
message.MsgTypeText,
text,
}
}
return &message.Reply{
message.MsgTypeNews,
message.NewNews(article),
}
}
from wechat.
"请求校验失败" 的提示是在收到微信消息校验的时候返回的,可以抓个包看下微信返回的信息。
从上面的代码看不出大问题。
examples
目录下的例子能否跑通?
from wechat.
唉 配置能通过啊
examples没试过 明天试试
from wechat.
例子存在同样的问题:"请求校验失败"
from wechat.
我把我的解决方案说一下
修改作者的代码 在验证的地方加一个条件 如果是get方法就验证
from wechat.
能否提供一个pr,我这边排查下 ,谢谢。
from wechat.
Related Issues (20)
- "json Unmarshal Error, err=json: cannot unmarshal number into Go struct field FollowUser.follow_user.createtime of type string" HOT 1
- [咨询]公众号扫码关注以后自动回复的消息里面,怎么设置文字对应的超文本链接,以及如何实现一次回复多条消息
- [BUG] 当公众号收到特殊内容时,XML 解析失败
- [Feature] 发送设备消息 HOT 1
- [BUG] GetExternalUserDetail api json Unmarshal Error
- [Feature]支持发送完微信小程序订阅消息后返回msgid HOT 1
- [Feature] 获取微信红包封面
- [咨询] 企业微信SDK哪里有 HOT 6
- [咨询]请问有开放平台下面的网站应用相关的sdk吗? 我在文档中没找到。 HOT 1
- [咨询]officialaccount的user里面的Info.userInfo ,为什么没有public HOT 1
- [BUG]cache 干什么用的,不配置吧不行么?panic: cache is ineed HOT 1
- [咨询] tcb 不支持了
- [Feature]是否有计划增加对微信公众号的素材管理的支持? HOT 1
- [BUG]短剧媒资上传完成事件media_id类型错误
- 同城物流这个有吗 HOT 1
- 这个适用于goframe吗 HOT 1
- 这个适用于goframe吗 HOT 5
- 公众号新增模板消息接口,新增了参数,暂未支持 HOT 2
- [BUG] 当不回复消息的时候, 会答应错误日志, HOT 1
- [Feature] 需要一种仅处理消息内容的模式,
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wechat.