hpyer / node-easywechat

EasyWeChat for Node.js
MIT License
138 stars 18 forks source link

关于第三方平台消息接收的问题 #62

Closed ValueLan closed 9 months ago

ValueLan commented 9 months ago

消息类型1 认证类型

官方原话

用于接收平台推送给第三方平台账号的消息与事件,如授权事件通知、component_verify_ticket等。
注意,该URL的一级域名需与“消息与事件接收配置”的一级域名一致
云开发模式下第三方平台接收事件通知以及获取调用凭据,
该链接也会推送消息
https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Register_Mini_Programs/Fast_Registration_Interface_document.html

const app = new OpenPlatform()

  app .setRequest(request);
    let serve = app .getServer()
    serve.with(async (message) => {
message.InfoType//该类型不要写死
    })
建议建议类型不要写死```

消息类型2 发送消息 聊天
官方原话

用于代授权的公众号或小程序的接收平台推送的消息与事件,该参数按规则填写(需包含/$APPID$,如www.abc.com/$APPID$/callback),实际接收消息时$APPID$将被替换为公众号或小程序AppId。 注意:该URL的一级域名需与“授权事件接收配置”的一级域名一致 云开发模式下第三方平台接收消息的方式, const app = new OpenPlatform()

app .setRequest(request); let serve = app .getServer() serve.with(async (message) => { message.InfoType//该类型不要写死 }) 建议建议类型不要写死

ValueLan commented 9 months ago

可以的话,我可以加个微信,给你发几个相关图片看看 github名即是微信名,

hpyer commented 9 months ago

更新到3.5.13,增加了快速注册企业小程序审核事件的支持,并改类型为string

ValueLan commented 9 months ago

感谢我这边检查下

ValueLan commented 9 months ago

https://github.com/hpyer/node-easywechat/blob/922f088b77d55b2b906d75edd6850b355eed211c/src/OpenPlatform/Message.ts#L53

[key: string]: any; 希望新增,这里消息类型非常多

hpyer commented 9 months ago

请更新 3.5.16

ValueLan commented 9 months ago

node_modules/node-easywechat/dist/Core/Message.d.ts:29:27 - error TS2304: Cannot find name 'Recordable'.

29 interface Message extends Recordable, HasAttributesMixin {

hpyer commented 9 months ago

哎~尴尬~

hpyer commented 9 months ago

为啥我这里也是nestjs的项目,skipLibCheck也设置false,我这里不会提示这个问题呢

ValueLan commented 9 months ago

export type Recordable<T = any> = Record<string, T>; 然后import 一下?

hpyer commented 9 months ago

没事,直接去掉算了,反正也没怎么用

ValueLan commented 9 months ago

我这边改一下把,我想把证书过期时间也存储起来,到时候你看看, 不行的话,可不合

hpyer commented 9 months ago

TS 问题我已经改了,刚刚git出问题,一致push不了

hpyer commented 9 months ago

证书过期时间缓存起来做什么?

ValueLan commented 9 months ago

https://github.com/hpyer/node-easywechat/blob/080ccb39c9802a47c6ce32343be8f3ec21614e99/src/Pay/Utils.ts#L20 这个如果有多个 Object.keys(xxx)[0] 排序我心里没底

ValueLan commented 9 months ago

跑着跑着出bug,就很头疼

hpyer commented 9 months ago

我已经把过期时间小于1天的证书都过滤掉了,剩下的证书都是可以用的呀,,所以才需要你请求的时候加上Wechatpay-Serial这个来指定使用的证书啊

ValueLan commented 9 months ago

好吧,先跑着,没关系, Wechatpay-Serial业务也不是很多