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失败"); } }