update 实名认证校验

This commit is contained in:
gallonyin
2023-03-14 00:21:59 +08:00
parent ae145ae3b0
commit b35120a6e3
4 changed files with 66 additions and 5 deletions

View File

@@ -56,6 +56,7 @@ object MyLooper {
SPUtils.getInstance("limit").clear()
SPUtils.getInstance("groupInvite").clear()
SPUtils.getInstance("lastImage").clear()
SPUtils.getInstance("myInfo").clear()
}
fun getInstance(): Handler {

View File

@@ -2,13 +2,11 @@ package org.yameida.worktool.service
import com.blankj.utilcode.util.GsonUtils
import com.blankj.utilcode.util.LogUtils
import com.blankj.utilcode.util.SPUtils
import org.yameida.worktool.Constant
import org.yameida.worktool.model.ExecCallbackBean
import org.yameida.worktool.model.WeworkMessageBean
import org.yameida.worktool.utils.AccessibilityExtraUtil
import org.yameida.worktool.utils.AccessibilityUtil
import org.yameida.worktool.utils.Views
import org.yameida.worktool.utils.WeworkRoomUtil
import org.yameida.worktool.utils.*
import java.lang.StringBuilder
/**
@@ -177,6 +175,14 @@ object WeworkGetImpl {
LogUtils.v("corp", corp)
LogUtils.v("info", info.toString())
}
if (tvList.size > 1) {
if (!SPUtils.getInstance("myInfo").getBoolean("realName", false)) {
AccessibilityUtil.performClick(tvList[1])
getRealName(nickname)
} else {
LogUtils.d("已实名认证")
}
}
}
}
Constant.myName = nickname
@@ -232,6 +238,11 @@ object WeworkGetImpl {
}
}
}
if (!SPUtils.getInstance("myInfo").getBoolean("realName", false)) {
getRealName(myInfo.name)
} else {
LogUtils.d("已实名认证")
}
LogUtils.d("我的信息", GsonUtils.toJson(myInfo))
val weworkMessageBean = WeworkMessageBean()
weworkMessageBean.type = WeworkMessageBean.GET_MY_INFO
@@ -412,4 +423,27 @@ object WeworkGetImpl {
return false
}
}
/**
* 获取实名状态
*/
private fun getRealName(nickname: String) {
if (AccessibilityExtraUtil.loadingPage("SettingMineInfoActivity")) {
if (AccessibilityUtil.findTextAndClick(getRoot(), "姓名", exact = true)) {
val realNameFlag = AccessibilityUtil.findOneByText(getRoot(), "实名认证", exact = true)
if (realNameFlag != null) {
val notRealName = AccessibilityUtil.findOnceByText(getRoot(), "未认证")
val realName = AccessibilityUtil.findOnceByClazz(AccessibilityUtil.findBackNode(realNameFlag, 1), Views.TextView)
if (notRealName != null) {
LogUtils.d("未实名认证: $nickname")
error("未实名认证: $nickname")
} else if (realName != null) {
LogUtils.d("实名认证: ${realName.text}")
log("实名认证: ${realName.text}")
SPUtils.getInstance("myInfo").put("realName", true)
}
}
}
}
}
}

View File

@@ -4,13 +4,16 @@ import android.os.Message
import android.view.accessibility.AccessibilityNodeInfo
import androidx.core.text.isDigitsOnly
import com.blankj.utilcode.util.*
import com.hjq.toast.ToastUtils
import org.yameida.worktool.Constant
import org.yameida.worktool.Demo
import org.yameida.worktool.MyApplication
import org.yameida.worktool.activity.GetScreenShotActivity
import org.yameida.worktool.model.WeworkMessageBean
import org.yameida.worktool.observer.MultiFileObserver
import org.yameida.worktool.service.WeworkController.mainLoopRunning
import org.yameida.worktool.utils.*
import org.yameida.worktool.utils.envcheck.CheckRoot
import java.io.File
import java.lang.Exception
import java.lang.StringBuilder
@@ -45,6 +48,9 @@ object WeworkLoopImpl {
getChatroomList()
if (!mainLoopRunning) break
getFriendRequest()
if (!mainLoopRunning) break
checkRealName()
if (!mainLoopRunning) break
sleep(300)
}
} catch (e: Exception) {
@@ -59,10 +65,25 @@ object WeworkLoopImpl {
}
}
/**
* 检查账号是否已实名
*/
private fun checkRealName(): Boolean {
if (!SPUtils.getInstance("myInfo").getBoolean("realName", false)
&& CheckRoot.isDeviceRooted()) {
LogUtils.e("账号实名前请先关闭WorkTool主功能")
ToastUtils.show("账号实名前请先关闭WorkTool主功能")
MyApplication.launchIntent()
sleep(5000)
return false
}
return true
}
/**
* 读取通讯录好友请求
*/
fun getFriendRequest(): Boolean {
private fun getFriendRequest(): Boolean {
val list = AccessibilityUtil.findAllOnceByText(getRoot(), "通讯录", exact = true)
for (item in list) {
val childCount = item.parent?.parent?.parent?.childCount

View File

@@ -18,19 +18,24 @@ public class CheckRoot {
public static boolean isDeviceRooted() {
if (checkDeviceDebuggable()) {
Log.i(LOG_TAG, "isDeviceRooted: checkDeviceDebuggable()");
return true;
}
if (checkSuperuserApk()) {
Log.i(LOG_TAG, "isDeviceRooted: checkSuperuserApk()");
return true;
}
if (checkRootPathSU()) {
Log.i(LOG_TAG, "isDeviceRooted: checkRootPathSU()");
return true;
}
if (checkRootWhichSU()) {
Log.i(LOG_TAG, "isDeviceRooted: checkRootWhichSU()");
return true;
}
if (checkAccessRootData()) {
Log.i(LOG_TAG, "isDeviceRooted: checkAccessRootData()");
return true;
}
return false;