From bceaa28d1581c647194e2c0b166b6aa743cd1cf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E7=94=B2=E4=BB=91?= Date: Mon, 6 Jun 2022 14:08:10 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E9=87=8D=E5=A4=8D=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/org/yameida/worktool/Demo.kt | 37 ------------------- .../worktool/service/WeworkLoopImpl.kt | 36 ++---------------- 2 files changed, 3 insertions(+), 70 deletions(-) diff --git a/app/src/main/java/org/yameida/worktool/Demo.kt b/app/src/main/java/org/yameida/worktool/Demo.kt index 8f38684..c4c703f 100644 --- a/app/src/main/java/org/yameida/worktool/Demo.kt +++ b/app/src/main/java/org/yameida/worktool/Demo.kt @@ -81,41 +81,4 @@ object Demo { // }) } - //通过好友请求后执行三中院脚本 - fun test2(name: String) { - val groupName = "(北)诉前调解群05011" - val json = """ - { - "socketType": 2, - "messageId": "", - "list": [ - { - "type": 203, - "titleList": [ - "$name" - ], - "receivedContent": "您好,您好我是某某法院机器人助理,很高兴为您服务,请先填写个人信息,我们将为您联系案件相关法官。\nhttps://www.wjx.cn/vj/OjVAA02.aspx" - }, - { - "type": 203, - "titleList": [ - "$name" - ], - "receivedContent": "您好,已为您查询到本案法官,开始建群中,请稍后..." - }, - { - "type": 206, - "groupName": "$groupName", - "selectList": [ - "$name", - "尹甲仑" - ], - "groupAnnouncement": "本群为诉前调解官方微信群" - } - ] - } - """.trimIndent() - MyLooper.onMessage(null, json) - } - } \ No newline at end of file diff --git a/app/src/main/java/org/yameida/worktool/service/WeworkLoopImpl.kt b/app/src/main/java/org/yameida/worktool/service/WeworkLoopImpl.kt index 9df5332..1e9ca2a 100644 --- a/app/src/main/java/org/yameida/worktool/service/WeworkLoopImpl.kt +++ b/app/src/main/java/org/yameida/worktool/service/WeworkLoopImpl.kt @@ -17,37 +17,6 @@ object WeworkLoopImpl { var logIndex = 0 -// @Synchronized -// fun mainLoop() { -// mainLoopRunning = true -// if (!threadStart) { -// threadStart = true -// thread { -// while (true) { -// try { -// if (mainLoopRunning) { -// goHomeTab("消息") -// //todo 下上滚动 -// if (mainLoopRunning && getChatroomList()) { -// if (mainLoopRunning) -// getChatMessageList() -// mainLoopRunning = false -// } -// if (mainLoopRunning) { -// getFriendRequest() -// } -// } -// sleep(1000) -// } catch (e: Exception) { -// LogUtils.e(e) -// error(e.printStackTrace()) -// mainLoopRunning = false -// } -// } -// } -// } -// } - fun mainLoop() { mainLoopRunning = true try { @@ -99,7 +68,6 @@ object WeworkLoopImpl { if (nameList.isEmpty()) break //TODO nameList 通过的好友加入演示脚本 - Demo.test2(nameList[0]) } return true } else { @@ -337,7 +305,9 @@ object WeworkLoopImpl { val text = item.text.toString() sb.append(text).append("/t") val itemMessage = WeworkMessageBean.ItemMessageBean(0, text) - itemMessageList.add(itemMessage) + if (itemMessageList.count { it.feature == 0 && it.text == text } == 0) { + itemMessageList.add(itemMessage) + } } LogUtils.d(sb.toString()) message = WeworkMessageBean.SubMessageBean(2, 0, itemMessageList, nameList)