Browse Source

Merge branch 'develop' of gitadmin/tuoheng_telecomumale into release

tags/v1.0.0^2
chengwang 1 year ago
parent
commit
50c7642ba8
2 changed files with 8 additions and 1 deletions
  1. +1
    -1
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/wx/WxMessageRequest.java
  2. +7
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WxServiceImpl.java

+ 1
- 1
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/wx/WxMessageRequest.java View File

/** /**
*问题标题 *问题标题
*/ */
private String InspectionName;
private String inspectionName;


/** /**
* 问题描述 * 问题描述

+ 7
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WxServiceImpl.java View File

} }
//缓存accessToken //缓存accessToken
accessToken = object.getString("access_token"); accessToken = object.getString("access_token");
log.info("获取的accessToken的值:" + accessToken);
//设置accessToken的失效时间 //设置accessToken的失效时间
Long expires_in = object.getLong("expires_in"); Long expires_in = object.getLong("expires_in");
//失效时间 = 当前时间+有效期(提前一分钟,也可以不提前) //失效时间 = 当前时间+有效期(提前一分钟,也可以不提前)


responseEntity = restTemplate.postForEntity(url, param, String.class); responseEntity = restTemplate.postForEntity(url, param, String.class);
String messageBody = responseEntity.getBody(); String messageBody = responseEntity.getBody();
Integer errcode = JSONObject.parseObject(messageBody).getInteger("errcode").intValue();
if(errcode != null && errcode != 0){
String errmsg = JSONObject.parseObject(messageBody).getString("errmsg");
log.info("请求accessToken失败,返回码:" + errcode.intValue() + "错误信息:" + errmsg);
return JsonResult.error(errcode.intValue(),errmsg);
}
JSONObject jsonObject = JSON.parseObject(messageBody); JSONObject jsonObject = JSON.parseObject(messageBody);
if(Objects.nonNull(jsonObject)){ if(Objects.nonNull(jsonObject)){
log.info("openId:" + openId + "发送消息返回内容:" + jsonObject.toJSONString()); log.info("openId:" + openId + "发送消息返回内容:" + jsonObject.toJSONString());

Loading…
Cancel
Save