diff --git a/CHANGELOG.md b/CHANGELOG.md index c1b98e6e..a3f5aad6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ ## Standby +- [A] 微信小程序 SDK 支持上报订阅消息订阅关系 - [A] QQ 小程序 SDK 添加内容安全检测接口 - [A] 百度小程序 SDK 支持百度模版消息 formId 上报 - [M] 数据表批量操作,enableTrigger 为 false 时,移除默认的 limit diff --git a/core/config.js b/core/config.js index 9d42006d..016f939b 100644 --- a/core/config.js +++ b/core/config.js @@ -71,6 +71,7 @@ const API = { AUTHENTICATE: '/hserve/v2.1/idp/wechat/authenticate/', USER_ASSOCIATE: '/hserve/v2.0/idp/wechat/user-associate/', TEMPLATE_MESSAGE: '/hserve/v2.0/template-message-ticket/', + SUBSCRIBE_MESSAGE: '/hserve/v2.2/subscription-message/relationship-report/', DECRYPT: '/hserve/v1/wechat/decrypt/', WXACODE: '/hserve/v1.4/miniappcode/', CENSOR_IMAGE: '/hserve/v1.7/censor-image/', diff --git a/sdk-file/src/wechat/index.js b/sdk-file/src/wechat/index.js index bed816e6..33033b40 100644 --- a/sdk-file/src/wechat/index.js +++ b/sdk-file/src/wechat/index.js @@ -4,6 +4,7 @@ const wechatAuth = require('./auth') const polyfill = require('./polyfill') const censor = require('./censor') const reportTemplateMsgAnalytics = require('./reportTemplateMsgAnalytics') +const subscribeMessage = require('./subscribeMessage') BaaS._config.VERSION = __VERSION_WECHAT__ @@ -12,6 +13,7 @@ BaaS.use(polyfill) BaaS.use(wechatAuth) BaaS.use(censor) BaaS.use(reportTemplateMsgAnalytics) +BaaS.use(subscribeMessage) BaaS.pay = require('./pay') BaaS.order = require('./order') BaaS.request = require('./request') diff --git a/sdk-file/src/wechat/subscribeMessage.js b/sdk-file/src/wechat/subscribeMessage.js new file mode 100644 index 00000000..8cb9f8e2 --- /dev/null +++ b/sdk-file/src/wechat/subscribeMessage.js @@ -0,0 +1,13 @@ +const BaaS = require('core-module/baas') + +const API = BaaS._config.API + +module.exports = function (BaaS) { + BaaS.subscribeMessage = (subscription) => { + return BaaS._baasRequest({ + url: API.WECHAT.SUBSCRIBE_MESSAGE, + method: 'POST', + data: subscription, + }) + } +}