fix
This commit is contained in:
parent
c313da8d5c
commit
8670d609ba
1 changed files with 12 additions and 16 deletions
|
|
@ -71,9 +71,8 @@ export class PermissionController extends Controller {
|
||||||
orgRevision?.id
|
orgRevision?.id
|
||||||
);
|
);
|
||||||
|
|
||||||
// ใช้ cache key ที่รวมสถานะ acting
|
// ใช้ cache key เดิม และตรวจสอบสถานะ acting ทุกครั้ง
|
||||||
const cacheKey = `role_${profile.id}_${actingData.isAct ? 'acting' : 'normal'}`;
|
let reply = await getAsync("role_" + profile.id);
|
||||||
let reply = await getAsync(cacheKey);
|
|
||||||
if (reply != null) {
|
if (reply != null) {
|
||||||
reply = JSON.parse(reply);
|
reply = JSON.parse(reply);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -253,7 +252,7 @@ export class PermissionController extends Controller {
|
||||||
isActing: false,
|
isActing: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
redisClient.setex(cacheKey, 86400, JSON.stringify(reply));
|
redisClient.setex("role_" + profile.id, 86400, JSON.stringify(reply));
|
||||||
}
|
}
|
||||||
return new HttpSuccess(reply);
|
return new HttpSuccess(reply);
|
||||||
}
|
}
|
||||||
|
|
@ -295,9 +294,8 @@ export class PermissionController extends Controller {
|
||||||
orgRevision?.id
|
orgRevision?.id
|
||||||
);
|
);
|
||||||
|
|
||||||
// ใช้ cache key แบบเดียวกับ getPermission
|
// ใช้ cache key เดิม
|
||||||
const cacheKey = `menu_${profile.id}_${actingData.isAct ? 'acting' : 'normal'}`;
|
let reply = await getAsync("menu_" + profile.id);
|
||||||
let reply = await getAsync(cacheKey);
|
|
||||||
if (reply != null) {
|
if (reply != null) {
|
||||||
reply = JSON.parse(reply);
|
reply = JSON.parse(reply);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -414,7 +412,7 @@ export class PermissionController extends Controller {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
redisClient.setex(cacheKey, 86400, JSON.stringify(reply));
|
redisClient.setex("menu_" + profile.id, 86400, JSON.stringify(reply));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new HttpSuccess(reply);
|
return new HttpSuccess(reply);
|
||||||
|
|
@ -883,9 +881,8 @@ export class PermissionController extends Controller {
|
||||||
orgRevision?.id
|
orgRevision?.id
|
||||||
);
|
);
|
||||||
|
|
||||||
// ใช้ cache key แบบเดียวกับ getPermission()
|
// ใช้ cache key เดิม
|
||||||
const cacheKey = `role_${profile.id}_${actingData.isAct ? 'acting' : 'normal'}`;
|
let reply = await getAsync("role_" + profile.id);
|
||||||
let reply = await getAsync(cacheKey);
|
|
||||||
if (reply != null) {
|
if (reply != null) {
|
||||||
reply = JSON.parse(reply);
|
reply = JSON.parse(reply);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1054,7 +1051,7 @@ export class PermissionController extends Controller {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
redisClient.setex(cacheKey, 86400, JSON.stringify(reply));
|
redisClient.setex("role_" + profile.id, 86400, JSON.stringify(reply));
|
||||||
}
|
}
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
@ -1118,9 +1115,8 @@ export class PermissionController extends Controller {
|
||||||
orgRevision?.id
|
orgRevision?.id
|
||||||
);
|
);
|
||||||
|
|
||||||
// ใช้ cache key แบบใหม่
|
// ใช้ cache key เดิม
|
||||||
const cacheKey = `posMaster_${profile.id}_${actingData.isAct ? 'acting' : 'normal'}`;
|
let reply = await getAsync("posMaster_" + profile.id);
|
||||||
let reply = await getAsync(cacheKey);
|
|
||||||
if (reply != null) {
|
if (reply != null) {
|
||||||
reply = JSON.parse(reply);
|
reply = JSON.parse(reply);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1152,7 +1148,7 @@ export class PermissionController extends Controller {
|
||||||
reply = await this.getBaseOrgScope(profile.id, orgRevision?.id, profileType, privilege);
|
reply = await this.getBaseOrgScope(profile.id, orgRevision?.id, profileType, privilege);
|
||||||
}
|
}
|
||||||
|
|
||||||
redisClient.setex(cacheKey, 86400, JSON.stringify(reply));
|
redisClient.setex("posMaster_" + profile.id, 86400, JSON.stringify(reply));
|
||||||
}
|
}
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue