From 087991c76f078defe5eb55d84223021b4199fb3d Mon Sep 17 00:00:00 2001 From: zss <zss@example.com> Date: 星期一, 17 二月 2025 11:22:50 +0800 Subject: [PATCH] 设备模块修改bug --- framework/src/main/java/com/yuanchu/mom/common/GetLook.java | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 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 d7a263c..dc80717 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,11 +18,16 @@ 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)); + Integer look = authMapper.countPower(id, method); + map.put("look", look==null?0:look); return map; } - } -- Gitblit v1.9.3