去除pay create后自动开始支付的trigger,由业务自行决定

This commit is contained in:
lxy 2025-01-15 10:16:52 +08:00
parent e489f99b2f
commit b53e460923
31 changed files with 160 additions and 109 deletions

View File

@ -11,8 +11,8 @@ export interface Schema extends EntityShape {
creator: User;
opers: AccountOper[];
}
export type IAction = 'succeed' | 'fail';
export type IState = 'depositing' | 'successful' | 'failed';
export type IAction = 'succeed' | 'fail' | 'ship';
export type IState = 'depositing' | 'successful' | 'failed' | 'shipped';
export declare const IActionDef: ActionDef<IAction, IState>;
type Action = IAction;
export declare const entityDesc: EntityDesc<Schema, Action, '', {

View File

@ -1,8 +1,9 @@
;
export const IActionDef = {
stm: {
succeed: ['depositing', 'successful'],
fail: ['depositing', 'failed'],
ship: ['depositing', 'shipped'],
succeed: [['depositing', 'shipped'], 'successful'],
fail: [['depositing', 'shipped'], 'failed'],
},
is: 'depositing',
};
@ -23,11 +24,13 @@ export const entityDesc = {
depositing: '充值中',
successful: '充值成功',
failed: '充值失败',
shipped: '待用户确认'
},
},
action: {
succeed: '充值成功',
fail: '充值失败',
ship: '虚拟发货'
},
},
},
@ -41,6 +44,7 @@ export const entityDesc = {
depositing: '#3498DB',
successful: '#52BE80',
failed: '#5D6D7E',
shipped: '#0000CD',
},
},
},

View File

@ -10,6 +10,7 @@ export interface Schema extends EntityShape {
taxLossRatio?: Decimal<4, 2>;
application: Application;
enabled: Boolean;
shipping: Boolean;
pays: Pay[];
}
export declare const entityDesc: EntityDesc<Schema, '', '', {

View File

@ -9,6 +9,7 @@ export const entityDesc = {
application: '关联应用',
enabled: '有效中',
taxLossRatio: '产品手续费(百分比)',
shipping: '受发货限制',
pays: '支付',
},
v: {

View File

@ -1,7 +1,7 @@
import { ActionDef } from "oak-domain/lib/types/Action";
import { GenericAction } from "oak-domain/lib/actions/action";
export type IAction = 'succeed' | 'fail' | string;
export type IState = 'depositing' | 'successful' | 'failed' | string;
export type IAction = 'succeed' | 'fail' | 'ship' | string;
export type IState = 'depositing' | 'successful' | 'failed' | 'shipped' | string;
export declare const IActionDef: ActionDef<IAction, IState>;
export type ParticularAction = IAction;
export declare const actions: string[];

View File

@ -1,11 +1,12 @@
export const IActionDef = {
stm: {
succeed: ['depositing', 'successful'],
fail: ['depositing', 'failed'],
ship: ['depositing', 'shipped'],
succeed: [['depositing', 'shipped'], 'successful'],
fail: [['depositing', 'shipped'], 'failed'],
},
is: 'depositing',
};
export const actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "succeed", "fail"];
export const actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "succeed", "fail", "ship"];
export const actionDefDict = {
iState: IActionDef
};

View File

@ -21,7 +21,7 @@ export const desc = {
},
iState: {
type: "enum",
enumeration: ["depositing", "successful", "failed"]
enumeration: ["depositing", "successful", "failed", "shipped"]
}
},
actionType: "crud",

View File

@ -8,6 +8,7 @@ export const style = {
depositing: '#3498DB',
successful: '#52BE80',
failed: '#5D6D7E',
shipped: '#0000CD',
},
},
};

View File

@ -12,11 +12,13 @@
"iState": {
"depositing": "充值中",
"successful": "充值成功",
"failed": "充值失败"
"failed": "充值失败",
"shipped": "待用户确认"
}
},
"action": {
"succeed": "充值成功",
"fail": "充值失败"
"fail": "充值失败",
"ship": "虚拟发货"
}
}

View File

