This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-05-07 15:24:09 +07:00
parent c313da8d5c
commit 8670d609ba

View file

@ -71,9 +71,8 @@ export class PermissionController extends Controller {
orgRevision?.id
);
// ใช้ cache key ที่รวมสถานะ acting
const cacheKey = `role_${profile.id}_${actingData.isAct ? 'acting' : 'normal'}`;
let reply = await getAsync(cacheKey);
// ใช้ cache key เดิม และตรวจสอบสถานะ acting ทุกครั้ง
let reply = await getAsync("role_" + profile.id);
if (reply != null) {
reply = JSON.parse(reply);
} else {
@ -253,7 +252,7 @@ export class PermissionController extends Controller {
isActing: false,
};
}
redisClient.setex(cacheKey, 86400, JSON.stringify(reply));
redisClient.setex("role_" + profile.id, 86400, JSON.stringify(reply));
}
return new HttpSuccess(reply);
}
@ -295,9 +294,8 @@ export class PermissionController extends Controller {
orgRevision?.id
);
// ใช้ cache key แบบเดียวกับ getPermission
const cacheKey = `menu_${profile.id}_${actingData.isAct ? 'acting' : 'normal'}`;
let reply = await getAsync(cacheKey);
// ใช้ cache key เดิม
let reply = await getAsync("menu_" + profile.id);
if (reply != null) {
reply = JSON.parse(reply);
} 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);
@ -883,9 +881,8 @@ export class PermissionController extends Controller {
orgRevision?.id
);
// ใช้ cache key แบบเดียวกับ getPermission()
const cacheKey = `role_${profile.id}_${actingData.isAct ? 'acting' : 'normal'}`;
let reply = await getAsync(cacheKey);
// ใช้ cache key เดิม
let reply = await getAsync("role_" + profile.id);
if (reply != null) {
reply = JSON.parse(reply);
} 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;
}
@ -1118,9 +1115,8 @@ export class PermissionController extends Controller {
orgRevision?.id
);
// ใช้ cache key แบบใหม่
const cacheKey = `posMaster_${profile.id}_${actingData.isAct ? 'acting' : 'normal'}`;
let reply = await getAsync(cacheKey);
// ใช้ cache key เดิม
let reply = await getAsync("posMaster_" + profile.id);
if (reply != null) {
reply = JSON.parse(reply);
} else {
@ -1152,7 +1148,7 @@ export class PermissionController extends Controller {
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;
}