diff --git a/lib/data/i18n.js b/lib/data/i18n.js index f8f6f23d1..32c3259d3 100644 --- a/lib/data/i18n.js +++ b/lib/data/i18n.js @@ -255,11 +255,11 @@ var i18ns = [ } }, { - id: "7a96eb13e533aeab2eba87643ed834b3", - namespace: "oak-general-business-l-Common", + id: "e07ce685f0383e7f7f3ce86501567f28", + namespace: "oak-general-business-l-common", language: "zh-CN", module: "oak-general-business", - position: "locales/Common", + position: "locales/common", data: { "noData": "暂无数据", "areYouSure": "请确认", diff --git a/lib/oak-app-domain/I18n/Schema.d.ts b/lib/oak-app-domain/I18n/Schema.d.ts index 812d0c3a4..038a3c5b0 100644 --- a/lib/oak-app-domain/I18n/Schema.d.ts +++ b/lib/oak-app-domain/I18n/Schema.d.ts @@ -1,7 +1,7 @@ import { Q_DateValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "oak-domain/lib/types/Demand"; import { OneOf } from "oak-domain/lib/types/Polyfill"; import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction } from "oak-domain/lib/types/Entity"; -import { GenericAction } from "oak-domain/lib/actions/action"; +import { ReadOnlyAction } from "oak-domain/lib/actions/action"; import { String } from "oak-domain/lib/types/DataType"; import { EntityShape } from "oak-domain/lib/types/Entity"; export declare type OpSchema = EntityShape & { @@ -91,7 +91,7 @@ export declare type I18nIdSubQuery = Selection; export declare type EntityDef = { Schema: Schema; OpSchema: OpSchema; - Action: OakMakeAction | string; + Action: OakMakeAction | string; Selection: Selection; Aggregation: Aggregation; Operation: Operation; diff --git a/lib/oak-app-domain/I18n/Storage.js b/lib/oak-app-domain/I18n/Storage.js index 049ea7099..70f4c3a10 100644 --- a/lib/oak-app-domain/I18n/Storage.js +++ b/lib/oak-app-domain/I18n/Storage.js @@ -37,6 +37,23 @@ exports.desc = { type: "object" } }, - actionType: "crud", - actions: action_1.genericActions + static: true, + actionType: "readOnly", + actions: action_1.readOnlyActions, + indexes: [ + { + name: 'namespace_language', + attributes: [ + { + name: 'namespace' + }, + { + name: 'language' + } + ], + config: { + unique: true + } + } + ] }; diff --git a/lib/triggers/message.js b/lib/triggers/message.js index 087d32af2..907db849d 100644 --- a/lib/triggers/message.js +++ b/lib/triggers/message.js @@ -63,7 +63,7 @@ function tryMakeSmsNotification(message, context) { exports.tryMakeSmsNotification = tryMakeSmsNotification; function createNotification(message, context) { return tslib_1.__awaiter(this, void 0, void 0, function () { - var restriction, userId, weight, type, entity, entityId, application, platformId, userSystems, systems, messageTypeTemplateIds, channels, messageSentCount, messageSystemDatas, _a; + var restriction, userId, weight, type, entity, entityId, application, platformId, systemId, filter, userSystems, systems, messageTypeTemplateIds, channels, messageSentCount, messageSystemDatas, _a; var _b; var _this = this; return tslib_1.__generator(this, function (_c) { @@ -73,6 +73,19 @@ function createNotification(message, context) { (0, assert_1.assert)(userId); application = context.getApplication(); platformId = application.system.platformId; + systemId = application.systemId; + filter = { + userId: userId, + }; + if (platformId) { + filter.system = { + platformId: platformId, + }; + } + else { + (0, assert_1.assert)(systemId); + filter.systemId = systemId; + } return [4 /*yield*/, context.select('userSystem', { data: { id: 1, @@ -89,12 +102,7 @@ function createNotification(message, context) { }, }, }, - filter: { - userId: userId, - system: { - platformId: platformId, - } - }, + filter: filter, }, { dontCollect: true })]; case 1: userSystems = _c.sent(); diff --git a/src/data/i18n.ts b/src/data/i18n.ts index 4b36b0905..3df0f324e 100644 --- a/src/data/i18n.ts +++ b/src/data/i18n.ts @@ -255,11 +255,11 @@ const i18ns: I18n[] = [ } }, { - id: "7a96eb13e533aeab2eba87643ed834b3", - namespace: "oak-general-business-l-Common", + id: "e07ce685f0383e7f7f3ce86501567f28", + namespace: "oak-general-business-l-common", language: "zh-CN", module: "oak-general-business", - position: "locales/Common", + position: "locales/common", data: { "noData": "暂无数据", "areYouSure": "请确认", diff --git a/src/triggers/message.ts b/src/triggers/message.ts index 000178b3f..fac3ff533 100644 --- a/src/triggers/message.ts +++ b/src/triggers/message.ts @@ -61,9 +61,22 @@ async function createNotification(message: CreateMessageData, context: BRC) { const { restriction, userId, weight, type, entity, entityId } = message; assert(userId); - // 根据用户所关联的system和定义限制,选择将要发送的system。一般来说不可能跨platform + // 根据用户所关联的system和定义限制,选择将要发送的system。这里有的应用是到platform级别,有的是到system级别 const application = context.getApplication(); const platformId = application!.system!.platformId!; + const systemId = application!.systemId; + const filter: EntityDict['userSystem']['Selection']['filter'] = { + userId, + }; + if (platformId) { + filter.system = { + platformId, + }; + } + else { + assert(systemId); + filter.systemId = systemId; + } const userSystems = await context.select('userSystem', { data: { id: 1, @@ -80,12 +93,7 @@ async function createNotification(message: CreateMessageData, context: BRC) { }, }, }, - filter: { - userId, - system: { - platformId, - } - }, + filter, }, { dontCollect: true }); // 这里实测线上跑出来多条相同的userSystem,还未知道原因 by Xc 20230317