编译后代码
This commit is contained in:
parent
0f475035ea
commit
c1511a03a0
|
|
@ -4,6 +4,7 @@ import { EntityDict } from '../oak-app-domain';
|
|||
import { Config } from '../types/Config';
|
||||
import { MenuType } from '../types/WeChat';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
import { WechatPublicEventData, WechatMpEventData } from 'oak-external-sdk';
|
||||
export type GeneralAspectDict<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>> = {
|
||||
mergeUser: (params: {
|
||||
from: string;
|
||||
|
|
@ -151,6 +152,12 @@ export type GeneralAspectDict<ED extends EntityDict, Cxt extends BackendRuntimeC
|
|||
type: MenuType;
|
||||
mediaId: string;
|
||||
}, context: Cxt) => Promise<any>;
|
||||
createSession: (params: {
|
||||
data?: WechatPublicEventData | WechatMpEventData;
|
||||
type: AppType;
|
||||
entity?: string;
|
||||
entityId?: string;
|
||||
}, context: Cxt) => Promise<string>;
|
||||
createTag: (params: {
|
||||
applicationId: string;
|
||||
name: string;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { createWechatLogin } from './wechatLogin';
|
|||
import { unbindingWechat } from './wechatUser';
|
||||
import { getMpUnlimitWxaCode } from './wechatQrCode';
|
||||
import { confirmUserEntityGrant } from './userEntityGrant';
|
||||
import { createSession } from './session';
|
||||
import { getCurrentMenu, getMenu, createMenu, createConditionalMenu, deleteConditionalMenu, deleteMenu, batchGetArticle, getArticle, batchGetMaterialList, getMaterial } from './wechatMenu';
|
||||
import { createTag, getTags, editTag, deleteTag } from './wechatPublicTag';
|
||||
declare const aspectDict: {
|
||||
|
|
@ -44,6 +45,7 @@ declare const aspectDict: {
|
|||
getArticle: typeof getArticle;
|
||||
batchGetMaterialList: typeof batchGetMaterialList;
|
||||
getMaterial: typeof getMaterial;
|
||||
createSession: typeof createSession;
|
||||
createTag: typeof createTag;
|
||||
getTags: typeof getTags;
|
||||
editTag: typeof editTag;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { createWechatLogin } from './wechatLogin';
|
|||
import { unbindingWechat } from './wechatUser';
|
||||
import { getMpUnlimitWxaCode } from './wechatQrCode';
|
||||
import { confirmUserEntityGrant } from './userEntityGrant';
|
||||
import { createSession } from './session';
|
||||
import { getCurrentMenu, getMenu, createMenu, createConditionalMenu, deleteConditionalMenu, deleteMenu, batchGetArticle, getArticle, batchGetMaterialList, getMaterial, } from './wechatMenu';
|
||||
import { createTag, getTags, editTag, deleteTag, } from './wechatPublicTag';
|
||||
const aspectDict = {
|
||||
|
|
@ -44,6 +45,7 @@ const aspectDict = {
|
|||
getArticle,
|
||||
batchGetMaterialList,
|
||||
getMaterial,
|
||||
createSession,
|
||||
createTag,
|
||||
getTags,
|
||||
editTag,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
import { EntityDict } from "../oak-app-domain";
|
||||
import { AppType } from "../oak-app-domain/Application/Schema";
|
||||
import { BackendRuntimeContext } from "../context/BackendRuntimeContext";
|
||||
import { WechatPublicEventData, WechatMpEventData } from 'oak-external-sdk';
|
||||
export declare function createSession<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
data?: WechatPublicEventData | WechatMpEventData;
|
||||
type: AppType;
|
||||
entity?: string;
|
||||
entityId?: string;
|
||||
}, context: Cxt): Promise<string | undefined>;
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
|
||||
import assert from "assert";
|
||||
// export async function transformData<
|
||||
// ED extends EntityDict,
|
||||
// Cxt extends BackendRuntimeContext<ED>
|
||||
// >(
|
||||
// params: {
|
||||
// data: WechatPublicEventData | WechatMpEventData;
|
||||
// type: AppType,
|
||||
// entity: string,
|
||||
// entityId: string,
|
||||
// },
|
||||
// context: Cxt
|
||||
// ) {
|
||||
// const { data, type, entity, entityId } = params;
|
||||
// const {
|
||||
// ToUserName,
|
||||
// FromUserName,
|
||||
// CreateTime,
|
||||
// MsgType,
|
||||
// // Event,
|
||||
// Content,
|
||||
// // EventKey,
|
||||
// } = data;
|
||||
// if (entity !== 'web') {
|
||||
// const sessionMessageData = {
|
||||
// createTime: CreateTime,
|
||||
// type: MsgType,
|
||||
// text: Content,
|
||||
// // news: ,
|
||||
// aaoe: false,
|
||||
// isRead: false,
|
||||
// }
|
||||
// return sessionMessageData
|
||||
// } else {
|
||||
// const sessionMessageData = {
|
||||
// createTime: CreateTime,
|
||||
// type: MsgType,
|
||||
// text: Content,
|
||||
// // news: ,
|
||||
// aaoe: false,
|
||||
// isRead: false,
|
||||
// }
|
||||
// return sessionMessageData
|
||||
// }
|
||||
// }
|
||||
export async function createSession(params, context) {
|
||||
const { data, type, entity, entityId } = params;
|
||||
const userId = context.getCurrentUserId(true);
|
||||
let session;
|
||||
let sessionMessage$session;
|
||||
switch (type) {
|
||||
case 'web': {
|
||||
const systemId = context.getSystemId();
|
||||
const [application] = await context.select('application', {
|
||||
data: {
|
||||
id: 1,
|
||||
systemId: 1,
|
||||
type: 1,
|
||||
},
|
||||
filter: {
|
||||
systemId,
|
||||
type: 'web'
|
||||
}
|
||||
}, {});
|
||||
const result = await context.select('session', {
|
||||
data: {
|
||||
id: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
userId: 1,
|
||||
lmts: 1,
|
||||
},
|
||||
filter: {
|
||||
entity: entity || 'application',
|
||||
entityId: entityId || application?.id,
|
||||
userId,
|
||||
}
|
||||
}, {});
|
||||
session = result[0];
|
||||
break;
|
||||
}
|
||||
case 'wechatMp':
|
||||
case 'wechatPublic': {
|
||||
assert(data, '');
|
||||
const { ToUserName, FromUserName, CreateTime, MsgType,
|
||||
// Event,
|
||||
Content,
|
||||
// EventKey,
|
||||
} = data;
|
||||
const [wechatUser] = await context.select('wechatUser', {
|
||||
data: {
|
||||
id: 1,
|
||||
openId: 1,
|
||||
applicationId: 1,
|
||||
},
|
||||
filter: {
|
||||
openId: FromUserName,
|
||||
}
|
||||
}, {});
|
||||
sessionMessage$session = [
|
||||
{
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'create',
|
||||
data: {
|
||||
id: await generateNewIdAsync(),
|
||||
applicationId: wechatUser?.applicationId,
|
||||
// sessionId: session[0]?.id,
|
||||
wechatUser: wechatUser?.id,
|
||||
createTime: CreateTime,
|
||||
type: MsgType,
|
||||
text: Content,
|
||||
// news: ,
|
||||
aaoe: false,
|
||||
},
|
||||
}
|
||||
];
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
assert(false, '');
|
||||
}
|
||||
}
|
||||
const sessionId = await generateNewIdAsync();
|
||||
if (session) {
|
||||
if (!data) {
|
||||
return session.id;
|
||||
}
|
||||
await context.operate('session', {
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'update',
|
||||
data: Object.assign({}, sessionMessage$session && { sessionMessage$session }),
|
||||
filter: {
|
||||
id: session.id,
|
||||
}
|
||||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
return session.id;
|
||||
}
|
||||
else {
|
||||
await context.operate('session', {
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'create',
|
||||
data: Object.assign({
|
||||
id: sessionId,
|
||||
entity,
|
||||
entityId,
|
||||
userId,
|
||||
lmts: Date.now(),
|
||||
}, sessionMessage$session && { sessionMessage$session }),
|
||||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
return sessionId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { EntityDict } from "../oak-app-domain";
|
||||
import { AppType } from "../oak-app-domain/Application/Schema";
|
||||
import { BackendRuntimeContext } from "../context/BackendRuntimeContext";
|
||||
import { WechatPublicEventData, WechatMpEventData } from 'oak-external-sdk';
|
||||
export declare function createSessionMessage<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
data?: WechatPublicEventData | WechatMpEventData;
|
||||
type: AppType;
|
||||
entity?: string;
|
||||
entityId?: string;
|
||||
}, context: Cxt): Promise<void>;
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
export async function createSessionMessage(params, context) {
|
||||
const { data, type, entity, entityId } = params;
|
||||
// const [application] = await context.select('application', {
|
||||
// data: {
|
||||
// id: 1,
|
||||
// systemId: 1,
|
||||
// type: 1,
|
||||
// },
|
||||
// filter: {
|
||||
// systemId,
|
||||
// type: 'web'
|
||||
// }
|
||||
// }, {});
|
||||
}
|
||||
|
|
@ -1,63 +1,48 @@
|
|||
"use strict";
|
||||
// import assert from 'assert';
|
||||
// import { ButtonProps } from 'antd';
|
||||
// import { ButtonProps as MobileButtonProps } from 'antd-mobile';
|
||||
// import { EntityDict } from '../../../oak-app-domain';
|
||||
// import { FileState } from '../../../features/extraFile2';
|
||||
// export default OakComponent({
|
||||
// formData({ features }) {
|
||||
// const ids: string[] = this.getEfIds();
|
||||
// const states = ids.map(
|
||||
// id => features.extraFile2.getFileState(id)
|
||||
// );
|
||||
// let state: FileState = 'uploaded';
|
||||
// states.forEach(
|
||||
// (ele) => {
|
||||
// if (ele) {
|
||||
// if (['failed', 'local'].includes(ele.state)) {
|
||||
// state = ele.state;
|
||||
// }
|
||||
// else if (ele.state === 'uploading' && state === 'uploaded') {
|
||||
// state = 'uploading';
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
// return {
|
||||
// state,
|
||||
// };
|
||||
// },
|
||||
// properties: {
|
||||
// efPaths: [] as string[],
|
||||
// size: 'middle' as ButtonProps['size'] | MobileButtonProps['size'],
|
||||
// block: false as ButtonProps['block'] | MobileButtonProps['block'],
|
||||
// type: 'primary' as ButtonProps['type'] | MobileButtonProps['type'],
|
||||
// executeText: '',
|
||||
// },
|
||||
// methods: {
|
||||
// getEfIds() {
|
||||
// const { efPaths } = this.props;
|
||||
// const { oakFullpath } = this.state;
|
||||
// assert(efPaths);
|
||||
// if (oakFullpath) {
|
||||
// const ids = efPaths.map(
|
||||
// (path) => {
|
||||
// const path2 = path ? `${oakFullpath}.path` : oakFullpath;
|
||||
// const data = this.features.runningTree.getFreshValue(path2);
|
||||
// if (data) {
|
||||
// return (data as EntityDict['extraFile']['OpSchema'][]).map(
|
||||
// ele => ele.id
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// ).flat().filter(
|
||||
// ele => !!ele
|
||||
// ) as string[];
|
||||
// return ids;
|
||||
// }
|
||||
// return [];
|
||||
// },
|
||||
// upload() {
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
import assert from 'assert';
|
||||
export default OakComponent({
|
||||
formData({ features }) {
|
||||
const ids = this.getEfIds();
|
||||
const states = ids.map(id => features.extraFile2.getFileState(id));
|
||||
let state = 'uploaded';
|
||||
states.forEach((ele) => {
|
||||
if (ele) {
|
||||
if (['failed', 'local'].includes(ele.state)) {
|
||||
state = ele.state;
|
||||
}
|
||||
else if (ele.state === 'uploading' && state === 'uploaded') {
|
||||
state = 'uploading';
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
state,
|
||||
};
|
||||
},
|
||||
properties: {
|
||||
efPaths: [],
|
||||
size: 'middle',
|
||||
block: false,
|
||||
type: 'primary',
|
||||
executeText: '',
|
||||
},
|
||||
methods: {
|
||||
getEfIds() {
|
||||
const { efPaths } = this.props;
|
||||
const { oakFullpath } = this.state;
|
||||
assert(efPaths);
|
||||
if (oakFullpath) {
|
||||
const ids = efPaths.map((path) => {
|
||||
const path2 = path ? `${oakFullpath}.path` : oakFullpath;
|
||||
const data = this.features.runningTree.getFreshValue(path2);
|
||||
if (data) {
|
||||
return data.map(ele => ele.id);
|
||||
}
|
||||
}).flat().filter(ele => !!ele);
|
||||
return ids;
|
||||
}
|
||||
return [];
|
||||
},
|
||||
upload() {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { generateNewId } from 'oak-domain/lib/utils/uuid';
|
||||
import { DATA_SUBSCRIBER_KEYS } from '../../../config/constants';
|
||||
export default OakComponent({
|
||||
entity: 'sessionMessage',
|
||||
projection: {
|
||||
|
|
@ -42,6 +43,15 @@ export default OakComponent({
|
|||
lifetimes: {
|
||||
async ready() {
|
||||
const { sessionId } = this.props;
|
||||
this.subData([
|
||||
{
|
||||
entity: 'sessionMessage',
|
||||
filter: {
|
||||
sessionId: sessionId,
|
||||
},
|
||||
id: `${DATA_SUBSCRIBER_KEYS.sessionMessageList}-${sessionId}`,
|
||||
}
|
||||
]);
|
||||
// const userId = this.features.token.getUserId(true);
|
||||
// const applicationId = this.features.application.getApplicationId();
|
||||
// if (!sessionId) {
|
||||
|
|
@ -73,6 +83,10 @@ export default OakComponent({
|
|||
if (this.timer) {
|
||||
clearInterval(this.timer);
|
||||
}
|
||||
const { sessionId } = this.props;
|
||||
this.unSubData([
|
||||
`${DATA_SUBSCRIBER_KEYS.sessionMessageList}-${sessionId}`
|
||||
]);
|
||||
},
|
||||
},
|
||||
listeners: {
|
||||
|
|
|
|||
|
|
@ -9,3 +9,6 @@ export declare const LOCAL_STORAGE_KEYS: {
|
|||
appId: string;
|
||||
token: string;
|
||||
};
|
||||
export declare const DATA_SUBSCRIBER_KEYS: {
|
||||
sessionMessageList: string;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,3 +13,6 @@ export const LOCAL_STORAGE_KEYS = {
|
|||
appId: 'ogb:f-application-id',
|
||||
token: 'ogb:f-token-token',
|
||||
};
|
||||
export const DATA_SUBSCRIBER_KEYS = {
|
||||
sessionMessageList: 'sessionM-l',
|
||||
};
|
||||
|
|
|
|||
|
|
@ -370,7 +370,7 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
|
|||
entity?: never;
|
||||
} | {
|
||||
entity?: ("user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatMenu" | "wechatPublicAutoReply" | "wechatPublicTag" | "wechatPublicTemplate" | "wechatQrCode" | "wechatUser" | string) | null;
|
||||
entityId?: ForeignKey<"User" | "UserEntityGrant" | "UserSystem" | "UserWechatPublicTag" | "WechatLogin" | "WechatMenu" | "wechatPublicAutoReply" | "WechatPublicTag" | "WechatPublicTemplate" | "WechatQrCode" | "WechatUser"> | null;
|
||||
entityId?: ForeignKey<"User" | "UserEntityGrant" | "UserSystem" | "UserWechatPublicTag" | "WechatLogin" | "WechatMenu" | "wechatPublicAutoReply" | "WechatPublicTag" | "wechatPublicTemplate" | "WechatQrCode" | "WechatUser"> | null;
|
||||
}) & {
|
||||
[k: string]: any;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
declare const _default: (import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "message", import("..").BRC> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "address", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "user", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "userEntityGrant", import("..").BRC> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatQrCode", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "notification", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatLogin", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "application", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "articleMenu", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "article", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "parasite", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "extraFile", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatMenu", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatPublicTag", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>>)[];
|
||||
declare const _default: (import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "message", import("..").BRC> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "address", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "user", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "userEntityGrant", import("..").BRC> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatQrCode", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "notification", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatLogin", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "application", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "articleMenu", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "article", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "parasite", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "extraFile", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "sessionMessage", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatMenu", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatPublicTag", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>>)[];
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export type GeneralAspectDict<ED extends EntityDict, Cxt extends BackendRuntimeC
|
|||
env: WebEnv;
|
||||
wechatLoginId?: string;
|
||||
}, context: Cxt) => Promise<string>;
|
||||
logout: ({ }: {}, context: Cxt) => Promise<void>;
|
||||
logout: ({}: {}, context: Cxt) => Promise<void>;
|
||||
loginWechatMp: ({ code, env, }: {
|
||||
code: string;
|
||||
env: WechatMpEnv;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { createWechatLogin } from './wechatLogin';
|
|||
import { unbindingWechat } from './wechatUser';
|
||||
import { getMpUnlimitWxaCode } from './wechatQrCode';
|
||||
import { confirmUserEntityGrant } from './userEntityGrant';
|
||||
import { createSession } from './session';
|
||||
import { getCurrentMenu, getMenu, createMenu, createConditionalMenu, deleteConditionalMenu, deleteMenu, batchGetArticle, getArticle, batchGetMaterialList, getMaterial } from './wechatMenu';
|
||||
import { createTag, getTags, editTag, deleteTag } from './wechatPublicTag';
|
||||
declare const aspectDict: {
|
||||
|
|
@ -44,6 +45,7 @@ declare const aspectDict: {
|
|||
getArticle: typeof getArticle;
|
||||
batchGetMaterialList: typeof batchGetMaterialList;
|
||||
getMaterial: typeof getMaterial;
|
||||
createSession: typeof createSession;
|
||||
createTag: typeof createTag;
|
||||
getTags: typeof getTags;
|
||||
editTag: typeof editTag;
|
||||
|
|
|
|||
|
|
@ -1,63 +1,51 @@
|
|||
"use strict";
|
||||
// import assert from 'assert';
|
||||
// import { ButtonProps } from 'antd';
|
||||
// import { ButtonProps as MobileButtonProps } from 'antd-mobile';
|
||||
// import { EntityDict } from '../../../oak-app-domain';
|
||||
// import { FileState } from '../../../features/extraFile2';
|
||||
// export default OakComponent({
|
||||
// formData({ features }) {
|
||||
// const ids: string[] = this.getEfIds();
|
||||
// const states = ids.map(
|
||||
// id => features.extraFile2.getFileState(id)
|
||||
// );
|
||||
// let state: FileState = 'uploaded';
|
||||
// states.forEach(
|
||||
// (ele) => {
|
||||
// if (ele) {
|
||||
// if (['failed', 'local'].includes(ele.state)) {
|
||||
// state = ele.state;
|
||||
// }
|
||||
// else if (ele.state === 'uploading' && state === 'uploaded') {
|
||||
// state = 'uploading';
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
// return {
|
||||
// state,
|
||||
// };
|
||||
// },
|
||||
// properties: {
|
||||
// efPaths: [] as string[],
|
||||
// size: 'middle' as ButtonProps['size'] | MobileButtonProps['size'],
|
||||
// block: false as ButtonProps['block'] | MobileButtonProps['block'],
|
||||
// type: 'primary' as ButtonProps['type'] | MobileButtonProps['type'],
|
||||
// executeText: '',
|
||||
// },
|
||||
// methods: {
|
||||
// getEfIds() {
|
||||
// const { efPaths } = this.props;
|
||||
// const { oakFullpath } = this.state;
|
||||
// assert(efPaths);
|
||||
// if (oakFullpath) {
|
||||
// const ids = efPaths.map(
|
||||
// (path) => {
|
||||
// const path2 = path ? `${oakFullpath}.path` : oakFullpath;
|
||||
// const data = this.features.runningTree.getFreshValue(path2);
|
||||
// if (data) {
|
||||
// return (data as EntityDict['extraFile']['OpSchema'][]).map(
|
||||
// ele => ele.id
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// ).flat().filter(
|
||||
// ele => !!ele
|
||||
// ) as string[];
|
||||
// return ids;
|
||||
// }
|
||||
// return [];
|
||||
// },
|
||||
// upload() {
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
const assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
exports.default = OakComponent({
|
||||
formData({ features }) {
|
||||
const ids = this.getEfIds();
|
||||
const states = ids.map(id => features.extraFile2.getFileState(id));
|
||||
let state = 'uploaded';
|
||||
states.forEach((ele) => {
|
||||
if (ele) {
|
||||
if (['failed', 'local'].includes(ele.state)) {
|
||||
state = ele.state;
|
||||
}
|
||||
else if (ele.state === 'uploading' && state === 'uploaded') {
|
||||
state = 'uploading';
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
state,
|
||||
};
|
||||
},
|
||||
properties: {
|
||||
efPaths: [],
|
||||
size: 'middle',
|
||||
block: false,
|
||||
type: 'primary',
|
||||
executeText: '',
|
||||
},
|
||||
methods: {
|
||||
getEfIds() {
|
||||
const { efPaths } = this.props;
|
||||
const { oakFullpath } = this.state;
|
||||
(0, assert_1.default)(efPaths);
|
||||
if (oakFullpath) {
|
||||
const ids = efPaths.map((path) => {
|
||||
const path2 = path ? `${oakFullpath}.path` : oakFullpath;
|
||||
const data = this.features.runningTree.getFreshValue(path2);
|
||||
if (data) {
|
||||
return data.map(ele => ele.id);
|
||||
}
|
||||
}).flat().filter(ele => !!ele);
|
||||
return ids;
|
||||
}
|
||||
return [];
|
||||
},
|
||||
upload() {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const uuid_1 = require("oak-domain/lib/utils/uuid");
|
||||
const constants_1 = require("../../../config/constants");
|
||||
exports.default = OakComponent({
|
||||
entity: 'sessionMessage',
|
||||
projection: {
|
||||
|
|
@ -44,6 +45,15 @@ exports.default = OakComponent({
|
|||
lifetimes: {
|
||||
async ready() {
|
||||
const { sessionId } = this.props;
|
||||
this.subData([
|
||||
{
|
||||
entity: 'sessionMessage',
|
||||
filter: {
|
||||
sessionId: sessionId,
|
||||
},
|
||||
id: `${constants_1.DATA_SUBSCRIBER_KEYS.sessionMessageList}-${sessionId}`,
|
||||
}
|
||||
]);
|
||||
// const userId = this.features.token.getUserId(true);
|
||||
// const applicationId = this.features.application.getApplicationId();
|
||||
// if (!sessionId) {
|
||||
|
|
@ -75,6 +85,10 @@ exports.default = OakComponent({
|
|||
if (this.timer) {
|
||||
clearInterval(this.timer);
|
||||
}
|
||||
const { sessionId } = this.props;
|
||||
this.unSubData([
|
||||
`${constants_1.DATA_SUBSCRIBER_KEYS.sessionMessageList}-${sessionId}`
|
||||
]);
|
||||
},
|
||||
},
|
||||
listeners: {
|
||||
|
|
|
|||
|
|
@ -9,3 +9,6 @@ export declare const LOCAL_STORAGE_KEYS: {
|
|||
appId: string;
|
||||
token: string;
|
||||
};
|
||||
export declare const DATA_SUBSCRIBER_KEYS: {
|
||||
sessionMessageList: string;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LOCAL_STORAGE_KEYS = exports.getWechatPublicTags = exports.registerWechatPublicTags = exports.WechatPublicTags = void 0;
|
||||
exports.DATA_SUBSCRIBER_KEYS = exports.LOCAL_STORAGE_KEYS = exports.getWechatPublicTags = exports.registerWechatPublicTags = exports.WechatPublicTags = void 0;
|
||||
exports.WechatPublicTags = {};
|
||||
function registerWechatPublicTags(_WechatPublicTags) {
|
||||
exports.WechatPublicTags = _WechatPublicTags;
|
||||
|
|
@ -18,3 +18,6 @@ exports.LOCAL_STORAGE_KEYS = {
|
|||
appId: 'ogb:f-application-id',
|
||||
token: 'ogb:f-token-token',
|
||||
};
|
||||
exports.DATA_SUBSCRIBER_KEYS = {
|
||||
sessionMessageList: 'sessionM-l',
|
||||
};
|
||||
|
|
|
|||
|
|
@ -44,26 +44,11 @@ const Storage_40 = require("./UserSystem/Storage");
|
|||
const Storage_41 = require("./UserWechatPublicTag/Storage");
|
||||
const Storage_42 = require("./WechatLogin/Storage");
|
||||
const Storage_43 = require("./WechatMenu/Storage");
|
||||
const Storage_44 = require("./WechatPublicTag/Storage");
|
||||
const Storage_45 = require("./WechatQrCode/Storage");
|
||||
const Storage_46 = require("./WechatUser/Storage");
|
||||
const Storage_31 = require("./Session/Storage");
|
||||
const Storage_32 = require("./SessionMessage/Storage");
|
||||
const Storage_33 = require("./Station/Storage");
|
||||
const Storage_34 = require("./Subscription/Storage");
|
||||
const Storage_35 = require("./Subway/Storage");
|
||||
const Storage_36 = require("./SubwayStation/Storage");
|
||||
const Storage_37 = require("./System/Storage");
|
||||
const Storage_38 = require("./Token/Storage");
|
||||
const Storage_39 = require("./UserSystem/Storage");
|
||||
const Storage_40 = require("./UserWechatPublicTag/Storage");
|
||||
const Storage_41 = require("./WechatLogin/Storage");
|
||||
const Storage_42 = require("./WechatMenu/Storage");
|
||||
const Storage_43 = require("./wechatPublicAutoReply/Storage");
|
||||
const Storage_44 = require("./WechatPublicTag/Storage");
|
||||
const Storage_45 = require("./WechatPublicTemplate/Storage");
|
||||
const Storage_46 = require("./WechatQrCode/Storage");
|
||||
const Storage_47 = require("./WechatUser/Storage");
|
||||
const Storage_44 = require("./wechatPublicAutoReply/Storage");
|
||||
const Storage_45 = require("./WechatPublicTag/Storage");
|
||||
const Storage_46 = require("./WechatPublicTemplate/Storage");
|
||||
const Storage_47 = require("./WechatQrCode/Storage");
|
||||
const Storage_48 = require("./WechatUser/Storage");
|
||||
exports.storageSchema = {
|
||||
actionAuth: Storage_1.desc,
|
||||
i18n: Storage_2.desc,
|
||||
|
|
@ -108,24 +93,9 @@ exports.storageSchema = {
|
|||
userWechatPublicTag: Storage_41.desc,
|
||||
wechatLogin: Storage_42.desc,
|
||||
wechatMenu: Storage_43.desc,
|
||||
wechatPublicTag: Storage_44.desc,
|
||||
wechatQrCode: Storage_45.desc,
|
||||
wechatUser: Storage_46.desc
|
||||
session: Storage_31.desc,
|
||||
sessionMessage: Storage_32.desc,
|
||||
station: Storage_33.desc,
|
||||
subscription: Storage_34.desc,
|
||||
subway: Storage_35.desc,
|
||||
subwayStation: Storage_36.desc,
|
||||
system: Storage_37.desc,
|
||||
token: Storage_38.desc,
|
||||
userSystem: Storage_39.desc,
|
||||
userWechatPublicTag: Storage_40.desc,
|
||||
wechatLogin: Storage_41.desc,
|
||||
wechatMenu: Storage_42.desc,
|
||||
wechatPublicAutoReply: Storage_43.desc,
|
||||
wechatPublicTag: Storage_44.desc,
|
||||
wechatPublicTemplate: Storage_45.desc,
|
||||
wechatQrCode: Storage_46.desc,
|
||||
wechatUser: Storage_47.desc
|
||||
wechatPublicAutoReply: Storage_44.desc,
|
||||
wechatPublicTag: Storage_45.desc,
|
||||
wechatPublicTemplate: Storage_46.desc,
|
||||
wechatQrCode: Storage_47.desc,
|
||||
wechatUser: Storage_48.desc
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
declare const _default: (import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "message", import("..").BRC> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "address", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "user", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "userEntityGrant", import("..").BRC> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatQrCode", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "notification", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatLogin", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "application", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "articleMenu", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "article", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "parasite", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "extraFile", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "sessionMessage", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>>)[];
|
||||
declare const _default: (import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "message", import("..").BRC> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "address", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "user", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "userEntityGrant", import("..").BRC> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatQrCode", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "notification", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatLogin", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "application", import("..").RuntimeCxt> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "articleMenu", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "article", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "parasite", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "extraFile", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "sessionMessage", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatMenu", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>> | import("oak-domain").Trigger<import("../oak-app-domain").EntityDict, "wechatPublicTag", import("..").BackendRuntimeContext<import("../oak-app-domain").EntityDict>>)[];
|
||||
export default _default;
|
||||
|
|
|
|||
Loading…
Reference in New Issue