fix notification触发器 拼接url时 公众号的时候 加上域名

This commit is contained in:
Wang Kejun 2023-03-15 15:55:21 +08:00
parent ce7ba869b8
commit 20beec54fb
35 changed files with 212 additions and 148 deletions

View File

@ -1 +1 @@
{ "attr": { "detail": "详细地址", "area": "所在地区", "phone": "联系电话", "name": "姓名", "default": "是否默认", "remark": "备注" } }
{ "name": "地址", "attr": { "detail": "详细地址", "area": "所在地区", "phone": "联系电话", "name": "姓名", "default": "是否默认", "remark": "备注" } }

View File

@ -1 +1 @@
{ "attr": { "description": "描述", "type": "类型", "system": "系统", "name": "名称", "config": "设置", "style": "样式" }, "v": { "type": { "web": "网站", "wechatPublic": "微信公众号", "wechatMp": "微信小程序" } } }
{ "name": "应用", "attr": { "description": "描述", "type": "类型", "system": "系统", "name": "名称", "config": "设置", "style": "样式" }, "v": { "type": { "web": "网站", "wechatPublic": "微信公众号", "wechatMp": "微信小程序" } } }

View File

@ -1 +1 @@
{ "attr": { "level": "层级", "depth": "深度", "parent": "上级地区", "name": "名称", "code": "地区编码", "center": "中心坐标" }, "v": { "level": { "country": "国家", "province": "省", "city": "市", "district": "区", "street": "街道" } } }
{ "name": "地区", "attr": { "level": "层级", "depth": "深度", "parent": "上级地区", "name": "名称", "code": "地区编码", "center": "中心坐标" }, "v": { "level": { "country": "国家", "province": "省", "city": "市", "district": "区", "street": "街道" } } }

View File

@ -1 +1 @@
{ "attr": { "title": "标题", "author": "作者", "abstract": "简介", "content": "正文", "files": "封面图", "iState": "状态", "url": "外部链接", "entity": "关联对象", "entityId": "关联对象id", "sign": "唯一标志" }, "action": { "online": "上架", "offline": "下架", "disabled": "禁用" }, "v": { "iState": { "online": "已上架", "offline": "已下架", "disabled": "已禁用" } } }
{ "name": "文章", "attr": { "title": "标题", "author": "作者", "abstract": "简介", "content": "正文", "files": "封面图", "iState": "状态", "url": "外部链接", "entity": "关联对象", "entityId": "关联对象id", "sign": "唯一标志" }, "action": { "online": "上架", "offline": "下架", "disabled": "禁用" }, "v": { "iState": { "online": "已上架", "offline": "已下架", "disabled": "已禁用" } } }

View File

@ -1 +1 @@
{ "attr": { "mobile": "手机号", "code": "验证码", "visitorId": "用户标识", "reason": "失败原因", "env": "用户环境", "expired": "是否过期", "expiresAt": "过期时间", "iState": "状态" }, "action": { "send": "发送", "fail": "失败", "success": "成功" }, "v": { "iState": { "unsent": "未发送", "sending": "发送中", "sent": "已发送", "failure": "已失败" } } }
{ "name": "验证码", "attr": { "mobile": "手机号", "code": "验证码", "visitorId": "用户标识", "reason": "失败原因", "env": "用户环境", "expired": "是否过期", "expiresAt": "过期时间", "iState": "状态" }, "action": { "send": "发送", "fail": "失败", "success": "成功" }, "v": { "iState": { "unsent": "未发送", "sending": "发送中", "sent": "已发送", "failure": "已失败" } } }

View File

@ -1 +1 @@
{ "attr": { "url": "域名", "apiPath": "api路径", "protocol": "协议", "port": "端口", "system": "系统" }, "v": { "protocol": { "http": "http", "https": "https" } } }
{ "name": "域名", "attr": { "url": "域名", "apiPath": "api路径", "protocol": "协议", "port": "端口", "system": "系统" }, "v": { "protocol": { "http": "http", "https": "https" } } }

View File

@ -1 +1 @@
{ "attr": { "ableState": "是否可用", "email": "邮箱", "user": "关联用户", "tokens": "相关令牌" }, "action": { "enable": "启用", "disable": "禁用" }, "v": { "ableState": { "enabled": "可用的", "disabled": "禁用的" } } }
{ "name": "邮箱", "attr": { "ableState": "是否可用", "email": "邮箱", "user": "关联用户", "tokens": "相关令牌" }, "action": { "enable": "启用", "disable": "禁用" }, "v": { "ableState": { "enabled": "可用的", "disabled": "禁用的" } } }

View File