@ -15,6 +15,7 @@ export type OpSchema = EntityShape & {
taxLossRatio?: Decimal<4, 2> | null;
applicationId: ForeignKey<"application">;
enabled: Boolean;
shipping: Boolean;
};
export type OpAttr = keyof OpSchema;
type ModiEntity$entityAggr = "modiEntity$entity$$aggr" | "modiEntity$entity$$0$$aggr" | "modiEntity$entity$$1$$aggr" | "modiEntity$entity$$2$$aggr" | "modiEntity$entity$$3$$aggr" | "modiEntity$entity$$4$$aggr" | "modiEntity$entity$$5$$aggr" | "modiEntity$entity$$6$$aggr" | "modiEntity$entity$$7$$aggr" | "modiEntity$entity$$8$$aggr" | "modiEntity$entity$$9$$aggr";
@ -47,6 +48,7 @@ type AttrFilter = {
applicationId: Q_StringValue;
application: Application.Filter;
enabled: Q_BooleanValue;
shipping: Q_BooleanValue;
modiEntity$entity: ModiEntity.Filter & SubQueryPredicateMetadata;
operEntity$entity: OperEntity.Filter & SubQueryPredicateMetadata;
pay$entity: Pay.Filter & SubQueryPredicateMetadata;
@ -66,6 +68,7 @@ export type Projection = {
applicationId?: number;
application?: Application.Projection;
enabled?: number;
shipping?: number;
modiEntity$entity?: ModiEntity.Selection & {
$entity: "modiEntity";
};
@ -119,6 +122,8 @@ export type SortAttr = {
application: Application.SortAttr;
} | {
enabled: number;
} | {
shipping: number;
} | {
[k: string]: any;
} | OneOf<ExprOp<OpAttr | string>>;

View File

@ -26,6 +26,10 @@ export const desc = {
enabled: {
notNull: true,
type: "boolean"
},
shipping: {
notNull: true,
type: "boolean"
}
},
actionType: "crud",

View File

@ -6,6 +6,7 @@
"application": "关联应用",
"enabled": "有效中",
"taxLossRatio": "产品手续费(百分比)",
"shipping": "受发货限制",
"pays": "支付"
},
"v": {

View File

@ -1,22 +1,22 @@
const startRoutines = [
{
name: '示例性routine',
entity: 'extraFile',
filter: {
uploadState: 'uploading',
},
projection: {
id: 1,
uploadMeta: 1,
uploadState: 1,
entity: 1,
entityId: 1,
objectId: 1,
},
fn: async (context, data) => {
console.log('示例性routine执行请在src/routine/start.ts中关闭');
return context.opResult;
},
},
// {
// name: '示例性routine',
// entity: 'extraFile',
// filter: {
// uploadState: 'uploading',
// },
// projection: {
// id: 1,
// uploadMeta: 1,
// uploadState: 1,
// entity: 1,
// entityId: 1,
// objectId: 1,
// },
// fn: async (context, data) => {
// console.log('示例性routine执行请在src/routine/start.ts中关闭');
// return context.opResult;
// },
// },
];
export default startRoutines;

View File

@ -1,23 +1,25 @@
const timers = [
{
name: '示例timer',
cron: '30 * * * * *',
entity: 'extraFile',
filter: {
uploadState: 'uploading',
},
projection: {
id: 1,
uploadMeta: 1,
uploadState: 1,
entity: 1,
entityId: 1,
objectId: 1,
},
fn: async (context, data) => {
console.log('这是示例timer程序每30秒执行一次请在src/timer/index中关闭');
return context.opResult;
},
},
// {
// name: '示例timer',
// cron: '30 * * * * *',
// entity: 'extraFile',
// filter: {
// uploadState: 'uploading',
// },
// projection: {
// id: 1,
// uploadMeta: 1,
// uploadState: 1,
// entity: 1,
// entityId: 1,
// objectId: 1,
// },
// fn: async (context, data) => {
// console.log(
// '这是示例timer程序每30秒执行一次请在src/timer/index中关闭'
// );
// return context.opResult;
// },
// },
];
export default timers;

View File

@ -265,6 +265,7 @@ const triggers = [
return 1;
},
} as CreateTriggerInTxn<EntityDict, 'pay', BRC>, */
/**
{
name: '当生成pay后自动开始支付流程',
entity: 'pay',
@ -277,14 +278,16 @@ const triggers = [
await context.operate('pay', {
id: await generateNewIdAsync(),
action: 'startPaying',
data: {},
data: {
},
filter: {
id,
}
}, option);
return;
},
},
},*/
{
name: '当pay的状态发生变化时修改相应的order的状态或者deposit的状态同时尝试向订阅者推送',
entity: 'pay',

View File

@ -11,8 +11,8 @@ export interface Schema extends EntityShape {
creator: User;
opers: AccountOper[];
}
export type IAction = 'succeed' | 'fail';
export type IState = 'depositing' | 'successful' | 'failed';
export type IAction = 'succeed' | 'fail' | 'ship';
export type IState = 'depositing' | 'successful' | 'failed' | 'shipped';
export declare const IActionDef: ActionDef<IAction, IState>;
type Action = IAction;
export declare const entityDesc: EntityDesc<Schema, Action, '', {

View File

@ -4,8 +4,9 @@ exports.entityDesc = exports.IActionDef = void 0;
;
exports.IActionDef = {
stm: {
succeed: ['depositing', 'successful'],
fail: ['depositing', 'failed'],
ship: ['depositing', 'shipped'],
succeed: [['depositing', 'shipped'], 'successful'],
fail: [['depositing', 'shipped'], 'failed'],
},
is: 'depositing',
};
@ -26,11 +27,13 @@ exports.entityDesc = {
depositing: '充值中',
successful: '充值成功',
failed: '充值失败',
shipped: '待用户确认'
},
},
action: {
succeed: '充值成功',
fail: '充值失败',
ship: '虚拟发货'
},
},
},
@ -44,6 +47,7 @@ exports.entityDesc = {
depositing: '#3498DB',
successful: '#52BE80',
failed: '#5D6D7E',
shipped: '#0000CD',
},
},
},

