店铺切换修改
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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("目标店铺非登录账号所有");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user