修复printPushLog 已定义但未被调用的问题

This commit is contained in:
bamanker
2026-01-14 13:32:09 +08:00
parent 3040cc261e
commit 922ab1b15a

View File

@@ -147,6 +147,7 @@ public class PushDailyController {
return mapper.readTree(tokenResp).get("access_token").asString();
})
.flatMap(accessToken -> wechatRequestService.sendMsg(accessToken, resultVo)
.doOnNext(this::printPushLog)
.onErrorMap(throwable -> new PushException("发送微信消息失败: " + throwable.getMessage(), throwable)));
} catch (Exception e) {
log.error("处理晚安推送数据时发生错误", e);
@@ -257,6 +258,7 @@ public class PushDailyController {
return mapper.readTree(tokenResp).get("access_token").asString();
})
.flatMap(accessToken -> wechatRequestService.sendMsg(accessToken, resultVo)
.doOnNext(this::printPushLog)
.onErrorMap(throwable -> new PushException("发送微信消息失败: " + throwable.getMessage(), throwable)));
} catch (Exception e) {
log.error("处理早安推送数据时发生错误", e);
@@ -272,8 +274,8 @@ public class PushDailyController {
*/
private void printPushLog(String responseStr) {
JsonNode jsonNode = mapper.readTree(responseStr);
String msgCode = jsonNode.get("errcode").asText();
String msgContent = jsonNode.get("errmsg").asText();
String msgCode = jsonNode.get("errcode").asString();
String msgContent = jsonNode.get("errmsg").asString();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("[ " + dateFormat.format(new Date()) + " ] : messageCode=" + msgCode + ",messageContent=" + msgContent);
}