Ver código fonte

Merge branch 'develop' of gitadmin/tuoheng_telecomumale into release

tags/v1.0.0^2
chengwang 1 ano atrás
pai
commit
50c7642ba8
2 arquivos alterados com 8 adições e 1 exclusões
  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 Ver arquivo

@@ -27,7 +27,7 @@ public class WxMessageRequest {
/**
*问题标题
*/
private String InspectionName;
private String inspectionName;

/**
* 问题描述

+ 7
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WxServiceImpl.java Ver arquivo

@@ -129,6 +129,7 @@ public class WxServiceImpl implements IWxService {
}
//缓存accessToken
accessToken = object.getString("access_token");
log.info("获取的accessToken的值:" + accessToken);
//设置accessToken的失效时间
Long expires_in = object.getLong("expires_in");
//失效时间 = 当前时间+有效期(提前一分钟,也可以不提前)
@@ -177,6 +178,12 @@ public class WxServiceImpl implements IWxService {

responseEntity = restTemplate.postForEntity(url, param, String.class);
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);
if(Objects.nonNull(jsonObject)){
log.info("openId:" + openId + "发送消息返回内容:" + jsonObject.toJSONString());

Carregando…
Cancelar
Salvar