|
@@ -503,7 +503,7 @@ public class WeComMessageDataJob {
|
|
|
sendMessage.setIsSend(0);
|
|
|
sendMessage.setCreateTime(DateUtil.getThatDayDate());
|
|
|
List<String> sendUserList = sendMessageMapper.selectExternalUserId(sendMessage);
|
|
|
- boolean flag = pushMessage(sendUserList, sendMessage, false, false, false);
|
|
|
+ boolean flag = pushMessage(sendUserList, sendMessage, false, false, true);
|
|
|
if (flag) {
|
|
|
SendMessage updateSendMessage = new SendMessage();
|
|
|
updateSendMessage.setIsSend(1);
|
|
@@ -531,56 +531,26 @@ public class WeComMessageDataJob {
|
|
|
// String content = messageService.getMessageText();
|
|
|
// text.put("content", content);
|
|
|
text.put("content", "现在有空唠唠嗑、解解闷吗?\uD83C\uDF39\n" +
|
|
|
- "刚发现好多有趣视频想分享给您!偷偷告诉我——您平时最爱看【健康养生】、【历史故事】这类知识干货,还是【人生智慧】【怀旧经典】这些暖心内容呀?\n" +
|
|
|
- "(悄悄加个选项\uD83D\uDC49【祝福音乐】\uD83C\uDFB5,马上帮您找!)");
|
|
|
+ "芳华这儿还藏着【养生秘诀】和【搞笑段子】!您想先看哪个?");
|
|
|
jsonObject.put("text", text);
|
|
|
jsonObject.put("sender", staff.getCarrierId());
|
|
|
JSONArray attachments = new JSONArray();
|
|
|
if (hasMiniprogram) {
|
|
|
- List<Long> videoIdList = new ArrayList<>();
|
|
|
- videoIdList.add(sendMessage.getVideoId1());
|
|
|
-// videoIdList.add(sendMessage.getVideoId2());
|
|
|
-// videoIdList.add(sendMessage.getVideoId3());
|
|
|
- for (Long videoId : videoIdList) {
|
|
|
- JSONObject attachment = new JSONObject();
|
|
|
- attachment.put("msgtype", "miniprogram");
|
|
|
- MessageAttachmentExample example = new MessageAttachmentExample();
|
|
|
- example.createCriteria().andMiniprogramVideoIdEqualTo(videoId);
|
|
|
- List<MessageAttachment> messageAttachmentList = messageAttachmentMapper.selectByExample(example);
|
|
|
- if (CollectionUtils.isEmpty(messageAttachmentList)) {
|
|
|
- log.error("附件信息查询异常");
|
|
|
- return false;
|
|
|
- }
|
|
|
- MessageAttachment messageAttachment = messageAttachmentList.get(0);
|
|
|
- JSONObject miniprogram = new JSONObject();
|
|
|
- miniprogram.put("appid", MessageConstant.appid);
|
|
|
- String title = messageAttachment.getTitle();
|
|
|
- if (title.getBytes(StandardCharsets.UTF_8).length > MAX_BYTES) {
|
|
|
- title = ToolUtils.truncateString(title, MAX_BYTES - 3) + "...";
|
|
|
- }
|
|
|
- miniprogram.put("title", title);
|
|
|
- String picMediaId = messageAttachmentService.getPicMediaId(messageAttachment.getCover(), sendMessage.getCorpId());
|
|
|
- if (StringUtils.isEmpty(picMediaId)) {
|
|
|
- log.error("pushMessage getPicMediaId error cover={}", messageAttachment.getCover());
|
|
|
- return false;
|
|
|
- }
|
|
|
- miniprogram.put("pic_media_id", picMediaId);
|
|
|
- String page = "";
|
|
|
- String key = staff.getCarrierId() + "_" + videoId;
|
|
|
- if (pageMap.containsKey(key)) {
|
|
|
- page = pageMap.get(key);
|
|
|
- } else {
|
|
|
- page = messageAttachmentService.getPage(staff, videoId);
|
|
|
- pageMap.put(key, page);
|
|
|
- }
|
|
|
- if (StringUtils.isEmpty(page)) {
|
|
|
- log.error("pushMessage get page error videoId={} staff={}", videoId, staff);
|
|
|
- return false;
|
|
|
- }
|
|
|
- miniprogram.put("page", page);
|
|
|
- attachment.put("miniprogram", miniprogram);
|
|
|
- attachments.add(0, attachment);
|
|
|
+ JSONObject attachment = new JSONObject();
|
|
|
+ attachment.put("msgtype", "miniprogram");
|
|
|
+ JSONObject miniprogram = new JSONObject();
|
|
|
+ miniprogram.put("appid", MessageConstant.appid);
|
|
|
+ String title = "男人饭桌讲话金句频出,太有才了";
|
|
|
+ if (title.getBytes(StandardCharsets.UTF_8).length > MAX_BYTES) {
|
|
|
+ title = ToolUtils.truncateString(title, MAX_BYTES - 3) + "...";
|
|
|
}
|
|
|
+ miniprogram.put("title", title);
|
|
|
+ String picMediaId = "3759FYrByynA2Nnv5zaDQMHCqzCrap1abCrgp_vzXYFEAu2v6UFvIHfDHnjeUEOoUu_1boMvU_FXwh4f4fDRLtg";
|
|
|
+ miniprogram.put("pic_media_id", picMediaId);
|
|
|
+ String page = "pages/category?jumpPage=pages%2Fuser-videos%3Fid%3D11480732%26fromGzh%3D1%26rootShareId%3D66019eef-d3fa-47ec-90a1-afca78f91cea%26shareId%3D66019eef-d3fa-47ec-90a1-afca78f91cea%26rootSourceId%3Dai_aiqw_20250306_11480732_10d6eefa";
|
|
|
+ miniprogram.put("page", page);
|
|
|
+ attachment.put("miniprogram", miniprogram);
|
|
|
+ attachments.add(0, attachment);
|
|
|
}
|
|
|
if (hasLink) {
|
|
|
JSONObject linkAttachment = new JSONObject();
|
|
@@ -596,7 +566,7 @@ public class WeComMessageDataJob {
|
|
|
if (hasImage) {
|
|
|
JSONObject imageAttachment = new JSONObject();
|
|
|
JSONObject image = new JSONObject();
|
|
|
- image.put("media_id", "3dwcynv0rajikHPx8_HQJEnH3WktW83AMS4kZAMlxC2g5Q6GNWb_a78mmMb7QiC5jepTnRn2nhrveUd8pBtYcJQ");
|
|
|
+ image.put("media_id", "37l52AubJfiaB5hWxpB0LrQrx1PuXm7GgrOAMXYZ2HoZgh7Qwr7_QHsic13SbRgtXQvK2LenXV6_qHBQeFDfk3g");
|
|
|
imageAttachment.put("msgtype", "image");
|
|
|
imageAttachment.put("image", image);
|
|
|
attachments.add(imageAttachment);
|