增加了客服消息发小程序模板
This commit is contained in:
parent
655e988d4c
commit
09fbf5bcc4
|
|
@ -11,7 +11,17 @@ declare type NewsServeMessageOption = {
|
|||
url: string;
|
||||
picurl?: string;
|
||||
};
|
||||
declare type ServeMessageOption = TextServeMessageOption | NewsServeMessageOption;
|
||||
declare type MpServeMessageOption = {
|
||||
openId: string;
|
||||
type: 'mp';
|
||||
data: {
|
||||
title: string;
|
||||
appId: string;
|
||||
pagepath: string;
|
||||
thumbnailId: string;
|
||||
};
|
||||
};
|
||||
declare type ServeMessageOption = TextServeMessageOption | NewsServeMessageOption | MpServeMessageOption;
|
||||
export declare class WechatPublicInstance {
|
||||
appId: string;
|
||||
appSecret?: string;
|
||||
|
|
|
|||
|
|
@ -341,6 +341,21 @@ var WechatPublicInstance = /** @class */ (function () {
|
|||
});
|
||||
break;
|
||||
}
|
||||
case 'mp': {
|
||||
Object.assign(myInit, {
|
||||
body: JSON.stringify({
|
||||
touser: openId,
|
||||
msgtype: 'miniprogrampage',
|
||||
miniprogrampage: {
|
||||
title: options.data.title,
|
||||
appid: options.data.appId,
|
||||
pagepath: options.data.pagepath,
|
||||
thumb_media_id: options.data.thumbnailId,
|
||||
},
|
||||
}),
|
||||
});
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
throw new Error('当前消息类型暂不支持');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,18 @@ type NewsServeMessageOption = {
|
|||
picurl?: string;
|
||||
};
|
||||
|
||||
type ServeMessageOption = TextServeMessageOption | NewsServeMessageOption;
|
||||
type MpServeMessageOption = {
|
||||
openId: string;
|
||||
type: 'mp';
|
||||
data: {
|
||||
title: string;
|
||||
appId: string;
|
||||
pagepath: string;
|
||||
thumbnailId: string;
|
||||
};
|
||||
};
|
||||
|
||||
type ServeMessageOption = TextServeMessageOption | NewsServeMessageOption | MpServeMessageOption;
|
||||
|
||||
export class WechatPublicInstance {
|
||||
appId: string;
|
||||
|
|
@ -328,6 +339,21 @@ export class WechatPublicInstance {
|
|||
});
|
||||
break;
|
||||
}
|
||||
case 'mp': {
|
||||
Object.assign(myInit, {
|
||||
body: JSON.stringify({
|
||||
touser: openId,
|
||||
msgtype: 'miniprogrampage',
|
||||
miniprogrampage: {
|
||||
title: options.data.title,
|
||||
appid: options.data.appId,
|
||||
pagepath: options.data.pagepath,
|
||||
thumb_media_id: options.data.thumbnailId,
|
||||
},
|
||||
}),
|
||||
});
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
throw new Error('当前消息类型暂不支持');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue