update 获取全部群成员
This commit is contained in:
@@ -50,6 +50,8 @@ public class WeworkMessageBean {
|
|||||||
* 获取我的信息 GET_MY_INFO
|
* 获取我的信息 GET_MY_INFO
|
||||||
* 获取最近聊天列表 GET_RECENT_LIST
|
* 获取最近聊天列表 GET_RECENT_LIST
|
||||||
* 获取企业列表 GET_CORP_LIST
|
* 获取企业列表 GET_CORP_LIST
|
||||||
|
* 获取全部好友信息 GET_ALL_FRIEND_INFO
|
||||||
|
* 获取全部群信息 GET_ALL_GROUP_INFO
|
||||||
*/
|
*/
|
||||||
public static final int HEART_BEAT = 11;
|
public static final int HEART_BEAT = 11;
|
||||||
public static final int TYPE_RECEIVE_MESSAGE_LIST = 101;
|
public static final int TYPE_RECEIVE_MESSAGE_LIST = 101;
|
||||||
@@ -90,6 +92,8 @@ public class WeworkMessageBean {
|
|||||||
public static final int GET_GROUP_QRCODE = 504;
|
public static final int GET_GROUP_QRCODE = 504;
|
||||||
public static final int GET_RECENT_LIST = 505;
|
public static final int GET_RECENT_LIST = 505;
|
||||||
public static final int GET_CORP_LIST = 506;
|
public static final int GET_CORP_LIST = 506;
|
||||||
|
public static final int GET_ALL_FRIEND_INFO = 507;
|
||||||
|
public static final int GET_ALL_GROUP_INFO = 508;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* roomType
|
* roomType
|
||||||
|
|||||||
@@ -192,6 +192,12 @@ object MyLooper {
|
|||||||
WeworkMessageBean.GET_RECENT_LIST -> {
|
WeworkMessageBean.GET_RECENT_LIST -> {
|
||||||
WeworkController.getRecentList(message)
|
WeworkController.getRecentList(message)
|
||||||
}
|
}
|
||||||
|
WeworkMessageBean.GET_ALL_FRIEND_INFO -> {
|
||||||
|
WeworkController.getAllFriendInfo(message)
|
||||||
|
}
|
||||||
|
WeworkMessageBean.GET_ALL_GROUP_INFO -> {
|
||||||
|
WeworkController.getAllGroupInfo(message)
|
||||||
|
}
|
||||||
WeworkMessageBean.GET_CORP_LIST -> {
|
WeworkMessageBean.GET_CORP_LIST -> {
|
||||||
WeworkController.getCorpList(message)
|
WeworkController.getCorpList(message)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -417,6 +417,26 @@ object WeworkController {
|
|||||||
return WeworkGetImpl.getFriendInfo(message, message.selectList)
|
return WeworkGetImpl.getFriendInfo(message, message.selectList)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取全部好友信息
|
||||||
|
* @see WeworkMessageBean.GET_ALL_FRIEND_INFO
|
||||||
|
*/
|
||||||
|
@RequestMapping
|
||||||
|
fun getAllFriendInfo(message: WeworkMessageBean): Boolean {
|
||||||
|
LogUtils.d("getAllFriendInfo():")
|
||||||
|
return WeworkGetImpl.getAllFriendInfo(message)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取全部群信息
|
||||||
|
* @see WeworkMessageBean.GET_ALL_GROUP_INFO
|
||||||
|
*/
|
||||||
|
@RequestMapping
|
||||||
|
fun getAllGroupInfo(message: WeworkMessageBean): Boolean {
|
||||||
|
LogUtils.d("getAllGroupInfo():")
|
||||||
|
return WeworkGetImpl.getAllGroupInfo(message)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取我的信息
|
* 获取我的信息
|
||||||
* @see WeworkMessageBean.GET_MY_INFO
|
* @see WeworkMessageBean.GET_MY_INFO
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ package org.yameida.worktool.service
|
|||||||
import com.blankj.utilcode.util.GsonUtils
|
import com.blankj.utilcode.util.GsonUtils
|
||||||
import com.blankj.utilcode.util.LogUtils
|
import com.blankj.utilcode.util.LogUtils
|
||||||
import org.yameida.worktool.Constant
|
import org.yameida.worktool.Constant
|
||||||
|
import org.yameida.worktool.model.ExecCallbackBean
|
||||||
import org.yameida.worktool.model.WeworkMessageBean
|
import org.yameida.worktool.model.WeworkMessageBean
|
||||||
|
import org.yameida.worktool.utils.AccessibilityExtraUtil
|
||||||
import org.yameida.worktool.utils.AccessibilityUtil
|
import org.yameida.worktool.utils.AccessibilityUtil
|
||||||
import org.yameida.worktool.utils.Views
|
import org.yameida.worktool.utils.Views
|
||||||
import org.yameida.worktool.utils.WeworkRoomUtil
|
import org.yameida.worktool.utils.WeworkRoomUtil
|
||||||
@@ -36,6 +38,67 @@ object WeworkGetImpl {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取全部好友信息
|
||||||
|
* @see WeworkMessageBean.GET_ALL_FRIEND_INFO
|
||||||
|
*/
|
||||||
|
fun getAllFriendInfo(message: WeworkMessageBean): Boolean {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取全部群信息
|
||||||
|
* @see WeworkMessageBean.GET_ALL_GROUP_INFO
|
||||||
|
*/
|
||||||
|
fun getAllGroupInfo(message: WeworkMessageBean): Boolean {
|
||||||
|
val startTime = System.currentTimeMillis()
|
||||||
|
goHomeTab("通讯录")
|
||||||
|
sleep(Constant.CHANGE_PAGE_INTERVAL)
|
||||||
|
AccessibilityUtil.scrollToTop(WeworkController.weworkService, getRoot())
|
||||||
|
if (AccessibilityUtil.findTextAndClick(getRoot(), "群聊", exact = true)) {
|
||||||
|
AccessibilityExtraUtil.loadingPage("GroupSavedListActivity")
|
||||||
|
val list = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView)
|
||||||
|
if (list == null) {
|
||||||
|
LogUtils.e("未找到群聊列表")
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.ERROR_BUTTON, "未找到群聊列表", startTime)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
val set = linkedSetOf<String>()
|
||||||
|
val onScrollListener = object : AccessibilityUtil.OnScrollListener() {
|
||||||
|
override fun onScroll(): Boolean {
|
||||||
|
if (!AccessibilityExtraUtil.loadingPage("GroupSavedListActivity")) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
list.refresh()
|
||||||
|
AccessibilityUtil.findAllOnceByClazz(list, Views.TextView).map {
|
||||||
|
val groupName = it.text?.toString()
|
||||||
|
if (groupName != null && !groupName.matches("(.*个)?群聊".toRegex()) && set.add(groupName)) {
|
||||||
|
//无需处理
|
||||||
|
}
|
||||||
|
false
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//滚动前先获取一次
|
||||||
|
onScrollListener.onScroll()
|
||||||
|
AccessibilityUtil.scrollToBottom(WeworkController.weworkService, list, listener = onScrollListener, maxRetry = 100)
|
||||||
|
LogUtils.d("群数量: ${set.size} 群列表: ${set.joinToString()}")
|
||||||
|
for (groupName in set) {
|
||||||
|
if (WeworkRoomUtil.intoRoom(groupName) && WeworkRoomUtil.intoGroupManager()) {
|
||||||
|
val groupInfo = getGroupInfoDetail(saveAddress = false, saveMembers = true)
|
||||||
|
WeworkController.weworkService.webSocketManager.send(groupInfo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.SUCCESS, "", startTime)
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
LogUtils.e("未找到群聊入口")
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.ERROR_BUTTON, "未找到群聊入口", startTime)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取我的信息
|
* 获取我的信息
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user