View File

@ -10,6 +10,7 @@ export interface Schema extends EntityShape {
taxLossRatio?: Decimal<4, 2>;
application: Application;
enabled: Boolean;
shipping: Boolean;
pays: Pay[];
}
export declare const entityDesc: EntityDesc<Schema, '', '', {

View File

@ -12,6 +12,7 @@ exports.entityDesc = {
application: '关联应用',
enabled: '有效中',
taxLossRatio: '产品手续费(百分比)',
shipping: '受发货限制',
pays: '支付',
},
v: {

View File

@ -1,7 +1,7 @@
import { ActionDef } from "oak-domain/lib/types/Action";
import { GenericAction } from "oak-domain/lib/actions/action";
export type IAction = 'succeed' | 'fail' | string;
export type IState = 'depositing' | 'successful' | 'failed' | string;
export type IAction = 'succeed' | 'fail' | 'ship' | string;
export type IState = 'depositing' | 'successful' | 'failed' | 'shipped' | string;
export declare const IActionDef: ActionDef<IAction, IState>;
export type ParticularAction = IAction;
export declare const actions: string[];

View File

@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.actionDefDict = exports.actions = exports.IActionDef = void 0;
exports.IActionDef = {
stm: {
succeed: ['depositing', 'successful'],
fail: ['depositing', 'failed'],
ship: ['depositing', 'shipped'],
succeed: [['depositing', 'shipped'], 'successful'],
fail: [['depositing', 'shipped'], 'failed'],
},
is: 'depositing',
};
exports.actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "succeed", "fail"];
exports.actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "succeed", "fail", "ship"];
exports.actionDefDict = {
iState: exports.IActionDef
};

View File

@ -24,7 +24,7 @@ exports.desc = {
},
iState: {
type: "enum",
enumeration: ["depositing", "successful", "failed"]
enumeration: ["depositing", "successful", "failed", "shipped"]
}
},
actionType: "crud",

View File

@ -11,6 +11,7 @@ exports.style = {
depositing: '#3498DB',
successful: '#52BE80',
failed: '#5D6D7E',
shipped: '#0000CD',
},
},
};

View File

@ -12,11 +12,13 @@
"iState": {
"depositing": "充值中",
"successful": "充值成功",
"failed": "充值失败"
"failed": "充值失败",
"shipped": "待用户确认"
}
},
"action": {
"succeed": "充值成功",
"fail": "充值失败"
"fail": "充值失败",
"ship": "虚拟发货"
}
}

View File

