调整 微信客服消息和事件data数据申明

This commit is contained in:
Wang Kejun 2023-10-18 15:16:17 +08:00
parent 4691c8c1da
commit 4de07bbd4d
3 changed files with 119 additions and 24 deletions

40
es/types/Wechat.d.ts vendored
View File

@ -9,19 +9,43 @@
export type WechatPublicEventData = {
ToUserName: string;
FromUserName: string;
CreateTime: string;
MsgType: string;
Event: string;
Content: string;
EventKey: string;
CreateTime: number;
MsgID: string;
Status: string;
MsgType: 'text' | 'image' | 'voice' | 'video' | 'location' | 'link' | 'event';
Event: 'subscribe' | 'unsubscribe' | 'SCAN' | 'LOCATION' | 'CLICK' | 'VIEW' | 'TEMPLATESENDJOBFINISH';
EventKey: string;
Ticket?: string;
Latitude?: string;
Longitude?: string;
Precision?: string;
Status?: string;
Content?: string;
MsgDataId?: string;
PicUrl?: string;
MediaId?: string;
Format?: string;
Recognition?: string;
ThumbMediaId?: string;
Location_X?: number;
Location_Y?: number;
Scale?: number;
Label?: string;
Title?: string;
Description?: string;
Url?: string;
Idx?: number;
};
export declare type WechatMpEventData = {
ToUserName: string;
FromUserName: string;
CreateTime: number;
MsgType: string;
Content: string;
MsgID: string;
MsgType: 'text' | 'image' | 'miniprogrampage' | 'event';
Content?: string;
PicUrl?: string;
Title?: string;
AppId?: string;
PagePath?: string;
ThumbUrl?: string;
ThumbMediaId?: string;
};

40
lib/types/Wechat.d.ts vendored
View File

@ -9,19 +9,43 @@
export type WechatPublicEventData = {
ToUserName: string;
FromUserName: string;
CreateTime: string;
MsgType: string;
Event: string;
Content: string;
EventKey: string;
CreateTime: number;
MsgID: string;
Status: string;
MsgType: 'text' | 'image' | 'voice' | 'video' | 'location' | 'link' | 'event';
Event: 'subscribe' | 'unsubscribe' | 'SCAN' | 'LOCATION' | 'CLICK' | 'VIEW' | 'TEMPLATESENDJOBFINISH';
EventKey: string;
Ticket?: string;
Latitude?: string;
Longitude?: string;
Precision?: string;
Status?: string;
Content?: string;
MsgDataId?: string;
PicUrl?: string;
MediaId?: string;
Format?: string;
Recognition?: string;
ThumbMediaId?: string;
Location_X?: number;
Location_Y?: number;
Scale?: number;
Label?: string;
Title?: string;
Description?: string;
Url?: string;
Idx?: number;
};
export declare type WechatMpEventData = {
ToUserName: string;
FromUserName: string;
CreateTime: number;
MsgType: string;
Content: string;
MsgID: string;
MsgType: 'text' | 'image' | 'miniprogrampage' | 'event';
Content?: string;
PicUrl?: string;
Title?: string;
AppId?: string;
PagePath?: string;
ThumbUrl?: string;
ThumbMediaId?: string;
};

View File

@ -9,20 +9,67 @@
export type WechatPublicEventData = {
ToUserName: string;
FromUserName: string;
CreateTime: string;
MsgType: string;
Event: string;
Content: string;
EventKey: string;
CreateTime: number;
MsgID: string;
Status: string;
MsgType:
| 'text'
| 'image'
| 'voice'
| 'video'
| 'location'
| 'link'
| 'event'; // 消息类型; event接收事件推送
Event:
| 'subscribe'
| 'unsubscribe'
| 'SCAN'
| 'LOCATION'
| 'CLICK'
| 'VIEW'
| 'TEMPLATESENDJOBFINISH';
// 接收事件
EventKey: string; // 事件KEY值subscribe: qrscene_为前缀后面为二维码的参数值; SCAN: 一个32位无符号整数即创建二维码时的二维码scene_id; CLICK: 自定义菜单接口中KEY值对应; VIEW: 设置的跳转URL;
Ticket?: string; // subscribe 二维码的ticket可用来换取二维码图片
Latitude?: string; // LOCATION 地理位置纬度
Longitude?: string; // LOCATION 地理位置经度
Precision?: string; // LOCATION 地理位置精度
// 接收模版消息回调
Status?: string; // 模版消息回调 发送状态
// 接收客服消息
Content?: string; // 文本消息内容
MsgDataId?: string; // 消息的数据ID消息如果来自文章时才有
PicUrl?: string; //图片链接(由系统生成)
MediaId?: string; // 图片消息媒体id、语音消息媒体id、视频消息媒体id
Format?: string; // 语音格式
Recognition?: string; // 语音识别结果
ThumbMediaId?: string; // 视频消息缩略图的媒体id
Location_X?: number; // 地理位置纬度
Location_Y?: number; // 地理位置经度
Scale?: number; // 地图缩放大小
Label?: string; // 地理位置信息
Title?: string; // link 消息标题
Description?: string; // link 消息描述
Url?: string; // link 消息链接
Idx?: number; // link 多图文时第几篇文章从1开始消息如果来自文章时才有
};
// 接收客服消息
export declare type WechatMpEventData = {
ToUserName: string;
FromUserName: string;
CreateTime: number;
MsgType: string;
Content: string;
MsgID: string;
MsgType: 'text' | 'image' | 'miniprogrampage' | 'event'; // event 用户在小程序“客服会话按钮”进入客服会话
Content?: string; // 文本消息内容
PicUrl?: string; //图片链接(由系统生成)
Title?: string; // 标题
AppId?: string; // 小程序appid
PagePath?: string; // 小程序页面路径
ThumbUrl?: string; // 封面图片的临时cdn链接
ThumbMediaId?: string; // 封面图片的临时素材id
};