From d1c0624efc573ecda6ecde32b3420374f5819848 Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Thu, 29 Jun 2023 20:12:26 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96token?= =?UTF-8?q?=E7=9A=84=E6=8A=A5=E9=94=99=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mt/service/impl/MtFactoryDataServiceImpl.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java index 0c3319ffa..38d194f1b 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java @@ -217,12 +217,19 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { JSONObject jsonObject = JSONObject.parseObject(result); logger.info("##############getMengtianToken: 获取梦天token返回参数 {}",result); + Integer code = jsonObject.getInteger("Result"); String access_token = jsonObject.getString("Data"); - if(StringUtil.hasLength(access_token)){ - mtToken= access_token; - // 加入redis - bladeRedis.setEx("mt_token",mtToken,25*60L); + if(0 == code){ + if(StringUtil.hasLength(access_token)){ + mtToken= access_token; + // 加入redis + bladeRedis.setEx("mt_token",mtToken,25*60L); + }else{ + log.warn("###############getMengtianToken: 获取梦天token失败 access_token={}",access_token); + throw new CustomerException(402,"获取梦天token失败"); + } }else{ + log.warn("###############getMengtianToken: 获取梦天token失败 code={}",code); throw new CustomerException(402,"获取梦天token失败"); } }