extraFileCommit
This commit is contained in:
parent
088b3f0ef7
commit
6062a4a3c4
|
|
@ -1,5 +1,5 @@
|
|||
import { OakInputIllegalException, } from 'oak-domain/lib/types';
|
||||
import assert from 'assert';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { generateNewId } from 'oak-domain';
|
||||
const checkers = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -32,9 +32,5 @@ declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends key
|
|||
} & import("react").AriaAttributes) | undefined;
|
||||
afterCommit?: AfterCommit;
|
||||
beforeCommit?: BeforeCommit;
|
||||
fnSetMp?: {
|
||||
afterCommit?: AfterCommit;
|
||||
beforeCommit?: BeforeCommit;
|
||||
} | undefined;
|
||||
}>) => React.ReactElement;
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import assert from 'assert';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
export default OakComponent({
|
||||
formData({ features }) {
|
||||
const ids = this.getEfIds();
|
||||
|
|
@ -27,10 +27,6 @@ export default OakComponent({
|
|||
buttonProps: {},
|
||||
afterCommit: undefined,
|
||||
beforeCommit: undefined,
|
||||
fnSetMp: {
|
||||
afterCommit: undefined,
|
||||
beforeCommit: undefined,
|
||||
}, //小程序传递函数 需要以对象形式传入组件
|
||||
},
|
||||
data: {
|
||||
failureIds: undefined,
|
||||
|
|
@ -112,13 +108,11 @@ export default OakComponent({
|
|||
},
|
||||
async onSubmit(e) {
|
||||
const { oakExecutable } = this.state;
|
||||
const { beforeCommit, afterCommit, action, fnSetMp } = this.props;
|
||||
const { beforeCommit, afterCommit, action } = this.props;
|
||||
const ids = this.getEfIds();
|
||||
const beforeCommit2 = fnSetMp?.beforeCommit || beforeCommit;
|
||||
const afterCommit2 = fnSetMp?.afterCommit || afterCommit;
|
||||
if (oakExecutable) {
|
||||
if (typeof beforeCommit2 === 'function') {
|
||||
const beforeCommitResult = await beforeCommit2();
|
||||
if (beforeCommit) {
|
||||
const beforeCommitResult = await beforeCommit();
|
||||
if (beforeCommitResult === false) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -134,8 +128,8 @@ export default OakComponent({
|
|||
this.setState({
|
||||
failureIds: undefined,
|
||||
});
|
||||
if (typeof afterCommit2 === 'function') {
|
||||
afterCommit2();
|
||||
if (afterCommit) {
|
||||
afterCommit();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
@ -151,8 +145,8 @@ export default OakComponent({
|
|||
this.setState({
|
||||
failureIds: undefined,
|
||||
});
|
||||
if (typeof afterCommit2 === 'function') {
|
||||
afterCommit2();
|
||||
if (afterCommit) {
|
||||
afterCommit();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<!-- index.wxml -->
|
||||
<l-button size="long" disabled="{{oakExecuting}}" bind:lintap="onSubmit">
|
||||
<l-button size="long" disabled="{{oakExecuting}}" loading="{{oakExecuting}}" bind:lintap="onSubmit">
|
||||
{{ executeText || t('common::submit')}}
|
||||
</l-button>
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
<block wx:if="{{mobileValueReady}}">
|
||||
<block wx:if="{{userId}}">
|
||||
<relation-on-user
|
||||
style="display: flex;flex-direction: column; flex: 1; margin-top: 30rpx"
|
||||
style="display: flex;flex-direction: column; flex: 1; margin-top: 30rpx; ; margin-bottom: 30rpx"
|
||||
oakId="{{userId}}"
|
||||
mobile="{{mobileValue}}"
|
||||
oakPath="{{oakFullpath + '.user'}}"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { BackendRuntimeContext } from '../../context/BackendRuntimeContext';
|
||||
import { FrontendRuntimeContext, AspectDict } from '../../context/FrontendRuntimeContext';
|
||||
import { ED } from '../../types/RuntimeCxt';
|
||||
import Cos from "../../types/Cos";
|
||||
import Cos from '../../types/Cos';
|
||||
/**
|
||||
* 注入一个其它OSS上实现的uploader类
|
||||
* @param clazz
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import assert from 'assert';
|
||||
import Qiniu from "./qiniu";
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import Qiniu from './qiniu';
|
||||
import Wechat from './wechat';
|
||||
const qiniu = new Qiniu();
|
||||
const wechat = new Wechat();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import assert from 'assert';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { getCos } from '../utils/cos';
|
||||
import { generateNewIdAsync } from 'oak-domain';
|
||||
import { groupBy } from 'oak-domain/lib/utils/lodash';
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
const types_1 = require("oak-domain/lib/types");
|
||||
const assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
const assert_1 = require("oak-domain/lib/utils/assert");
|
||||
const oak_domain_1 = require("oak-domain");
|
||||
const checkers = [
|
||||
{
|
||||
|
|
@ -38,10 +37,10 @@ const checkers = [
|
|||
action: 'claim',
|
||||
checker: (operation, context, option) => {
|
||||
const { data, filter } = operation;
|
||||
(0, assert_1.default)(Object.keys(data).length === 1 && data.hasOwnProperty('userEntityClaim$ueg'));
|
||||
(0, assert_1.assert)(Object.keys(data).length === 1 && data.hasOwnProperty('userEntityClaim$ueg'));
|
||||
const { userEntityClaim$ueg } = data;
|
||||
(0, assert_1.default)(filter.id);
|
||||
(0, assert_1.default)(userEntityClaim$ueg instanceof Array);
|
||||
(0, assert_1.assert)(filter.id);
|
||||
(0, assert_1.assert)(userEntityClaim$ueg instanceof Array);
|
||||
const result = context.select('userEntityGrant', {
|
||||
data: {
|
||||
id: 1,
|
||||
|
|
@ -58,7 +57,7 @@ const checkers = [
|
|||
}
|
||||
userEntityClaim$ueg.forEach((uec) => {
|
||||
const { action, data } = uec;
|
||||
(0, assert_1.default)(action === 'create');
|
||||
(0, assert_1.assert)(action === 'create');
|
||||
const { userId, relationId, claimEntityId } = data;
|
||||
Object.assign(data, {
|
||||
userRelation: {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { BackendRuntimeContext } from '../../context/BackendRuntimeContext';
|
||||
import { FrontendRuntimeContext, AspectDict } from '../../context/FrontendRuntimeContext';
|
||||
import { ED } from '../../types/RuntimeCxt';
|
||||
import Cos from "../../types/Cos";
|
||||
import Cos from '../../types/Cos';
|
||||
/**
|
||||
* 注入一个其它OSS上实现的uploader类
|
||||
* @param clazz
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.composeFileUrl = exports.getCos = exports.registerCos = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
const assert_1 = require("oak-domain/lib/utils/assert");
|
||||
const qiniu_1 = tslib_1.__importDefault(require("./qiniu"));
|
||||
const wechat_1 = tslib_1.__importDefault(require("./wechat"));
|
||||
const qiniu = new qiniu_1.default();
|
||||
|
|
@ -21,7 +21,7 @@ function registerCos(clazz) {
|
|||
}
|
||||
exports.registerCos = registerCos;
|
||||
function getCos(origin) {
|
||||
(0, assert_1.default)(CosDict.hasOwnProperty(origin));
|
||||
(0, assert_1.assert)(CosDict.hasOwnProperty(origin));
|
||||
return CosDict[origin];
|
||||
}
|
||||
exports.getCos = getCos;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
const assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
const assert_1 = require("oak-domain/lib/utils/assert");
|
||||
const cos_1 = require("../utils/cos");
|
||||
const oak_domain_1 = require("oak-domain");
|
||||
const lodash_1 = require("oak-domain/lib/utils/lodash");
|
||||
|
|
@ -12,7 +11,7 @@ async function checkWhetherSuccess(context, applicationId, rows) {
|
|||
for (const d of rows) {
|
||||
const { origin } = d;
|
||||
const cos = (0, cos_1.getCos)(origin);
|
||||
(0, assert_1.default)(cos);
|
||||
(0, assert_1.assert)(cos);
|
||||
const success = await cos.checkWhetherSuccess(d, context);
|
||||
if (success) {
|
||||
successIds.push(d.id);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import {
|
|||
import { EntityDict } from '../oak-app-domain';
|
||||
import { checkAttributesNotNull } from 'oak-domain/lib/utils/validator';
|
||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||
import assert from 'assert';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { generateNewId } from 'oak-domain';
|
||||
|
||||
const checkers: Checker<
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import assert from 'assert';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { EntityDict } from '../../../oak-app-domain';
|
||||
import { FileState } from '../../../features/extraFile';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
|
||||
|
|
@ -38,15 +38,6 @@ export default OakComponent({
|
|||
buttonProps: {},
|
||||
afterCommit: undefined as AfterCommit,
|
||||
beforeCommit: undefined as BeforeCommit,
|
||||
fnSetMp: {
|
||||
afterCommit: undefined,
|
||||
beforeCommit: undefined,
|
||||
} as
|
||||
| {
|
||||
afterCommit?: AfterCommit;
|
||||
beforeCommit?: BeforeCommit;
|
||||
}
|
||||
| undefined, //小程序传递函数 需要以对象形式传入组件
|
||||
},
|
||||
data: {
|
||||
failureIds: undefined as string[] | undefined,
|
||||
|
|
@ -138,15 +129,12 @@ export default OakComponent({
|
|||
},
|
||||
async onSubmit(e: any) {
|
||||
const { oakExecutable } = this.state;
|
||||
const { beforeCommit, afterCommit, action, fnSetMp } = this.props;
|
||||
const { beforeCommit, afterCommit, action } = this.props;
|
||||
const ids = this.getEfIds();
|
||||
|
||||
const beforeCommit2 = fnSetMp?.beforeCommit || beforeCommit;
|
||||
const afterCommit2 = fnSetMp?.afterCommit || afterCommit;
|
||||
|
||||
if (oakExecutable) {
|
||||
if (typeof beforeCommit2 === 'function') {
|
||||
const beforeCommitResult = await beforeCommit2();
|
||||
if (beforeCommit) {
|
||||
const beforeCommitResult = await beforeCommit();
|
||||
if (beforeCommitResult === false) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -163,8 +151,8 @@ export default OakComponent({
|
|||
this.setState({
|
||||
failureIds: undefined,
|
||||
});
|
||||
if (typeof afterCommit2 === 'function') {
|
||||
afterCommit2();
|
||||
if (afterCommit) {
|
||||
afterCommit();
|
||||
}
|
||||
} else {
|
||||
const { failureIds } = this.state;
|
||||
|
|
@ -179,8 +167,8 @@ export default OakComponent({
|
|||
this.setState({
|
||||
failureIds: undefined,
|
||||
});
|
||||
if (typeof afterCommit2 === 'function') {
|
||||
afterCommit2();
|
||||
if (afterCommit) {
|
||||
afterCommit();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -200,11 +188,6 @@ export default OakComponent({
|
|||
buttonProps?: ButtonProps & AmButtonProps;
|
||||
afterCommit?: AfterCommit;
|
||||
beforeCommit?: BeforeCommit;
|
||||
fnSetMp?: {
|
||||
//小程序传递函数 需要以对象形式传入组件
|
||||
afterCommit?: AfterCommit;
|
||||
beforeCommit?: BeforeCommit;
|
||||
};
|
||||
}
|
||||
>
|
||||
) => React.ReactElement;
|
||||
) => React.ReactElement;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<!-- index.wxml -->
|
||||
<l-button size="long" disabled="{{oakExecuting}}" bind:lintap="onSubmit">
|
||||
<l-button size="long" disabled="{{oakExecuting}}" loading="{{oakExecuting}}" bind:lintap="onSubmit">
|
||||
{{ executeText || t('common::submit')}}
|
||||
</l-button>
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
<block wx:if="{{mobileValueReady}}">
|
||||
<block wx:if="{{userId}}">
|
||||
<relation-on-user
|
||||
style="display: flex;flex-direction: column; flex: 1; margin-top: 30rpx"
|
||||
style="display: flex;flex-direction: column; flex: 1; margin-top: 30rpx; ; margin-bottom: 30rpx"
|
||||
oakId="{{userId}}"
|
||||
mobile="{{mobileValue}}"
|
||||
oakPath="{{oakFullpath + '.user'}}"
|
||||
|
|
|
|||
|
|
@ -208,19 +208,39 @@ async function createNotification(message: CreateMessageData, context: BRC) {
|
|||
const apps = applications!.filter(
|
||||
ele => ele.type === 'wechatPublic',
|
||||
);
|
||||
const wechatUsers = await context.select('wechatUser', {
|
||||
data: {
|
||||
id: 1,
|
||||
applicationId: 1,
|
||||
openId: 1,
|
||||
},
|
||||
filter: {
|
||||
applicationId: {
|
||||
$in: apps.map(ele => ele.id!),
|
||||
const [user] = await context.select(
|
||||
'user',
|
||||
{
|
||||
data: {
|
||||
id: 1,
|
||||
refId: 1,
|
||||
},
|
||||
userId,
|
||||
}
|
||||
}, { dontCollect: true });
|
||||
filter: {
|
||||
id: userId
|
||||
}
|
||||
},
|
||||
{ dontCollect: true }
|
||||
);
|
||||
const userId2 = user.refId ? user.refId : userId;
|
||||
const wechatUsers = await context.select(
|
||||
'wechatUser',
|
||||
{
|
||||
data: {
|
||||
id: 1,
|
||||
applicationId: 1,
|
||||
openId: 1,
|
||||
},
|
||||
filter: {
|
||||
applicationId: {
|
||||
$in: apps.map(
|
||||
(ele) => ele.id!
|
||||
),
|
||||
},
|
||||
userId: userId2,
|
||||
},
|
||||
},
|
||||
{ dontCollect: true }
|
||||
);
|
||||
for (const app of apps) {
|
||||
// 如果是wechatMp或者wechat,还要保证用户已经有openId
|
||||
const wechatUser = wechatUsers.find(
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
import assert from 'assert';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { BackendRuntimeContext } from '../../context/BackendRuntimeContext';
|
||||
import { FrontendRuntimeContext, AspectDict } from '../../context/FrontendRuntimeContext';
|
||||
import {
|
||||
FrontendRuntimeContext,
|
||||
AspectDict,
|
||||
} from '../../context/FrontendRuntimeContext';
|
||||
import { ED, BRC, FRC } from '../../types/RuntimeCxt';
|
||||
|
||||
import Cos from "../../types/Cos";
|
||||
import Qiniu from "./qiniu";
|
||||
import Cos from '../../types/Cos';
|
||||
import Qiniu from './qiniu';
|
||||
import Wechat from './wechat';
|
||||
|
||||
|
||||
const qiniu = new Qiniu();
|
||||
const wechat = new Wechat();
|
||||
|
||||
|
|
@ -18,12 +20,13 @@ const CosDict: Record<string, any> = {
|
|||
|
||||
/**
|
||||
* 注入一个其它OSS上实现的uploader类
|
||||
* @param clazz
|
||||
* @param clazz
|
||||
*/
|
||||
export function registerCos<
|
||||
ED2 extends ED,
|
||||
Cxt extends BackendRuntimeContext<ED2>,
|
||||
FrontCxt extends FrontendRuntimeContext<ED2, Cxt, AspectDict<ED2, Cxt>>>(clazz: new () => Cos<ED2, Cxt, FrontCxt>) {
|
||||
FrontCxt extends FrontendRuntimeContext<ED2, Cxt, AspectDict<ED2, Cxt>>
|
||||
>(clazz: new () => Cos<ED2, Cxt, FrontCxt>) {
|
||||
const instance = new clazz();
|
||||
CosDict[instance.name] = instance;
|
||||
}
|
||||
|
|
@ -31,7 +34,8 @@ export function registerCos<
|
|||
export function getCos<
|
||||
ED2 extends ED,
|
||||
Cxt extends BackendRuntimeContext<ED2>,
|
||||
FrontCxt extends FrontendRuntimeContext<ED2, Cxt, AspectDict<ED2, Cxt>>>(origin: string) {
|
||||
FrontCxt extends FrontendRuntimeContext<ED2, Cxt, AspectDict<ED2, Cxt>>
|
||||
>(origin: string) {
|
||||
assert(CosDict.hasOwnProperty(origin));
|
||||
return CosDict[origin] as Cos<ED2, Cxt, FrontCxt>;
|
||||
}
|
||||
|
|
@ -39,12 +43,13 @@ export function getCos<
|
|||
export function composeFileUrl<
|
||||
ED2 extends ED,
|
||||
Cxt extends BackendRuntimeContext<ED2>,
|
||||
FrontCxt extends FrontendRuntimeContext<ED2, Cxt, AspectDict<ED2, Cxt>>>(
|
||||
extraFile: ED2['extraFile']['OpSchema'],
|
||||
context: Cxt | FrontCxt,
|
||||
style?: string) {
|
||||
FrontCxt extends FrontendRuntimeContext<ED2, Cxt, AspectDict<ED2, Cxt>>
|
||||
>(
|
||||
extraFile: ED2['extraFile']['OpSchema'],
|
||||
context: Cxt | FrontCxt,
|
||||
style?: string
|
||||
) {
|
||||
const { origin } = extraFile;
|
||||
const cos = CosDict[origin];
|
||||
return cos.composeFileUrl(extraFile, context as any, style);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import assert from 'assert';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
import { Watcher, BBWatcher } from 'oak-domain/lib/types/Watcher';
|
||||
|
|
|
|||
Loading…
Reference in New Issue