From eb1a57285bb3468a4efe051781b8cc7a13ec23c6 Mon Sep 17 00:00:00 2001 From: value <z1292839451@163.com> Date: 星期二, 14 五月 2024 14:15:06 +0800 Subject: [PATCH] 部分调整 --- framework/src/main/java/com/yuanchu/mom/common/GetLook.java | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/framework/src/main/java/com/yuanchu/mom/common/GetLook.java b/framework/src/main/java/com/yuanchu/mom/common/GetLook.java index 9920bd0..0f70017 100644 --- a/framework/src/main/java/com/yuanchu/mom/common/GetLook.java +++ b/framework/src/main/java/com/yuanchu/mom/common/GetLook.java @@ -1,6 +1,7 @@ package com.yuanchu.mom.common; import cn.hutool.json.JSONUtil; +import com.yuanchu.mom.exception.ErrorException; import com.yuanchu.mom.mapper.AuthMapper; import com.yuanchu.mom.utils.Jwt; import com.yuanchu.mom.utils.ServletUtils; @@ -17,7 +18,12 @@ private AuthMapper authMapper; public Map<String, Integer> selectPowerByMethodAndUserId(String method){ - Integer id = Integer.parseInt(JSONUtil.parseObj(new Jwt().readJWT(ServletUtils.getRequest().getHeader("token")).get("data")).get("id")+""); + Integer id; + try { + id = Integer.parseInt(JSONUtil.parseObj(new Jwt().readJWT(ServletUtils.getRequest().getHeader("token")).get("data")).get("id")+""); + }catch (NumberFormatException e){ + throw new ErrorException("鎺堟潈宸茶繃鏈熻閲嶆柊鐧婚檰"); + } Map<String, Integer> map = new HashMap<>(); map.put("userId", id); map.put("look", authMapper.countPower(id, method)); -- Gitblit v1.9.3