@ -1 +1 @@
{ "attr": { "origin": "源", "type": "类型", "bucket": "桶", "objectId": "对象编号", "tag1": "标签一", "tag2": "标签二", "filename": "文件名", "md5": "md5", "entity": "关联对象", "entityId": "关联对象id", "extra1": "额外信息", "extension": "后缀名", "size": "文件大小", "sort": "排序", "fileType": "文件类型" }, "v": { "origin": { "qiniu": "七牛云", "unknown": "未知" }, "type": { "image": "图像", "video": "视频", "audio": "音频", "file": "文件" } } }
{ "name": "文件", "attr": { "origin": "源", "type": "类型", "bucket": "桶", "objectId": "对象编号", "tag1": "标签一", "tag2": "标签二", "filename": "文件名", "md5": "md5", "entity": "关联对象", "entityId": "关联对象id", "extra1": "额外信息", "extension": "后缀名", "size": "文件大小", "sort": "排序", "fileType": "文件类型" }, "v": { "origin": { "qiniu": "七牛云", "unknown": "未知" }, "type": { "image": "图像", "video": "视频", "audio": "音频", "file": "文件" } } }

View File

@ -1 +1 @@
{ "attr": { "title": "名称", "streamTitle": "直播流名称", "liveonly": "活跃状态", "hub": "直播空间名称", "entity": "所属实体", "entityId": "所属实体id", "rtmpPushUrl": "推流地址", "rtmpPlayUrl": "播放地址", "expireAt": "推流过期时间", "pcPushUrl": "OBS推流地址", "streamKey": "OBS串流密钥" }, "v": { "liveonly": { "online": "在线", "offline": "下线" } } }
{ "name": "直播流", "attr": { "title": "名称", "streamTitle": "直播流名称", "liveonly": "活跃状态", "hub": "直播空间名称", "entity": "所属实体", "entityId": "所属实体id", "rtmpPushUrl": "推流地址", "rtmpPlayUrl": "播放地址", "expireAt": "推流过期时间", "pcPushUrl": "OBS推流地址", "streamKey": "OBS串流密钥" }, "v": { "liveonly": { "online": "在线", "offline": "下线" } } }

View File

@ -1 +1 @@
{ "attr": { "entity": "关联对象", "entityId": "关联对象ID", "restriction": "限制", "title": "标题", "content": "内容", "user": "关联用户", "type": "消息类型", "weight": "优先级", "iState": "发送状态", "visitState": "访问状态", "router": "目标路由", "data": "透传数据" }, "action": { "succeed": "成功", "fail": "失败", "visit": "阅读" }, "v": { "iState": { "sending": "发送中", "success": "发送成功", "failure": "发送失败" }, "visitState": { "unvisited": "未读", "visited": "已读" }, "weight": { "high": "高", "medium": "中", "low": "低" } } }
{ "name": "消息", "attr": { "entity": "关联对象", "entityId": "关联对象ID", "restriction": "限制", "title": "标题", "content": "内容", "user": "关联用户", "type": "消息类型", "weight": "优先级", "iState": "发送状态", "visitState": "访问状态", "router": "目标路由", "data": "透传数据" }, "action": { "succeed": "成功", "fail": "失败", "visit": "阅读" }, "v": { "iState": { "sending": "发送中", "success": "发送成功", "failure": "发送失败" }, "visitState": { "unvisited": "未读", "visited": "已读" }, "weight": { "high": "高", "medium": "中", "low": "低" } } }

View File

@ -1 +1 @@
{ "attr": { "message": "消息", "system": "系统" } }
{ "name": "消息系统连接", "attr": { "message": "消息", "system": "系统" } }

View File

@ -1 +1 @@
{ "attr": { "type": "类型" } }
{ "name": "消息类型", "attr": { "type": "类型" } }

View File

@ -1 +1 @@
{ "attr": { "type": "消息类型", "templateId": "模板编号", "application": "关联应用" } }
{ "name": "消息类型模板", "attr": { "type": "消息类型", "templateId": "模板编号", "application": "关联应用" } }

View File

@ -1 +1 @@
{ "attr": { "ableState": "是否可用", "mobile": "手机号", "user": "关联用户", "tokens": "相关令牌" }, "action": { "enable": "启用", "disable": "禁用" }, "v": { "ableState": { "enabled": "可用的", "disabled": "禁用的" } } }
{ "name": "手机", "attr": { "ableState": "是否可用", "mobile": "手机号", "user": "关联用户", "tokens": "相关令牌" }, "action": { "enable": "启用", "disable": "禁用" }, "v": { "ableState": { "enabled": "可用的", "disabled": "禁用的" } } }

