ApiNotPrintException 改为 CzgException

This commit is contained in:
2025-11-13 17:15:11 +08:00
parent d05a52f98e
commit 134a7aae85
45 changed files with 199 additions and 385 deletions

View File

@@ -1,10 +1,8 @@
package com.czg.handler;
import cn.dev33.satoken.annotation.handler.SaAnnotationHandlerInterface;
import cn.hutool.core.util.StrUtil;
import com.czg.annotation.SaCheckMainShop;
import com.czg.annotation.SaStaffCheckPermission;
import com.czg.exception.ApiNotPrintException;
import com.czg.exception.CzgException;
import com.czg.sa.StpKit;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@@ -28,7 +26,7 @@ public class SaCheckMainShopHandler implements SaAnnotationHandlerInterface<SaCh
public void checkMethod(SaCheckMainShop at, Method method) {
boolean mainShop = StpKit.USER.isMainShop();
if (!mainShop) {
throw new ApiNotPrintException("此接口仅主店可操作");
throw new CzgException("此接口仅主店可操作");
}
}
}

View File

@@ -13,7 +13,6 @@ import cn.dev33.satoken.stp.SaLoginModel;
import cn.dev33.satoken.stp.SaTokenInfo;
import cn.dev33.satoken.stp.StpLogic;
import cn.hutool.core.util.StrUtil;
import com.czg.exception.ApiNotPrintException;
import com.czg.exception.CzgException;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
@@ -105,7 +104,7 @@ public class MyStpLogic {
StpLogic logic = getLogic();
logic.login(id);
if (loginType.equals(LoginType.MANAGER) && shopId == null) {
throw new ApiNotPrintException("管理端登录必须传递店铺id");
throw new CzgException("管理端登录必须传递店铺id");
}
SaSession session = logic.getSession().set("userId", id).set("isAdmin", isAdmin).set("isManager", loginType.equals(LoginType.MANAGER))
.set("platForm", platForm)
@@ -234,7 +233,7 @@ public class MyStpLogic {
// }
if (defaultValue.length == 0 && shopId == null) {
throw new ApiNotPrintException(errType == 0 ? "shopId获取失败" : "客户端请求头未携带shopId");
throw new CzgException(errType == 0 ? "shopId获取失败" : "客户端请求头未携带shopId");
}
return shopId == null ? defaultVal : shopId;
}