From 76e9c5e0231758f646d7da7c8adfc21c24231a67 Mon Sep 17 00:00:00 2001 From: zhangjinli Date: Fri, 1 Jul 2022 15:35:38 +0800 Subject: [PATCH] zh --- .../controller/manage/VideoController.java | 14 ++++++++++---- .../java/com/zh/project0512/utils/HttpUtil.java | 3 ++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/zh/project0512/controller/manage/VideoController.java b/src/main/java/com/zh/project0512/controller/manage/VideoController.java index e27ef34..81087f9 100644 --- a/src/main/java/com/zh/project0512/controller/manage/VideoController.java +++ b/src/main/java/com/zh/project0512/controller/manage/VideoController.java @@ -30,6 +30,9 @@ import javax.validation.constraints.Max; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; /** @@ -133,6 +136,9 @@ public class VideoController { public Result valid(@Validated @RequestBody VVParam param) { int id = param.getId(); Video video = videoService.getById(id); + if(null == video){ + return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "未找到该视频"); + } Integer originEffectResult = video.getEffectResult() == null ? 0 : video.getEffectResult(); if (param.getStatus() == 3) { String reason = param.getReason(); @@ -190,10 +196,10 @@ public class VideoController { String touser = userService.getById(video.getUserId()).getUserid(); if (touser != null) { appMessage.setTouser(touser); -// List - JSONObject content_item = new JSONObject(); -// content_item.fluentPut("") - httpUtil.qywxMessage(httpUtil.qywxGetToken(),touser,"传播效果审核",null,appMessage.getUrl(),null); + List content_item = new ArrayList<>(); + content_item.add(new JSONObject().fluentPut("key","审核结果").fluentPut("value",appMessage.getDescription())); + content_item.add(new JSONObject().fluentPut("key","审核时间").fluentPut("value",LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))); + httpUtil.qywxMessage(httpUtil.qywxGetToken(),touser,"传播效果审核",null,appMessage.getUrl(),content_item); } AppMessageUtil.sendMessage(appMessage); return Result.success("", "审核完成"); diff --git a/src/main/java/com/zh/project0512/utils/HttpUtil.java b/src/main/java/com/zh/project0512/utils/HttpUtil.java index 707313c..27dc7d7 100644 --- a/src/main/java/com/zh/project0512/utils/HttpUtil.java +++ b/src/main/java/com/zh/project0512/utils/HttpUtil.java @@ -11,6 +11,7 @@ import java.io.*; import java.net.URL; import java.net.URLConnection; import java.nio.charset.StandardCharsets; +import java.util.List; /** * http工具类 @@ -75,7 +76,7 @@ public class HttpUtil { * @param wxAppUrl:点击消息卡片后的小程序页面,最长1024个字节,仅限本小程序内的页面。该字段不填则消息点击后不跳转。 * @param content_item:消息内容键值对,最多允许10个item */ - public void qywxMessage(String access_token,String touser, String title,String description,String wxAppUrl,JSONObject content_item) { + public void qywxMessage(String access_token, String touser, String title, String description, String wxAppUrl, List content_item) { JSONObject obj = new JSONObject(); obj.fluentPut("msgtype", "miniprogram_notice").fluentPut("agentid", agentid).fluentPut("touser", touser) .fluentPut("miniprogram_notice",