View File

@ -1 +1 @@
{ "attr": { "targetEntity": "目标对象", "entity": "关联对象", "entityId": "关联对象Id", "action": "动作", "data": "数据", "filter": "条件", "extra": "其它", "iState": "状态" }, "action": { "abandon": "放弃", "apply": "应用" }, "v": { "iState": { "active": "活跃的", "abandoned": "放弃的", "applied": "应用的" } } }
{ "name": "更新", "attr": { "targetEntity": "目标对象", "entity": "关联对象", "entityId": "关联对象Id", "action": "动作", "data": "数据", "filter": "条件", "extra": "其它", "iState": "状态" }, "action": { "abandon": "放弃", "apply": "应用" }, "v": { "iState": { "active": "活跃的", "abandoned": "放弃的", "applied": "应用的" } } }

View File

@ -1 +1 @@
{ "attr": { "modi": "更新", "entity": "关联对象", "entityId": "关联对象id" } }
{ "name": "更新对象连接", "attr": { "modi": "更新", "entity": "关联对象", "entityId": "关联对象id" } }

View File

@ -1 +1 @@
{ "attr": { "channel": "消息渠道", "data": "消息数据", "messageSystem": "消息系统连接", "data1": "数据1", "data2": "数据2", "iState": "状态", "application": "关联应用", "templateId": "模板id" }, "action": { "succeed": "成功", "fail": "失败" }, "v": { "iState": { "sending": "发送中", "success": "发送成功", "failure": "发送失败" }, "channel": { "wechatPublic": "公众号", "jPush": "极光推送", "jim": "极光消息", "wechatMp": "小程序", "sms": "短信" } } }
{ "name": "通知", "attr": { "channel": "消息渠道", "data": "消息数据", "messageSystem": "消息系统连接", "data1": "数据1", "data2": "数据2", "iState": "状态", "application": "关联应用", "templateId": "模板id" }, "action": { "succeed": "成功", "fail": "失败" }, "v": { "iState": { "sending": "发送中", "success": "发送成功", "failure": "发送失败" }, "channel": { "wechatPublic": "公众号", "jPush": "极光推送", "jim": "极光消息", "wechatMp": "小程序", "sms": "短信" } } }

View File

@ -1 +1 @@
{ "attr": { "action": "动作", "data": "数据", "filter": "选择条件", "extra": "其它", "operator": "操作者" } }
{ "name": "操作", "attr": { "action": "动作", "data": "数据", "filter": "选择条件", "extra": "其它", "operator": "操作者" } }

View File

@ -1 +1 @@
{ "attr": { "oper": "操作", "entity": "关联对象", "entityId": "关联对象id" } }
{ "name": "操作对象连接", "attr": { "oper": "操作", "entity": "关联对象", "entityId": "关联对象id" } }

View File

@ -1 +1 @@
{ "attr": { "name": "名称", "description": "描述", "config": "设置", "style": "样式", "entity": "关联对象", "entityId": "关联对象id" } }
{ "name": "平台", "attr": { "name": "名称", "description": "描述", "config": "设置", "style": "样式", "entity": "关联对象", "entityId": "关联对象id" } }

View File

@ -1 +1 @@
{ "attr": { "name": "名称" }, "r": { "owner": "所有者" } }
{ "name": "角色", "attr": { "name": "名称" }, "r": { "owner": "所有者" } }

View File

@ -1 +1 @@
{ "attr": { "name": "名称", "entity": "对象名称", "entityId": "对象Id", "description": "描述", "config": "配置", "offset": "已同步素材位置" } }
{ "name": "订阅号", "attr": { "name": "名称", "entity": "对象名称", "entityId": "对象Id", "description": "描述", "config": "配置", "offset": "已同步素材位置" } }

View File

@ -1 +1 @@
{ "attr": { "name": "名称", "description": "描述", "config": "设置", "platform": "平台", "super": "超级系统", "folder": "代码目录名", "style": "样式", "entity": "关联对象", "entityId": "关联对象id" } }
{ "name": "系统", "attr": { "name": "名称", "description": "描述", "config": "设置", "platform": "平台", "super": "超级系统", "folder": "代码目录名", "style": "样式", "entity": "关联对象", "entityId": "关联对象id" } }

View File

@ -1 +1 @@
{ "attr": { "application": "应用", "entity": "关联对象", "entityId": "关联对象id", "user": "用户", "player": "扮演者", "env": "环境", "ableState": "状态" }, "action": { "enable": "激活", "disable": "禁用" }, "v": { "ableState": { "enabled": "使用中", "disabled": "已禁用" } } }
{ "name": "令牌", "attr": { "application": "应用", "entity": "关联对象", "entityId": "关联对象id", "user": "用户", "player": "扮演者", "env": "环境", "ableState": "状态" }, "action": { "enable": "激活", "disable": "禁用" }, "v": { "ableState": { "enabled": "使用中", "disabled": "已禁用" } } }

