fix wechatqrcode 执行过期 未生效

This commit is contained in:
Wang Kejun 2023-04-28 13:32:31 +08:00
parent 5fd5d095c7
commit 8650443f59
4 changed files with 71 additions and 43 deletions

View File

@ -263,22 +263,27 @@ var triggers = [
fn: function (_a, context) {
var operation = _a.operation;
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var data, _b;
var _c;
return tslib_1.__generator(this, function (_d) {
switch (_d.label) {
var data, filter, _b, _c, _d;
var _e;
return tslib_1.__generator(this, function (_f) {
switch (_f.label) {
case 0:
data = operation.data;
_b = data;
_c = {};
data = operation.data, filter = operation.filter;
_c = (_b = context).operate;
_d = ['wechatQrCode'];
_e = {};
return [4 /*yield*/, (0, uuid_1.generateNewIdAsync)()];
case 1:
_b.wechatQrCode$entity = (_c.id = _d.sent(),
_c.action = 'update',
_c.data = {
expired: true,
},
_c);
case 1: return [4 /*yield*/, _c.apply(_b, _d.concat([(_e.id = _f.sent(),
_e.action = 'update',
_e.data = {
expired: true,
},
_e.filter = {
userEntityGrant: filter,
},
_e), {}]))];
case 2:
_f.sent();
return [2 /*return*/, 1];
}
});

View File

@ -88,22 +88,27 @@ var triggers = [
fn: function (_a, context) {
var operation = _a.operation;
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var data, _b;
var _c;
return tslib_1.__generator(this, function (_d) {
switch (_d.label) {
var data, filter, _b, _c, _d;
var _e;
return tslib_1.__generator(this, function (_f) {
switch (_f.label) {
case 0:
data = operation.data;
_b = data;
_c = {};
data = operation.data, filter = operation.filter;
_c = (_b = context).operate;
_d = ['wechatQrCode'];
_e = {};
return [4 /*yield*/, (0, uuid_1.generateNewIdAsync)()];
case 1:
_b.wechatQrCode$entity = (_c.id = _d.sent(),
_c.action = 'update',
_c.data = {
expired: true,
},
_c);
case 1: return [4 /*yield*/, _c.apply(_b, _d.concat([(_e.id = _f.sent(),
_e.action = 'update',
_e.data = {
expired: true,
},
_e.filter = {
wechatLogin: filter,
},
_e), {}]))];
case 2:
_f.sent();
return [2 /*return*/, 1];
}
});

View File

@ -163,7 +163,10 @@ const triggers: Trigger<EntityDict, 'userEntityGrant', RuntimeCxt>[] = [
}
);
if (result2.length) {
const e = new OakRowInconsistencyException<EntityDict>(undefined, '已领取该权限');
const e = new OakRowInconsistencyException<EntityDict>(
undefined,
'已领取该权限'
);
e.addData(userRelation, result2);
throw e;
} else {
@ -235,14 +238,22 @@ const triggers: Trigger<EntityDict, 'userEntityGrant', RuntimeCxt>[] = [
},
when: 'before',
fn: async ({ operation }, context) => {
const { data } = operation;
data.wechatQrCode$entity = {
id: await generateNewIdAsync(),
action: 'update',
data: {
expired: true,
const { data, filter } = operation;
await context.operate(
'wechatQrCode',
{
id: await generateNewIdAsync(),
action: 'update',
data: {
expired: true,
},
filter: {
userEntityGrant: filter,
},
},
};
{}
);
return 1;
},
} as UpdateTrigger<EntityDict, 'userEntityGrant', RuntimeCxt>,

View File

@ -68,14 +68,21 @@ const triggers: Trigger<EntityDict, 'wechatLogin', RuntimeCxt>[] = [
},
when: 'before',
fn: async ({ operation }, context) => {
const { data } = operation;
data.wechatQrCode$entity = {
id: await generateNewIdAsync(),
action: 'update',
data: {
expired: true,
const { data, filter } = operation;
await context.operate(
'wechatQrCode',
{
id: await generateNewIdAsync(),
action: 'update',
data: {
expired: true,
},
filter: {
wechatLogin: filter,
},
},
};
{}
);
return 1;
},
} as UpdateTrigger<EntityDict, 'wechatLogin', RuntimeCxt>,