oak-pay-business/lib/triggers/userSystem.js

31 lines
1004 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const uuid_1 = require("oak-domain/lib/utils/uuid");
const triggers = [
{
name: '当生成userSystem时生成在这个system下的帐号',
entity: 'userSystem',
action: 'create',
when: 'before',
fn: async ({ operation }, context, option) => {
const { data } = operation;
const { userId, systemId } = data;
await context.operate('account', {
id: await (0, uuid_1.generateNewIdAsync)(),
action: 'create',
data: {
id: await (0, uuid_1.generateNewIdAsync)(),
entity: 'user',
entityId: userId,
ofSystemId: systemId,
total: 0,
avail: 0,
refundable: 0,
},
}, {});
return 1;
},
},
];
exports.default = triggers;