View File

@ -1 +1 @@
{ "attr": { "name": "姓名", "nickname": "昵称", "birth": "生日", "password": "密码", "passwordSha1": "sha1加密密码", "gender": "性别", "idCardType": "证件类型", "idNumber": "证件号码", "ref": "指向用户", "files": "相关文件", "userState": "用户状态", "idState": "身份验证状态", "codes": "微信分享二维码" }, "action": { "activate": "激活", "accept": "同意", "verify": "验证", "reject": "拒绝", "enable": "启用", "disable": "禁用", "mergeTo": "合并", "mergeFrom": "使合并" }, "v": { "userState": { "shadow": "未激活", "normal": "正常", "disabled": "禁用", "merged": "已被合并" }, "idState": { "unverified": "未验证", "verifying": "验证中", "verified": "已验证" }, "gender": { "male": "男", "female": "女" }, "idCardType": { "ID-Card": "身份证", "passport": "护照", "Mainland-passport": "港澳台通行证" } } }
{ "name": "用户", "attr": { "name": "姓名", "nickname": "昵称", "birth": "生日", "password": "密码", "passwordSha1": "sha1加密密码", "gender": "性别", "idCardType": "证件类型", "idNumber": "证件号码", "ref": "指向用户", "files": "相关文件", "userState": "用户状态", "idState": "身份验证状态", "codes": "微信分享二维码" }, "action": { "activate": "激活", "accept": "同意", "verify": "验证", "reject": "拒绝", "enable": "启用", "disable": "禁用", "mergeTo": "合并", "mergeFrom": "使合并" }, "v": { "userState": { "shadow": "未激活", "normal": "正常", "disabled": "禁用", "merged": "已被合并" }, "idState": { "unverified": "未验证", "verifying": "验证中", "verified": "已验证" }, "gender": { "male": "男", "female": "女" }, "idCardType": { "ID-Card": "身份证", "passport": "护照", "Mainland-passport": "港澳台通行证" } } }

View File

@ -1 +1 @@
{ "attr": { "relation": "关系", "entity": "关联对象", "entityId": "关联对象id", "type": "类型", "number": "次数", "confirmed": "已确认人数", "remark": "备注", "grantee": "领取人", "granter": "授权人", "codes": "微信码", "expired": "是否过期", "expiresAt": "过期时间", "redirectTo": "重定向页面", "qrCodeType": "二维码类型" }, "action": { "confirm": "确认" }, "v": { "type": { "grant": "授予", "transfer": "转交" }, "qrCodeType": { "webForWechatPublic": "网站引流到公众号", "wechatMpDomainUrl": "小程序url码", "wechatMpWxaCode": "小程序码", "wechatPublic": "公众号关注码", "wechatPublicForMp": "公众号回复小程序码" } } }
{ "name": "用户授权", "attr": { "relation": "关系", "entity": "关联对象", "entityId": "关联对象id", "type": "类型", "number": "次数", "confirmed": "已确认人数", "remark": "备注", "grantee": "领取人", "granter": "授权人", "codes": "微信码", "expired": "是否过期", "expiresAt": "过期时间", "redirectTo": "重定向页面", "qrCodeType": "二维码类型" }, "action": { "confirm": "确认" }, "v": { "type": { "grant": "授予", "transfer": "转交" }, "qrCodeType": { "webForWechatPublic": "网站引流到公众号", "wechatMpDomainUrl": "小程序url码", "wechatMpWxaCode": "小程序码", "wechatPublic": "公众号关注码", "wechatPublicForMp": "公众号回复小程序码" } } }

View File

@ -1 +1 @@
{ "attr": { "user": "用户", "system": "系统" } }
{ "name": "用户系统", "attr": { "user": "用户", "system": "系统" } }

View File

@ -1 +1 @@
{ "attr": { "wechatPublicTag": "tag", "user": "用户", "sync": "同步状态", "syncAt": "同步时间" } }
{ "name": "用户公众号Tag", "attr": { "wechatPublicTag": "tag", "user": "用户", "sync": "同步状态", "syncAt": "同步时间" } }

View File

@ -1 +1 @@
{ "attr": { "text": "tag名", "application": "关联应用", "wechatId": "微信端id", "sync": "同步状态", "syncAt": "同步时间" } }
{ "name": "公众号标签", "attr": { "text": "tag名", "application": "关联应用", "wechatId": "微信端id", "sync": "同步状态", "syncAt": "同步时间" } }