@ -15,6 +15,7 @@ export type OpSchema = EntityShape & {
taxLossRatio?: Decimal<4, 2> | null;
applicationId: ForeignKey<"application">;
enabled: Boolean;
shipping: Boolean;
};
export type OpAttr = keyof OpSchema;
type ModiEntity$entityAggr = "modiEntity$entity$$aggr" | "modiEntity$entity$$0$$aggr" | "modiEntity$entity$$1$$aggr" | "modiEntity$entity$$2$$aggr" | "modiEntity$entity$$3$$aggr" | "modiEntity$entity$$4$$aggr" | "modiEntity$entity$$5$$aggr" | "modiEntity$entity$$6$$aggr" | "modiEntity$entity$$7$$aggr" | "modiEntity$entity$$8$$aggr" | "modiEntity$entity$$9$$aggr";
@ -47,6 +48,7 @@ type AttrFilter = {
applicationId: Q_StringValue;
application: Application.Filter;
enabled: Q_BooleanValue;
shipping: Q_BooleanValue;
modiEntity$entity: ModiEntity.Filter & SubQueryPredicateMetadata;
operEntity$entity: OperEntity.Filter & SubQueryPredicateMetadata;
pay$entity: Pay.Filter & SubQueryPredicateMetadata;
@ -66,6 +68,7 @@ export type Projection = {
applicationId?: number;
application?: Application.Projection;
enabled?: number;
shipping?: number;
modiEntity$entity?: ModiEntity.Selection & {
$entity: "modiEntity";
};
@ -119,6 +122,8 @@ export type SortAttr = {
application: Application.SortAttr;
} | {
enabled: number;
} | {
shipping: number;
} | {
[k: string]: any;
} | OneOf<ExprOp<OpAttr | string>>;

View File

@ -29,6 +29,10 @@ exports.desc = {
enabled: {
notNull: true,
type: "boolean"
},
shipping: {
notNull: true,
type: "boolean"
}
},
actionType: "crud",

View File

@ -6,6 +6,7 @@
"application": "关联应用",
"enabled": "有效中",
"taxLossRatio": "产品手续费(百分比)",
"shipping": "受发货限制",
"pays": "支付"
},
"v": {

View File

@ -1,24 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const startRoutines = [
{
name: '示例性routine',
entity: 'extraFile',
filter: {
uploadState: 'uploading',
},
projection: {
id: 1,
uploadMeta: 1,
uploadState: 1,
entity: 1,
entityId: 1,
objectId: 1,
},
fn: async (context, data) => {
console.log('示例性routine执行请在src/routine/start.ts中关闭');
return context.opResult;
},
},
// {
// name: '示例性routine',
// entity: 'extraFile',
// filter: {
// uploadState: 'uploading',
// },
// projection: {
// id: 1,
// uploadMeta: 1,
// uploadState: 1,
// entity: 1,
// entityId: 1,
// objectId: 1,
// },
// fn: async (context, data) => {
// console.log('示例性routine执行请在src/routine/start.ts中关闭');
// return context.opResult;
// },
// },
];
exports.default = startRoutines;

View File

@ -1,25 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const timers = [
{
name: '示例timer',
cron: '30 * * * * *',
entity: 'extraFile',
filter: {
uploadState: 'uploading',
},
projection: {
id: 1,
uploadMeta: 1,
uploadState: 1,
entity: 1,
entityId: 1,
objectId: 1,
},
fn: async (context, data) => {
console.log('这是示例timer程序每30秒执行一次请在src/timer/index中关闭');
return context.opResult;
},
},
// {
// name: '示例timer',
// cron: '30 * * * * *',
// entity: 'extraFile',
// filter: {
// uploadState: 'uploading',
// },
// projection: {
// id: 1,
// uploadMeta: 1,
// uploadState: 1,
// entity: 1,
// entityId: 1,
// objectId: 1,
// },
// fn: async (context, data) => {
// console.log(
// '这是示例timer程序每30秒执行一次请在src/timer/index中关闭'
// );
// return context.opResult;
// },
// },
];
exports.default = timers;

View File

@ -268,6 +268,7 @@ const triggers = [
return 1;
},
} as CreateTriggerInTxn<EntityDict, 'pay', BRC>, */
/**
{
name: '当生成pay后自动开始支付流程',
entity: 'pay',
@ -275,19 +276,21 @@ const triggers = [
when: 'commit',
asRoot: true,
fn: async ({ ids }, context, option) => {
(0, assert_1.default)(ids.length === 1);
assert(ids.length === 1);
const [id] = ids;
await context.operate('pay', {
id: await (0, uuid_1.generateNewIdAsync)(),
id: await generateNewIdAsync(),
action: 'startPaying',
data: {},
data: {
},
filter: {
id,
}
}, option);
return;
},
},
},*/
{
name: '当pay的状态发生变化时修改相应的order的状态或者deposit的状态同时尝试向订阅者推送',
entity: 'pay',

View File

@ -288,6 +288,7 @@ const triggers: Trigger<EntityDict, 'pay', BRC>[] = [
return 1;
},
} as CreateTriggerInTxn<EntityDict, 'pay', BRC>, */
/**
{
name: '当生成pay后自动开始支付流程',
entity: 'pay',
@ -309,7 +310,7 @@ const triggers: Trigger<EntityDict, 'pay', BRC>[] = [
return;
},
},
},*/
{
name: '当pay的状态发生变化时修改相应的order的状态或者deposit的状态同时尝试向订阅者推送',
entity: 'pay',