张延森 il y a 3 ans
Parent
révision
c7b5167ac6

+ 16
- 11
src/main/java/com/yunzhi/marketing/service/impl/TaChatServiceImpl.java Voir le fichier

@@ -141,18 +141,23 @@ public class TaChatServiceImpl extends ServiceImpl<TaChatMapper, TaChat> impleme
141 141
 
142 142
             boolean isOnline = ChatServer.isOnline(to.getPersonId());
143 143
             if (!isOnline && null != from) {
144
-                // 推送微信消息
145
-                String[] its = {
146
-                        String.format("sendId=%s", from.getPersonId()),
147
-                        String.format("sendName=%s", StringUtils.urlEncode(StringUtils.ifNull(from.getName(), from.getNickname()))),
148
-                        String.format("receiverId=%s", to.getPersonId()),
149
-                        String.format("receiverName=%s", StringUtils.urlEncode(StringUtils.ifNull(to.getName(), to.getNickname())))
150
-                };
151
-                String link = "/pages/im/index?"+String.join("&", its);
152
-
153
-                miniAppService.sendNoticeMessage(to, link, StringUtils.ifNull(from.getName(), from.getNickname()), StringUtils.ifNull(from.getTel(), from.getPhone()), "给您发送了一条新消息, 请查收", LocalDateTime.now());
144
+                try {
145
+                    // 推送微信消息
146
+                    String[] its = {
147
+                            String.format("sendId=%s", from.getPersonId()),
148
+                            String.format("sendName=%s", StringUtils.urlEncode(StringUtils.ifNull(from.getName(), from.getNickname()))),
149
+                            String.format("receiverId=%s", to.getPersonId()),
150
+                            String.format("receiverName=%s", StringUtils.urlEncode(StringUtils.ifNull(to.getName(), to.getNickname())))
151
+                    };
152
+                    String link = "/pages/im/index?"+String.join("&", its);
153
+
154
+                    miniAppService.sendNoticeMessage(to, link, StringUtils.ifNull(from.getName(), from.getNickname()), StringUtils.ifNull(from.getTel(), from.getPhone()), "给您发送了一条新消息, 请查收", LocalDateTime.now());
155
+
156
+                } catch (Exception e) {
157
+                    e.printStackTrace();
158
+                }
154 159
             } else {
155
-//                taChat.setIsRead(CommConstant.MESSAGE_READED);
160
+                taChat.setIsRead(CommConstant.MESSAGE_READED);
156 161
             }
157 162
         }
158 163