店铺切换修改

This commit is contained in:
张松
2025-09-27 15:16:05 +08:00
parent 3227be2aa2
commit 670ef1f87b
2 changed files with 4 additions and 2 deletions

View File

@@ -83,6 +83,7 @@ public class MyStpLogic {
logic.createLoginSession(id);
session = logic.getSession();
}
// 主店没有headShopId
Object parentId1 = session.get("headShopId");
if (!isMain && parentId1 == null) {
session.set("headId", headId);

View File

@@ -181,10 +181,11 @@ public class AuthorizationServiceImpl implements AuthorizationService {
@Override
public void switchTo(Long sysUserId) {
// 暂时通过headId判断主店账号
Long headId = StpKit.USER.getHeadId();
long shopId = StpKit.USER.getLoginIdAsLong();
ShopInfo currentInfo = shopInfoService.getById(shopId);
if (currentInfo.getIsHeadShop() != YesNoEnum.YES.value()) {
if (headId != null && currentInfo.getIsHeadShop() != YesNoEnum.YES.value()) {
throw new ApiNotPrintException("登录账号无权限切换");
}
@@ -199,7 +200,7 @@ public class AuthorizationServiceImpl implements AuthorizationService {
}
// 主店铺切换子店铺
if (!shopInfo.getMainId().equals(shopId)) {
if (headId != null && !shopInfo.getMainId().equals(shopId)) {
throw new ApiNotPrintException("目标店铺非登录账号所有");
}