mirror of
https://github.com/whitechi73/OpenShamrock.git
synced 2024-08-14 13:12:17 +08:00
revert
This commit is contained in:
parent
0fb88e3e44
commit
81be383b5f
@ -179,7 +179,7 @@ internal object GroupSvc: BaseSvc() {
|
|||||||
|
|
||||||
var troopList = service.allTroopList
|
var troopList = service.allTroopList
|
||||||
if(refresh || !service.isTroopCacheInited || troopList == null) {
|
if(refresh || !service.isTroopCacheInited || troopList == null) {
|
||||||
if(!requestGroupList(service)) {
|
if(!requestGroupInfo(service)) {
|
||||||
return Result.failure(Exception("获取群列表失败"))
|
return Result.failure(Exception("获取群列表失败"))
|
||||||
} else {
|
} else {
|
||||||
troopList = service.allTroopList
|
troopList = service.allTroopList
|
||||||
@ -192,17 +192,10 @@ internal object GroupSvc: BaseSvc() {
|
|||||||
val service = app
|
val service = app
|
||||||
.getRuntimeService(ITroopInfoService::class.java, "all")
|
.getRuntimeService(ITroopInfoService::class.java, "all")
|
||||||
|
|
||||||
var groupInfo = getGroupInfo(groupId)
|
val groupInfo = getGroupInfo(groupId)
|
||||||
|
|
||||||
return if(refresh || !service.isTroopCacheInited || groupInfo.troopuin.isNullOrBlank()) {
|
return if(refresh || !service.isTroopCacheInited || groupInfo.troopuin.isNullOrBlank()) {
|
||||||
requestGroupList(service, groupId.toLong()).onFailure {
|
requestGroupInfo(service, groupId.toLong())
|
||||||
groupInfo = service.findTroopInfo(groupId)
|
|
||||||
if (groupInfo.troopuin.isNullOrBlank()) {
|
|
||||||
Result.failure(it)
|
|
||||||
} else {
|
|
||||||
Result.success(groupInfo)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
Result.success(groupInfo)
|
Result.success(groupInfo)
|
||||||
}
|
}
|
||||||
@ -567,7 +560,7 @@ internal object GroupSvc: BaseSvc() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun requestGroupList(
|
private suspend fun requestGroupInfo(
|
||||||
service: ITroopInfoService
|
service: ITroopInfoService
|
||||||
): Boolean {
|
): Boolean {
|
||||||
refreshTroopList()
|
refreshTroopList()
|
||||||
@ -660,9 +653,9 @@ internal object GroupSvc: BaseSvc() {
|
|||||||
METHOD_REQ_MEMBER_INFO_V2.invoke(businessHandler, groupId.toString(), groupUin2GroupCode(groupId).toString(), arrayListOf(memberUin.toString()))
|
METHOD_REQ_MEMBER_INFO_V2.invoke(businessHandler, groupId.toString(), groupUin2GroupCode(groupId).toString(), arrayListOf(memberUin.toString()))
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun requestGroupList(dataService: ITroopInfoService, uin: Long): Result<TroopInfo> {
|
private suspend fun requestGroupInfo(dataService: ITroopInfoService, uin: Long): Result<TroopInfo> {
|
||||||
val strUin = uin.toString()
|
val strUin = uin.toString()
|
||||||
val list = withTimeoutOrNull(5000) {
|
val info = withTimeoutOrNull(5000) {
|
||||||
var troopInfo: TroopInfo?
|
var troopInfo: TroopInfo?
|
||||||
do {
|
do {
|
||||||
troopInfo = dataService.getTroopInfo(strUin)
|
troopInfo = dataService.getTroopInfo(strUin)
|
||||||
@ -670,8 +663,8 @@ internal object GroupSvc: BaseSvc() {
|
|||||||
} while (troopInfo == null || troopInfo.troopuin.isNullOrBlank())
|
} while (troopInfo == null || troopInfo.troopuin.isNullOrBlank())
|
||||||
return@withTimeoutOrNull troopInfo
|
return@withTimeoutOrNull troopInfo
|
||||||
}
|
}
|
||||||
return if (list != null) {
|
return if (info != null) {
|
||||||
Result.success(list)
|
Result.success(info)
|
||||||
} else {
|
} else {
|
||||||
Result.failure(Exception("获取群列表失败"))
|
Result.failure(Exception("获取群列表失败"))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user