Comments (13)
SubscribeMessage 结构还是 string, 在 json 编码的时候会加上转移符,仍然无法使用撒
看到另外一个 issues 了, 打扰了
from weapp.
type SubscribeMessage struct {
ToUser string `json:"touser"`
TemplateID string `json:"template_id"`
Page string `json:"page,omitempty"`
MiniprogramState MiniprogramState `json:"miniprogram_state,omitempty"`
Data map[string]interface{} `json:"data"`
}
这里应该是 map[string]interface{}
from weapp.
谢谢指正 应该是 subscribemessage.MiniprogramStateDeveloper
from weapp.
type SubscribeMessage struct { ToUser string `json:"touser"` TemplateID string `json:"template_id"` Page string `json:"page,omitempty"` MiniprogramState MiniprogramState `json:"miniprogram_state,omitempty"` Data map[string]interface{} `json:"data"` }
这里应该是 map[string]interface{}
v2 用的是map,但是在实际应用中不是很好转换和使用,所以考虑在v3使用微信接口原生的string类型;
from weapp.
type SubscribeMessage struct { ToUser string `json:"touser"` TemplateID string `json:"template_id"` Page string `json:"page,omitempty"` MiniprogramState MiniprogramState `json:"miniprogram_state,omitempty"` Data map[string]interface{} `json:"data"` }
这里应该是 map[string]interface{}
v2 用的是map,但是在实际应用中不是很好转换和使用,所以考虑在v3使用微信接口原生的string类型;
from weapp.
package weapp
weapp.MiniprogramStateDeveloper
subscribemessage.MiniprogramStateDeveloper IDE会直接报错
from weapp.
from weapp.
引用import weapp开发 按照文档会报错
from weapp.
from weapp.
看下具体的错误是啥呢 VENI VIDI VICI
…
在 2021年9月21日,上午8:45,JiajunDou @.***> 写道: 引用import weapp开发 按照文档会报错 — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
订阅消息data为string,我这边一直提示参数错误,没找出是什么原因
这是我的代码
res, err1 := miniapp.MiniAppCli.SendSubscribeMsg(&weapp.SubscribeMessage{
ToUser: "o4Q0Y5Xt1Kx0xp3hIw-luS1xHGO0",
TemplateID: "p2Byu2vTmAPiuYo_Kwrgg6xr9j_2QtssGHQ1uX2IT7Y",
Page: "pages/index/index",
MiniprogramState: weapp.MiniprogramStateDeveloper,
Data: `{"name1":{"value":"11111"},"time3":{"value":"3333"},"thing7":{"value":"7777"}}`,
})
fmt.Println("订阅消息响应", res,err1)
下面是报错data.name1.value is emtpy
2021/10/15 16:46:18 [info] request params: &{ToUser:o4Q0Y5Xt1Kx0xp3hIw-luS1xHGO0 TemplateID:p2Byu2vTmAPiuYo_Kwrgg6xr9j_2QtssGHQ1uX2IT7Y Page:pages/index/index MiniprogramState:developer Data:{"name1":{"value":"11111"},"time3":{"value":"3333"},"thing7":{"value":"7777"}}}
订阅消息响应 &{47003 argument invalid! data.name1.value is emtpy rid: 61693fdb-4e573d1c-6310270b} <nil>
from weapp.
@royalrick
我自己把data改成map类型,结果发送成功了。
// SubscribeMessage 订阅消息
type SubscribeMessage struct {
ToUser string `json:"touser"`
TemplateID string `json:"template_id"`
Page string `json:"page,omitempty"`
MiniprogramState MiniprogramState `json:"miniprogram_state,omitempty"`
Data map[string]interface{} `json:"data"`
}
from weapp.
已经修复,谢谢:)
from weapp.
SubscribeMessage 结构还是 string, 在 json 编码的时候会加上转移符,仍然无法使用撒
from weapp.
Related Issues (20)
- 【咨询】为什么使用微信通知监听服务要传入mchID和apiKey呢? HOT 1
- 会考虑接入小程序的同城配送么? HOT 1
- 小程序与公众号下发统一消息接口调整通知 HOT 1
- 获取token的地址能否更新一下 HOT 7
- 包名不统一 HOT 1
- 【提问】请问支持API安全(api签名加密)嘛? HOT 2
- 希望可以更新内容审核2.0 HOT 4
- "crypto/aes: invalid key size 43 HOT 1
- weapp v3版本文本检测好像用的还是腾讯的v1的接口? HOT 7
- baseURL 建议支持用户自定义 因为现在后端还可能用于其他平台的小程序 HOT 1
- 使用fasthttp代替http
- 并发 Send 上万条就报错了 HOT 1
- 自定义 token 获取方法,入参应该加上appid,和appsecret
- 有主动刷新access_token缓存的方法吗
- there is bug when deal with customer message
- 测试登录[login]接口时 `code`如何获取?
- v1需要添加profit_sharing这个字段, HOT 9
- 获取电子面单余额 的接口中,获取到的数据始终是0 HOT 3
- 媒体安全检查接口还是用的v1,但现在微信支持的是v2
- 调用client.Login,发现默认的logger每次打印日志都会把之前所有的login记录打出来,是故意的还是不小心? HOT 3
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 weapp.