-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用新版卡片回调消息格式不匹配,反序列化错误 #130
Comments
近期卡片新特性较多,人力比较紧张,还在推进中。 |
卡片回调一直报这个错误 |
这个问题非常影响使用呀! |
@sbaby1997 升级最新版 v3.3.0,然后卡片回传交互选“卡片回传交互(旧)” |
All right. 鉴于官方还没修,我这里提出一个临时解决方法,大家可以参考: 在
type CardAction struct {
*larkevent.EventReq
Schema string `json:"schema"`
Header struct {
EventID string `json:"event_id"`
Token string `json:"token"`
CreateTime string `json:"create_time"`
EventType string `json:"event_type"`
TenantKey string `json:"tenant_key"`
AppID string `json:"app_id"`
} `json:"header"`
Challenge string `json:"challenge"`
Token string `json:"token"`
Type string `json:"type"`
Event struct {
Operator struct {
TenantKey string `json:"tenant_key"`
UserID string `json:"user_id"`
OpenID string `json:"open_id"`
UnionID string `json:"union_id"`
} `json:"operator"`
Token string `json:"token"`
Action struct {
Tag string `json:"tag"`
Timezone string `json:"timezone"`
FormValue map[string]string `json:"form_value"`
Name string `json:"name"`
} `json:"action"`
Host string `json:"host"`
Context struct {
OpenMessageID string `json:"open_message_id"`
OpenChatID string `json:"open_chat_id"`
} `json:"context"`
} `json:"event"`
}
if h.eventEncryptKey == "" {
return nil
}
...
targetSign := Signature(requestTimestamp, requestNonce,h.eventEncryptKey,string(req.Body))
h := sha256.New() |
新的改成event事件承载了
|
对于卡片消息回调的 Value 应该定义成interface{} . 至少目前的卡片消息回调, 回调事件的值 支持 字符串,如果用字符串传进来 就直接cannot unmarshal string into Go struct XXXXXXX 。为了不出发这个error 只能强制使用 对象结构作为value type CallBackAction struct {
Value map[string]interface{} `json:"value"`
Tag string `json:"tag"`
Option string `json:"option"`
Timezone string `json:"timezone"`
Name string `json:"name"`
FormValue map[string]interface{} `json:"form_value"`
InputValue string `json:"input_value"`
Options []string `json:"options"`
Checked bool `json:"checked"`
} |
使用新版卡片回调消息格式不匹配,反序列化错误。
CardAction struct
格式为v1格式,请问什么时候支持新版消息格式?The text was updated successfully, but these errors were encountered: