重新定义了message的格式

This commit is contained in:
Xu Chang 2022-12-12 12:08:50 +08:00
parent d245a42d90
commit 1b502d4911
95 changed files with 250 additions and 119 deletions

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import './index.less';
declare const Empty: () => JSX.Element;
export default Empty;

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import './index.less';
declare const Empty: () => JSX.Element;
export default Empty;

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import './index.less';
interface QrCodeProps {
id?: string;

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { AppType, WebConfig, WechatPublicConfig, WechatMpConfig } from '../../../general-app-domain/Application/Schema';
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebConfig } from '../../../../general-app-domain/Application/Schema';
export default function Web(props: {
config: WebConfig;

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WechatMpConfig } from '../../../../general-app-domain/Application/Schema';
export default function WechatMp(props: {
config: WechatMpConfig;

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WechatPublicConfig } from '../../../../general-app-domain/Application/Schema';
export default function WechatPublic(props: {
config: WechatPublicConfig;

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { Config } from '../../../../types/Config';
export default function Account(props: {
account: Required<Config>['Account'];

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { Config } from '../../../../types/Config';
export default function Cos(props: {
cos: Required<Config>['Cos'];

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { Config } from '../../../../types/Config';
export default function Cos(props: {
live: Required<Config>['Live'];

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { Config } from '../../../../types/Config';
export default function Cos(props: {
map: Required<Config>['Map'];

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { Config } from '../../../types/Config';
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1 +1,2 @@
/// <reference types="react" />
export default function render(): JSX.Element;

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { UploadFile } from 'antd';
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebComponentProps } from "oak-frontend-base";
import { EntityDict } from "../../../general-app-domain";
export default function Render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'address', true, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../general-app-domain';
import './web.less';

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { MessageProps } from 'oak-frontend-base/lib/types/Message';
export default function render(props: {
data: {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'userEntityGrant', true, {

View File

@ -18,10 +18,7 @@ export declare type WebConfig = {
};
passport: Passport[];
};
export declare type WechatPublicTemplateMsgsConfig = Record<string, {
templateId: string;
dataDef: [string, string][];
}>;
export declare type WechatPublicTemplateMsgsConfig = Record<string, string>;
export declare type WechatPublicConfig = {
type: 'wechatPublic';
isService: boolean;

View File

@ -1,14 +1,21 @@
import { Text } from 'oak-domain/lib/types/DataType';
import { String, Text } from 'oak-domain/lib/types/DataType';
import { Schema as User } from './User';
import { Schema as System } from './System';
import { EntityShape } from 'oak-domain/lib/types/Entity';
declare type MesageParams = {
pathname: string;
props: Record<string, any>;
state: Record<string, any>;
};
export interface Schema extends EntityShape {
user: User;
system: System;
type: 'adminNotification' | 'conversationMessage';
type: String<16>;
weight: 'high' | 'medium' | 'low' | 'data';
desc: Text;
title: String<32>;
content: Text;
props: Object;
data: Object;
params: Object;
params?: MesageParams;
}
export {};

View File

@ -8,15 +8,23 @@ var IActionDef = {
},
is: 'sending',
};
var VisitActionDef = {
stm: {
visit: ['unvisited', 'visited'],
},
is: 'unvisited',
};
var locale = {
zh_CN: {
attr: {
desc: '描述',
title: '标题',
content: '内容',
user: '关联用户',
system: '系统',
type: '消息类型',
weight: '优先级',
iState: '状态',
iState: '发送状态',
visitState: '访问状态',
props: '属性',
params: '渠道定制参数',
data: '透传数据',
@ -24,6 +32,7 @@ var locale = {
action: {
succeed: '成功',
fail: '失败',
visit: '阅读',
},
v: {
iState: {
@ -31,6 +40,10 @@ var locale = {
success: '发送成功',
failure: '发送失败',
},
visitState: {
unvisited: '未读',
visited: '已读',
},
weight: {
high: '高',
medium: '中',

View File

@ -14,6 +14,7 @@ import { EntityDef as ExtraFile } from "./ExtraFile/Schema";
import { EntityDef as Livestream } from "./Livestream/Schema";
import { EntityDef as Message } from "./Message/Schema";
import { EntityDef as MessageSent } from "./MessageSent/Schema";
import { EntityDef as MessageType } from "./MessageType/Schema";
import { EntityDef as Mobile } from "./Mobile/Schema";
import { EntityDef as Platform } from "./Platform/Schema";
import { EntityDef as UserRole } from "./UserRole/Schema";
@ -41,6 +42,7 @@ export declare type EntityDict = {
livestream: Livestream;
message: Message;
messageSent: MessageSent;
messageType: MessageType;
mobile: Mobile;
platform: Platform;
userRole: UserRole;

View File

@ -21,7 +21,7 @@ export declare type OpSchema = EntityShape & {
extension: String<16>;
size?: Int<4> | null;
sort?: Int<4> | null;
fileType: String<128>;
fileType: String<16>;
};
export declare type OpAttr = keyof OpSchema;
export declare type Schema = EntityShape & {
@ -39,7 +39,7 @@ export declare type Schema = EntityShape & {
extension: String<16>;
size?: Int<4> | null;
sort?: Int<4> | null;
fileType: String<128>;
fileType: String<16>;
article?: Article.Schema;
user?: User.Schema;
} & {

View File

@ -87,7 +87,7 @@ exports.desc = {
fileType: {
type: "varchar",
params: {
length: 128
length: 16
}
}
},

View File

@ -1,4 +1,4 @@
import { String, Text, ForeignKey } from "oak-domain/lib/types/DataType";
import { String, ForeignKey } from "oak-domain/lib/types/DataType";
import { Q_DateValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "oak-domain/lib/types/Demand";
import { OneOf } from "oak-domain/lib/types/Polyfill";
import * as SubQuery from "../_SubQuery";
@ -10,9 +10,8 @@ import * as MessageSent from "../MessageSent/Schema";
export declare type OpSchema = EntityShape & {
userId: ForeignKey<"user">;
systemId: ForeignKey<"system">;
type: 'adminNotification' | 'conversationMessage';
type: 'adminNotification';
weight: 'high' | 'medium' | 'low' | 'data';
desc: Text;
props: Object;
data: Object;
params: Object;
@ -22,9 +21,8 @@ export declare type OpAttr = keyof OpSchema;
export declare type Schema = EntityShape & {
userId: ForeignKey<"user">;
systemId: ForeignKey<"system">;
type: 'adminNotification' | 'conversationMessage';
type: 'adminNotification';
weight: 'high' | 'medium' | 'low' | 'data';
desc: Text;
props: Object;
data: Object;
params: Object;
@ -44,9 +42,8 @@ declare type AttrFilter = {
user: User.Filter;
systemId: Q_StringValue | SubQuery.SystemIdSubQuery;
system: System.Filter;
type: Q_EnumValue<'adminNotification' | 'conversationMessage'>;
type: Q_EnumValue<'adminNotification'>;
weight: Q_EnumValue<'high' | 'medium' | 'low' | 'data'>;
desc: Q_StringValue;
props: Object;
data: Object;
params: Object;
@ -66,7 +63,6 @@ export declare type Projection = {
system?: System.Projection;
type?: number;
weight?: number;
desc?: number;
props?: number;
data?: number;
params?: number;
@ -88,7 +84,6 @@ export declare type ExportProjection = {
system?: System.ExportProjection;
type?: string;
weight?: string;
desc?: string;
props?: string;
data?: string;
params?: string;
@ -126,8 +121,6 @@ export declare type SortAttr = {
type: number;
} | {
weight: number;
} | {
desc: number;
} | {
iState: number;
} | {

View File

@ -24,9 +24,6 @@ exports.desc = {
length: 24
}
},
desc: {
type: "text"
},
props: {
type: "object"
},

View File

@ -1 +1 @@
{ "attr": { "desc": "描述", "user": "关联用户", "system": "系统", "type": "消息类型", "weight": "优先级", "iState": "状态", "props": "属性", "params": "渠道定制参数", "data": "透传数据" }, "action": { "succeed": "成功", "fail": "失败" }, "v": { "iState": { "sending": "发送中", "success": "发送成功", "failure": "发送失败" }, "weight": { "high": "高", "medium": "中", "low": "低", "data": "数据" }, "type": { "adminNotification": "系统通知", "conversationMessage": "客服消息" } } }
{ "attr": { "user": "关联用户", "system": "系统", "type": "消息类型", "weight": "优先级", "iState": "状态", "props": "属性", "params": "渠道定制参数", "data": "透传数据" }, "action": { "succeed": "成功", "fail": "失败" }, "v": { "iState": { "sending": "发送中", "success": "发送成功", "failure": "发送失败" }, "weight": { "high": "高", "medium": "中", "low": "低", "data": "数据" }, "type": { "adminNotification": "管理员通知" } } }

View File

@ -17,16 +17,17 @@ var Storage_13 = require("./ExtraFile/Storage");
var Storage_14 = require("./Livestream/Storage");
var Storage_15 = require("./Message/Storage");
var Storage_16 = require("./MessageSent/Storage");
var Storage_17 = require("./Mobile/Storage");
var Storage_18 = require("./Platform/Storage");
var Storage_19 = require("./UserRole/Storage");
var Storage_20 = require("./Role/Storage");
var Storage_21 = require("./System/Storage");
var Storage_22 = require("./Token/Storage");
var Storage_23 = require("./UserEntityGrant/Storage");
var Storage_24 = require("./UserSystem/Storage");
var Storage_25 = require("./WechatQrCode/Storage");
var Storage_26 = require("./WechatUser/Storage");
var Storage_17 = require("./MessageType/Storage");
var Storage_18 = require("./Mobile/Storage");
var Storage_19 = require("./Platform/Storage");
var Storage_20 = require("./UserRole/Storage");
var Storage_21 = require("./Role/Storage");
var Storage_22 = require("./System/Storage");
var Storage_23 = require("./Token/Storage");
var Storage_24 = require("./UserEntityGrant/Storage");
var Storage_25 = require("./UserSystem/Storage");
var Storage_26 = require("./WechatQrCode/Storage");
var Storage_27 = require("./WechatUser/Storage");
exports.storageSchema = {
modi: Storage_1.desc,
modiEntity: Storage_2.desc,
@ -44,14 +45,15 @@ exports.storageSchema = {
livestream: Storage_14.desc,
message: Storage_15.desc,
messageSent: Storage_16.desc,
mobile: Storage_17.desc,
platform: Storage_18.desc,
userRole: Storage_19.desc,
role: Storage_20.desc,
system: Storage_21.desc,
token: Storage_22.desc,
userEntityGrant: Storage_23.desc,
userSystem: Storage_24.desc,
wechatQrCode: Storage_25.desc,
wechatUser: Storage_26.desc
messageType: Storage_17.desc,
mobile: Storage_18.desc,
platform: Storage_19.desc,
userRole: Storage_20.desc,
role: Storage_21.desc,
system: Storage_22.desc,
token: Storage_23.desc,
userEntityGrant: Storage_24.desc,
userSystem: Storage_25.desc,
wechatQrCode: Storage_26.desc,
wechatUser: Storage_27.desc
};

View File

@ -14,6 +14,7 @@ import * as ExtraFile from "./ExtraFile/Schema";
import * as Livestream from "./Livestream/Schema";
import * as Message from "./Message/Schema";
import * as MessageSent from "./MessageSent/Schema";
import * as MessageType from "./MessageType/Schema";
import * as Mobile from "./Mobile/Schema";
import * as Platform from "./Platform/Schema";
import * as UserRole from "./UserRole/Schema";
@ -140,6 +141,11 @@ export declare type MessageSentIdSubQuery = {
entity: "messageSent";
}) | any;
};
export declare type MessageTypeIdSubQuery = {
[K in "$in" | "$nin"]?: (MessageType.MessageTypeIdSubQuery & {
entity: "messageType";
}) | any;
};
export declare type MobileIdSubQuery = {
[K in "$in" | "$nin"]?: (Mobile.MobileIdSubQuery & {
entity: "mobile";

3
lib/index.d.ts vendored
View File

@ -4,7 +4,8 @@ import checkers from './checkers';
import watchers from './watchers';
import data from "./data";
export * from './exceptionHandlers';
export { checkers, triggers, watchers, data, aspectDict, };
import { registerMessagePropsConverter } from './triggers/message';
export { checkers, triggers, watchers, data, aspectDict, registerMessagePropsConverter, };
export * from './types/Exception';
export { composeFileUrl, decomposeFileUrl } from './utils/extraFile';
export * from './data/DEV-CONFIG';

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.decomposeFileUrl = exports.composeFileUrl = exports.aspectDict = exports.data = exports.watchers = exports.triggers = exports.checkers = void 0;
exports.decomposeFileUrl = exports.composeFileUrl = exports.registerMessagePropsConverter = exports.aspectDict = exports.data = exports.watchers = exports.triggers = exports.checkers = void 0;
var tslib_1 = require("tslib");
var aspects_1 = require("./aspects");
Object.defineProperty(exports, "aspectDict", { enumerable: true, get: function () { return aspects_1.aspectDict; } });
@ -13,6 +13,8 @@ exports.watchers = watchers_1.default;
var data_1 = tslib_1.__importDefault(require("./data"));
exports.data = data_1.default;
tslib_1.__exportStar(require("./exceptionHandlers"), exports);
var message_1 = require("./triggers/message");
Object.defineProperty(exports, "registerMessagePropsConverter", { enumerable: true, get: function () { return message_1.registerMessagePropsConverter; } });
tslib_1.__exportStar(require("./types/Exception"), exports);
var extraFile_1 = require("./utils/extraFile");
Object.defineProperty(exports, "composeFileUrl", { enumerable: true, get: function () { return extraFile_1.composeFileUrl; } });

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'address', true, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'address', false, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { AppType, WebConfig, WechatPublicConfig, WechatMpConfig } from '../../../../general-app-domain/Application/Schema';
import { EntityDict } from '../../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebConfig, WechatPublicConfig, WechatMpConfig } from '../../../general-app-domain/Application/Schema';
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'application', true, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'application', false, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from './../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'article', false, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'article', true, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'article', false, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import '@wangeditor/editor/dist/css/style.css';
import { EntityDict } from './../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'domain', false, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'system', true, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'domain', false, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'token', false, {

View File

@ -1 +1,2 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element;

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'mobile', true, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'area', true, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { Config } from '../../../../types/Config';
import { EntityDict } from '../../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { Config } from '../../../types/Config';
import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'platform', true, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'platform', false, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../../general-app-domain';
import { Config } from '../../../../types/Config';
import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { Config } from '../../../types/Config';
import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'system', true, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'system', false, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'token', true, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'user', true, {

View File

@ -1 +1,2 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element;

View File

@ -1 +1,2 @@
/// <reference types="react" />
export default function render(): JSX.Element;

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'userEntityGrant', true, {

View File

@ -1 +1,2 @@
/// <reference types="react" />
export default function Render(props: any): JSX.Element;

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'userEntityGrant', true, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'token', false, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'userEntityGrant', true, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', true, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', true, {

View File

@ -1 +1,2 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element;

View File

@ -1 +1,2 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element;

View File

@ -1 +1,2 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element;

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'mobile', false, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1 +1,2 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element;

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'userEntityGrant', false, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1 +1,2 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element;

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1 +1,2 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element;

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'token', false, {

View File

@ -1,3 +1,4 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'token', false, {

View File

@ -1,6 +1,10 @@
import { Trigger } from 'oak-domain/lib/types/Trigger';
import { EntityDict } from '../general-app-domain/EntityDict';
import { RuntimeCxt } from '../types/RuntimeCxt';
export declare const MessageDisperse: {};
import { MessagePropsToSms, MessagePropsToWechat } from '../types/Message';
export declare function registerMessagePropsConverter(converter: {
sms?: MessagePropsToSms;
wechat?: MessagePropsToWechat;
}): void;
declare const triggers: Trigger<EntityDict, 'message', RuntimeCxt>[];
export default triggers;

View File

@ -1,34 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MessageDisperse = void 0;
exports.registerMessagePropsConverter = void 0;
var tslib_1 = require("tslib");
var assert_1 = require("oak-domain/lib/utils/assert");
exports.MessageDisperse = {
// [1]: {
// conversationMessage: {
// public: (message: CreateMessageData) => {
// return message;
// }
// },
// adminNotification: {
// public: (message: CreateMessageData) => {
// return message;
// }
// },
// },
// [10]: {
// conversationMessage: {
// public: (message: CreateMessageData) => {
// return message;
// }
// },
// adminNotification: {
// public: (message: CreateMessageData) => {
// return message;
// }
// },
// }
};
var SmsCoverter;
var WechatConverter;
function registerMessagePropsConverter(converter) {
var sms = converter.sms, wechat = converter.wechat;
SmsCoverter = sms;
WechatConverter = wechat;
}
exports.registerMessagePropsConverter = registerMessagePropsConverter;
function tryAddMessageSent(message, channel, context) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {

21
lib/types/Message.d.ts vendored Normal file
View File

@ -0,0 +1,21 @@
export declare type MessagePropsToSms = (type: string, props: Record<string, any>) => {
signName?: string;
params?: Record<string, string>;
} | undefined;
declare type WechatKeywordNum = 'keyword1' | 'keyword2' | 'keyword3' | 'keyword4' | 'keyword5' | 'keyword6' | 'keyword7';
export declare type MessagePropsToWechat = (type: string, props: Record<string, any>, appId?: string) => ({
first?: {
value: string;
color?: string;
};
remark?: {
value: string;
color?: string;
};
} & {
[K in WechatKeywordNum]?: {
value: string;
color?: string;
};
}) | undefined;
export {};

2
lib/types/Message.js Normal file
View File

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@ -22,10 +22,7 @@ export type WebConfig = {
passport: Passport[];
};
export type WechatPublicTemplateMsgsConfig = Record<string, {
templateId: string;
dataDef: [string, string][]; // 前一个代表keyword后一个代表color
}>; // key值代表messageTypeId
export type WechatPublicTemplateMsgsConfig = Record<string, string>; // key值代表messageTypeIdvalue的值代表对应的templateIddata的转换改成message上的函数注入
export type WechatPublicConfig = {
type: 'wechatPublic';

View File

@ -6,22 +6,31 @@ import { LocaleDef } from 'oak-domain/lib/types/Locale';
import { Index, ActionDef } from 'oak-domain/lib/types';
type MessageType = 'adminNotification';
type MesageParams = {
pathname: string;
props: Record<string, any>;
state: Record<string, any>;
};
export interface Schema extends EntityShape {
user: User;
system: System;
type: 'adminNotification' | 'conversationMessage';
type: String<16>;
weight: 'high' | 'medium' | 'low' | 'data';
desc: Text;
props: Object;
data: Object;
params: Object;
title: String<32>;
content: Text;
props: Object; // 消息的结构化数据(用于向各个渠道推送时的格式化)
data: Object; // 透传到前台的数据OpRecords
params?: MesageParams; // 通知前端需要到达的路由
};
type IAction = 'succeed' | 'fail';
type IState = 'sending' | 'success' | 'failure';
type Action = IAction;
type VisitState = 'unvisited' | 'visited';
type VisitAction = 'visit';
type Action = IAction | VisitAction;
const IActionDef: ActionDef<IAction, IState> = {
stm: {
@ -31,11 +40,19 @@ const IActionDef: ActionDef<IAction, IState> = {
is: 'sending',
};
const VisitActionDef: ActionDef<VisitAction, VisitState> = {
stm: {
visit: ['unvisited', 'visited'],
},
is: 'unvisited',
};
const locale: LocaleDef<
Schema,
Action,
'',
{
visitState: VisitState,
iState: IState;
weight: Schema['weight'];
type: Schema['type'];
@ -43,12 +60,14 @@ const locale: LocaleDef<
> = {
zh_CN: {
attr: {
desc: '描述',
title: '标题',
content: '内容',
user: '关联用户',
system: '系统',
type: '消息类型',
weight: '优先级',
iState: '状态',
iState: '发送状态',
visitState: '访问状态',
props: '属性',
params: '渠道定制参数',
data: '透传数据',
@ -56,6 +75,7 @@ const locale: LocaleDef<
action: {
succeed: '成功',
fail: '失败',
visit: '阅读',
},
v: {
iState: {
@ -63,6 +83,10 @@ const locale: LocaleDef<
success: '发送成功',
failure: '发送失败',
},
visitState: {
unvisited: '未读',
visited: '已读',
},
weight: {
high: '高',
medium: '中',

View File

@ -4,6 +4,7 @@ import checkers from './checkers';
import watchers from './watchers';
import data from "./data";
export * from './exceptionHandlers';
import { registerMessagePropsConverter } from './triggers/message';
export {
checkers,
@ -11,6 +12,7 @@ export {
watchers,
data,
aspectDict,
registerMessagePropsConverter,
};
export * from './types/Exception';

View File

@ -16,6 +16,5 @@
<l-list title="用户状态" tag-context="{{idState}}"/>
</view>
<view style="flex:1" />
<l-button theme="primary" style="margin: 16rpx" block size="large" bind:tap="openDrawer" content="更多" />
</view>
<actionPanel show="{{show}}" bind:close="closeDrawer" actions="{{oakLegalActions}}" actionDescriptions="{{actionDescriptions}}" bind:click="onActionClick" />
<actionPanel actions="{{oakLegalActions}}" actionDescriptions="{{actionDescriptions}}" bind:click="onActionClick" />
</view>

View File

@ -7,34 +7,21 @@ import { RuntimeCxt } from '../types/RuntimeCxt';
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
import { Schema as MessageSentSchema } from '../entities/MessageSent';
import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
import { MessagePropsToSms, MessagePropsToWechat } from '../types/Message';
export const MessageDisperse = {
// [1]: {
// conversationMessage: {
// public: (message: CreateMessageData) => {
// return message;
// }
// },
// adminNotification: {
// public: (message: CreateMessageData) => {
// return message;
// }
// },
// },
// [10]: {
// conversationMessage: {
// public: (message: CreateMessageData) => {
// return message;
// }
// },
// adminNotification: {
// public: (message: CreateMessageData) => {
// return message;
// }
// },
// }
let SmsCoverter: MessagePropsToSms | undefined;
let WechatConverter: MessagePropsToWechat | undefined;
export function registerMessagePropsConverter(converter: {
sms?: MessagePropsToSms;
wechat?: MessagePropsToWechat
}) {
const { sms, wechat } = converter;
SmsCoverter = sms;
WechatConverter = wechat;
}
async function tryAddMessageSent(message: CreateMessageData, channel: MessageSentSchema['channel'], context: BackendRuntimeContext<EntityDict>) {
// const { systemId, type } = message;
// const disperse = MessageDisperse && MessageDisperse[systemId] && MessageDisperse[systemId][type] && MessageDisperse[systemId][type][channel];

View File

@ -49,7 +49,7 @@ export type AliSmsConfig = {
templates: Record<string, {
signName?: string;
code: string; // templateCode
params: string[]; // templateParams中的key值(和messageType中的参数位置对应)
params: string[]; // templateParams中的key值(和message props中的参数位置对应)
}>;
};

22
src/types/Message.ts Normal file
View File

@ -0,0 +1,22 @@
export type MessagePropsToSms = (type: string, props: Record<string, any>) => {
signName?: string; // 可能的签名
params?: Record<string, string>; // 模板参数,需要替换的参数名和 value 的键值对
} | undefined;
type WechatKeywordNum = 'keyword1' | 'keyword2' | 'keyword3'| 'keyword4'| 'keyword5'| 'keyword6'| 'keyword7';
export type MessagePropsToWechat = (type: string, props: Record<string, any>, appId?: string) => ({
first?: {
value: string;
color?: string;
};
remark?: {
value: string;
color?: string;
};
} & {
[K in WechatKeywordNum]?: {
value: string;
color?: string;
};
}) | undefined;