View File

@ -1 +1 @@
{ "attr": { "entity": "关联对象", "entityId": "关联对象id", "type": "类型", "allowShare": "允许分享", "tag": "tag", "ticket": "ticket", "url": "url", "permanent": "是否永久码", "buffer": "小程序码数据(动态)", "expired": "是否过期", "expiresAt": "过期时间", "application": "应用", "props": "属性" }, "v": { "type": { "webForWechatPublic": "网站引流到公众号", "wechatMpDomainUrl": "小程序url码", "wechatMpWxaCode": "小程序码", "wechatPublic": "公众号关注码", "wechatPublicForMp": "公众号回复小程序码" } } }
{ "name": "微信识别码", "attr": { "entity": "关联对象", "entityId": "关联对象id", "type": "类型", "allowShare": "允许分享", "tag": "tag", "ticket": "ticket", "url": "url", "permanent": "是否永久码", "buffer": "小程序码数据(动态)", "expired": "是否过期", "expiresAt": "过期时间", "application": "应用", "props": "属性" }, "v": { "type": { "webForWechatPublic": "网站引流到公众号", "wechatMpDomainUrl": "小程序url码", "wechatMpWxaCode": "小程序码", "wechatPublic": "公众号关注码", "wechatPublicForMp": "公众号回复小程序码" } } }

View File

@ -1 +1 @@
{ "attr": { "origin": "源", "openId": "openId", "unionId": "unionId", "sessionKey": "sessionKey", "accessToken": "accessToken", "refreshToken": "refreshToken", "atExpiredAt": "accessToken过期时间", "rtExpiredAt": "refreshToken过期时间", "scope": "accessToken域", "subscribed": "是否订阅", "subscribedAt": "订阅时间", "unsubscribedAt": "取关时间", "user": "用户", "tokens": "相关令牌", "application": "应用", "nickname": "昵称", "avatar": "头像" }, "v": { "origin": { "mp": "小程序", "public": "公众号", "web": "网站" } } }
{ "name": "微信用户", "attr": { "origin": "源", "openId": "openId", "unionId": "unionId", "sessionKey": "sessionKey", "accessToken": "accessToken", "refreshToken": "refreshToken", "atExpiredAt": "accessToken过期时间", "rtExpiredAt": "refreshToken过期时间", "scope": "accessToken域", "subscribed": "是否订阅", "subscribedAt": "订阅时间", "unsubscribedAt": "取关时间", "user": "用户", "tokens": "相关令牌", "application": "应用", "nickname": "昵称", "avatar": "头像" }, "v": { "origin": { "mp": "小程序", "public": "公众号", "web": "网站" } } }

View File

@ -25,7 +25,7 @@ function Render(props) {
items.push({
label: '模板消息管理',
key: 'mttId',
children: (0, jsx_runtime_1.jsx)(list_1.default, { applicationId: oakId, oakPath: "$application-detail-mttId" })
children: ((0, jsx_runtime_1.jsx)(list_1.default, { oakAutoUnmount: true, applicationId: oakId, oakPath: "$application-detail-mttId-".concat(oakId) })),
});
}
return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ showBack: true, title: "\u5E94\u7528\u6982\u89C8" }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsx)(antd_1.Card, tslib_1.__assign({ title: name, bordered: false, actions: Actions }, { children: (0, jsx_runtime_1.jsx)(antd_1.Tabs, { items: items }) })) })) })));

View File

