获取shopId
This commit is contained in:
@@ -61,6 +61,7 @@ public class MyStpLogic {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前登录账号名称 管理端为用户账号 客户端为openId
|
* 获取当前登录账号名称 管理端为用户账号 客户端为openId
|
||||||
|
*
|
||||||
* @return 账号或openId
|
* @return 账号或openId
|
||||||
*/
|
*/
|
||||||
public String getAccount() {
|
public String getAccount() {
|
||||||
@@ -77,10 +78,9 @@ public class MyStpLogic {
|
|||||||
public Long getShopId(Long... defaultValue) {
|
public Long getShopId(Long... defaultValue) {
|
||||||
StpLogic logic = getLogic();
|
StpLogic logic = getLogic();
|
||||||
Long defaultVal = defaultValue.length > 0 ? defaultValue[0] : null;
|
Long defaultVal = defaultValue.length > 0 ? defaultValue[0] : null;
|
||||||
Object object = logic.getSession().get("isManager");
|
|
||||||
Long shopId;
|
Long shopId;
|
||||||
int errType;
|
int errType;
|
||||||
if (object instanceof Boolean t && t) {
|
if ("admin".equals(logic.getLoginType())) {
|
||||||
Object info = logic.getSession().get("shopId");
|
Object info = logic.getSession().get("shopId");
|
||||||
shopId = info instanceof Long l ? l : null;
|
shopId = info instanceof Long l ? l : null;
|
||||||
errType = 0;
|
errType = 0;
|
||||||
@@ -95,6 +95,25 @@ public class MyStpLogic {
|
|||||||
}
|
}
|
||||||
errType = 1;
|
errType = 1;
|
||||||
}
|
}
|
||||||
|
// Long defaultVal = defaultValue.length > 0 ? defaultValue[0] : null;
|
||||||
|
// Object object = logic.getSession().get("isManager");
|
||||||
|
// Long shopId;
|
||||||
|
// int errType;
|
||||||
|
// if (object instanceof Boolean t && t) {
|
||||||
|
// Object info = logic.getSession().get("shopId");
|
||||||
|
// shopId = info instanceof Long l ? l : null;
|
||||||
|
// errType = 0;
|
||||||
|
// } else {
|
||||||
|
// SaRequest request = SaHolder.getRequest();
|
||||||
|
// String requestParam = request.getParam("shopId");
|
||||||
|
// if (StrUtil.isBlank(requestParam)) {
|
||||||
|
// String header = request.getHeader("shopId");
|
||||||
|
// shopId = StrUtil.isBlank(header) ? null : Long.parseLong(header);
|
||||||
|
// }else {
|
||||||
|
// shopId = Long.parseLong(requestParam);
|
||||||
|
// }
|
||||||
|
// errType = 1;
|
||||||
|
// }
|
||||||
|
|
||||||
if (defaultValue.length == 0 && shopId == null) {
|
if (defaultValue.length == 0 && shopId == null) {
|
||||||
throw new ApiNotPrintException(errType == 0 ? "shopId获取失败" : "客户端请求头未携带shopId");
|
throw new ApiNotPrintException(errType == 0 ? "shopId获取失败" : "客户端请求头未携带shopId");
|
||||||
|
|||||||
Reference in New Issue
Block a user