@ -7,12 +7,13 @@ var url_1 = require("oak-domain/lib/utils/url");
var uuid_1 = require("oak-domain/lib/utils/uuid");
var sms_1 = require("../utils/sms");
var message_1 = require("./message");
var domain_1 = require("../utils/domain");
function sendMessage(notification, context) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var data, templateId, channel, messageSystemId, data1, id, _a, messageSystem, _b, system, message, _c, router, userId, type, _d, applications, config, _e, app, config_1, _f, appId, appSecret, instance, page, StateDict, _g, _h, _j, err_1, _k, _l, _m, app, config_2, _o, appId, appSecret, instance, page, _p, openId, wechatMpAppId, _q, _r, _s, err_2, _t, _u, _v, _w, _x, _y, err_3, _z, _0, _1, err2_1, _2, _3, _4;
var _5, _6, _7, _8, _9, _10, _11;
return tslib_1.__generator(this, function (_12) {
switch (_12.label) {
var data, templateId, channel, messageSystemId, data1, id, _a, messageSystem, _b, system, message, _c, router, userId, type, _d, applications, config, _e, app, config_1, _f, appId, appSecret, instance, page, StateDict, _g, _h, _j, err_1, _k, _l, _m, app, _o, config_2, applicationId, _p, appId, appSecret, _q, domain, instance, _r, openId, wechatMpAppId, url, page, _s, _t, _u, err_2, _v, _w, _x, _y, _z, _0, err_3, _1, _2, _3, err2_1, _4, _5, _6;
var _7, _8, _9, _10, _11, _12, _13;
return tslib_1.__generator(this, function (_14) {
switch (_14.label) {
case 0:
data = notification.data, templateId = notification.templateId, channel = notification.channel, messageSystemId = notification.messageSystemId, data1 = notification.data1, id = notification.id;
return [4 /*yield*/, context.select('messageSystem', {
@ -42,7 +43,7 @@ function sendMessage(notification, context) {
}
}, { dontCollect: true })];
case 1:
_a = tslib_1.__read.apply(void 0, [_12.sent(), 1]), messageSystem = _a[0];
_a = tslib_1.__read.apply(void 0, [_14.sent(), 1]), messageSystem = _a[0];
_b = messageSystem, system = _b.system, message = _b.message;
_c = message, router = _c.router, userId = _c.userId, type = _c.type;
_d = system, applications = _d.application$system, config = _d.config;
@ -51,7 +52,7 @@ function sendMessage(notification, context) {
case 'wechatMp': return [3 /*break*/, 2];
case 'wechatPublic': return [3 /*break*/, 10];
}
return [3 /*break*/, 18];
return [3 /*break*/, 19];
case 2:
app = applications.find(function (ele) { return ele.type === 'wechatMp'; });
config_1 = app.config;
@ -63,9 +64,9 @@ function sendMessage(notification, context) {
'staging': 'trial',
'production': 'former',
};
_12.label = 3;
_14.label = 3;
case 3:
_12.trys.push([3, 7, , 10]);
_14.trys.push([3, 7, , 10]);
return [4 /*yield*/, instance.sendSubscribedMessage({
templateId: templateId,
data: data,
@ -74,48 +75,73 @@ function sendMessage(notification, context) {
state: StateDict[process.env.NODE_ENV],
})];
case 4:
_12.sent();
_14.sent();
_h = (_g = context).operate;
_j = ['notification'];
_5 = {};
_7 = {};
return [4 /*yield*/, (0, uuid_1.generateNewIdAsync)()];
case 5: return [4 /*yield*/, _h.apply(_g, _j.concat([(_5.id = _12.sent(),
_5.action = 'succeed',
_5.data = {},
_5.filter = {
case 5: return [4 /*yield*/, _h.apply(_g, _j.concat([(_7.id = _14.sent(),
_7.action = 'succeed',
_7.data = {},
_7.filter = {
id: id,
},
_5), { dontCollect: true }]))];
_7), { dontCollect: true }]))];
case 6:
_12.sent();
_14.sent();
return [2 /*return*/, 1];
case 7:
err_1 = _12.sent();
err_1 = _14.sent();
console.warn('发微信小程序消息失败', err_1);
_l = (_k = context).operate;
_m = ['notification'];
_6 = {};
_8 = {};
return [4 /*yield*/, (0, uuid_1.generateNewIdAsync)()];
case 8: return [4 /*yield*/, _l.apply(_k, _m.concat([(_6.id = _12.sent(),
_6.action = 'fail',
_6.data = {},
_6.filter = {
case 8: return [4 /*yield*/, _l.apply(_k, _m.concat([(_8.id = _14.sent(),
_8.action = 'fail',
_8.data = {},
_8.filter = {
id: id,
},
_6), { dontCollect: true }]))];
_8), { dontCollect: true }]))];
case 9:
_12.sent();
_14.sent();
return [2 /*return*/, 1];
case 10:
app = applications.find(function (ele) { return ele.type === 'wechatPublic'; });
config_2 = app.config;
_o = config_2, appId = _o.appId, appSecret = _o.appSecret;
instance = oak_external_sdk_1.WechatSDK.getInstance(appId, 'wechatPublic', appSecret);
page = (0, url_1.composeUrl)(router.pathname, Object.assign({}, router.props, router.state));
_p = data1, openId = _p.openId, wechatMpAppId = _p.wechatMpAppId;
_12.label = 11;
_o = app, config_2 = _o.config, applicationId = _o.id;
_p = config_2, appId = _p.appId, appSecret = _p.appSecret;
return [4 /*yield*/, context.select('domain', {
data: {
id: 1,
url: 1,
apiPath: 1,
protocol: 1,
port: 1,
},
filter: {
systemId: {
$in: {
entity: 'application',
data: {
systemId: 1,
},
filter: {
id: applicationId,
},
},
},
},
}, { dontCollect: true })];
case 11:
_12.trys.push([11, 15, , 18]);
_q = tslib_1.__read.apply(void 0, [_14.sent(), 1]), domain = _q[0];
instance = oak_external_sdk_1.WechatSDK.getInstance(appId, 'wechatPublic', appSecret);
_r = data1, openId = _r.openId, wechatMpAppId = _r.wechatMpAppId;
url = wechatMpAppId ? router.pathname : (0, domain_1.composeDomainUrl)(domain, router.pathname);
page = (0, url_1.composeUrl)(url, Object.assign({}, router.props, router.state));
_14.label = 12;
case 12:
_14.trys.push([12, 16, , 19]);
return [4 /*yield*/, instance.sendTemplateMessage({
openId: openId,
templateId: templateId,
@ -127,113 +153,113 @@ function sendMessage(notification, context) {
} : undefined,
clientMsgId: id,
})];
case 12:
_12.sent();
_r = (_q = context).operate;
_s = ['notification'];
_7 = {};
return [4 /*yield*/, (0, uuid_1.generateNewIdAsync)()];
case 13: return [4 /*yield*/, _r.apply(_q, _s.concat([(_7.id = _12.sent(),
_7.action = 'succeed',
_7.data = {},
_7.filter = {
id: id,
},
_7), { dontCollect: true }]))];
case 14:
_12.sent();
return [2 /*return*/, 1];
case 15:
err_2 = _12.sent();
console.warn('发微信公众号消息失败', err_2);
_u = (_t = context).operate;
_v = ['notification'];
_8 = {};
return [4 /*yield*/, (0, uuid_1.generateNewIdAsync)()];
case 16: return [4 /*yield*/, _u.apply(_t, _v.concat([(_8.id = _12.sent(),
_8.action = 'fail',
_8.data = {},
_8.filter = {
id: id,
},
_8), { dontCollect: true }]))];
case 17:
_12.sent();
return [2 /*return*/, 1];
case 18:
(0, assert_1.assert)(channel === 'sms');
_12.label = 19;
case 19:
_12.trys.push([19, 23, , 32]);
return [4 /*yield*/, (0, sms_1.sendSms)({
origin: 'ali',
templateName: type,
templateParamSet: data.params,
mobile: data1.mobile,
}, context)];
case 20:
_12.sent();
_x = (_w = context).operate;
_y = ['notification'];
case 13:
_14.sent();
_t = (_s = context).operate;
_u = ['notification'];
_9 = {};
return [4 /*yield*/, (0, uuid_1.generateNewIdAsync)()];
case 21: return [4 /*yield*/, _x.apply(_w, _y.concat([(_9.id = _12.sent(),
case 14: return [4 /*yield*/, _t.apply(_s, _u.concat([(_9.id = _14.sent(),
_9.action = 'succeed',
_9.data = {},
_9.filter = {
id: id,
},
_9), { dontCollect: true }]))];
case 22:
_12.sent();
case 15:
_14.sent();
return [2 /*return*/, 1];
case 16:
err_2 = _14.sent();
console.warn('发微信公众号消息失败', err_2);
_w = (_v = context).operate;
_x = ['notification'];
_10 = {};
return [4 /*yield*/, (0, uuid_1.generateNewIdAsync)()];
case 17: return [4 /*yield*/, _w.apply(_v, _x.concat([(_10.id = _14.sent(),
_10.action = 'fail',
_10.data = {},
_10.filter = {
id: id,
},
_10), { dontCollect: true }]))];
case 18:
_14.sent();
return [2 /*return*/, 1];
case 19:
(0, assert_1.assert)(channel === 'sms');
_14.label = 20;
case 20:
_14.trys.push([20, 24, , 33]);
return [4 /*yield*/, (0, sms_1.sendSms)({
origin: 'ali',
templateName: type,
templateParamSet: data.params,
mobile: data1.mobile,
}, context)];
case 21:
_14.sent();
_z = (_y = context).operate;
_0 = ['notification'];
_11 = {};
return [4 /*yield*/, (0, uuid_1.generateNewIdAsync)()];
case 22: return [4 /*yield*/, _z.apply(_y, _0.concat([(_11.id = _14.sent(),
_11.action = 'succeed',
_11.data = {},
_11.filter = {
id: id,
},
_11), { dontCollect: true }]))];
case 23:
err_3 = _12.sent();
console.warn('发tencent sms消息失败', err_3);
_12.label = 24;
_14.sent();
return [2 /*return*/, 1];
case 24:
_12.trys.push([24, 28, , 31]);
err_3 = _14.sent();
console.warn('发tencent sms消息失败', err_3);
_14.label = 25;
case 25:
_14.trys.push([25, 29, , 32]);
return [4 /*yield*/, (0, sms_1.sendSms)({
origin: 'tencent',
templateName: type,
templateParamSet: data.paramsArray,
mobile: data1.mobile,
}, context)];
case 25:
_12.sent();
_0 = (_z = context).operate;
_1 = ['notification'];
_10 = {};
case 26:
_14.sent();
_2 = (_1 = context).operate;
_3 = ['notification'];
_12 = {};
return [4 /*yield*/, (0, uuid_1.generateNewIdAsync)()];
case 26: return [4 /*yield*/, _0.apply(_z, _1.concat([(_10.id = _12.sent(),
_10.action = 'succeed',
_10.data = {},
_10.filter = {
case 27: return [4 /*yield*/, _2.apply(_1, _3.concat([(_12.id = _14.sent(),
_12.action = 'succeed',
_12.data = {},
_12.filter = {
id: id,
},
_10), { dontCollect: true }]))];
case 27:
_12.sent();
return [2 /*return*/, 1];
_12), { dontCollect: true }]))];
case 28:
err2_1 = _12.sent();
_14.sent();
return [2 /*return*/, 1];
case 29:
err2_1 = _14.sent();
console.warn('发aliyun sms消息失败', err2_1);
_3 = (_2 = context).operate;
_4 = ['notification'];
_11 = {};
_5 = (_4 = context).operate;
_6 = ['notification'];
_13 = {};
return [4 /*yield*/, (0, uuid_1.generateNewIdAsync)()];
case 29: return [4 /*yield*/, _3.apply(_2, _4.concat([(_11.id = _12.sent(),
_11.action = 'fail',
_11.data = {},
_11.filter = {
case 30: return [4 /*yield*/, _5.apply(_4, _6.concat([(_13.id = _14.sent(),
_13.action = 'fail',
_13.data = {},
_13.filter = {
id: id,
},
_11), { dontCollect: true }]))];
case 30:
_12.sent();
_13), { dontCollect: true }]))];
case 31:
_14.sent();
return [2 /*return*/, 1];
case 31: return [3 /*break*/, 32];
case 32: return [2 /*return*/];
case 32: return [3 /*break*/, 33];
case 33: return [2 /*return*/];
}
});
});

View File

@ -96,8 +96,14 @@ export default function Render(
items.push({
label: '模板消息管理',
key: 'mttId',
children: <MessageTypeTemplateIdList applicationId={oakId} oakPath="$application-detail-mttId"/>
})
children: (
<MessageTypeTemplateIdList
oakAutoUnmount={true}
applicationId={oakId}
oakPath={`$application-detail-mttId-${oakId}`}
/>
),
});
}
return (

View File

@ -10,6 +10,7 @@ import { composeUrl } from 'oak-domain/lib/utils/url';
import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
import { sendSms } from '../utils/sms';
import { tryMakeSmsNotification } from './message';
import { composeDomainUrl } from '../utils/domain';
async function sendMessage(notification: CreateNotificationData, context: BackendRuntimeContext<EntityDict>) {
const { data, templateId, channel, messageSystemId, data1, id } = notification;
@ -94,14 +95,45 @@ async function sendMessage(notification: CreateNotificationData, context: Backen
const app = applications!.find(
ele => ele.type === 'wechatPublic'
);
const { config } = app!;
const { config, id: applicationId } = app!;
const { appId, appSecret } = config as WechatPublicConfig;
const [domain] = await context.select(
'domain',
{
data: {
id: 1,
url: 1,
apiPath: 1,
protocol: 1,
port: 1,
},
filter: {
systemId: {
$in: {
entity: 'application',
data: {
systemId: 1,
},
filter: {
id: applicationId,
},
},
},
},
},
{ dontCollect: true }
);
const instance = WechatSDK.getInstance(appId!, 'wechatPublic', appSecret) as WechatPublicInstance;
const page = composeUrl(router!.pathname!, Object.assign({}, router!.props!, router!.state!));
const { openId, wechatMpAppId } = data1 as {
openId: string,
wechatMpAppId?: string,
};
const url = wechatMpAppId ? router!.pathname! : composeDomainUrl(domain as EntityDict['domain']['Schema'], router!.pathname!);
const page = composeUrl(
url,
Object.assign({}, router!.props!, router!.state!)
);
try {
await instance.sendTemplateMessage({