require("TSLib")
require("ext_new")
require("ext_bakup")
require("ios_func")
require("ext_restore")
require("api")
local ts = require("ts")
local ios_config = require("config")
-- local config_map = require("config_map")
local os_version = nil
local download_error_num = 0
-- ----------【main】----------
function main()
-- 回到主页,方便查看设备状态
pressHomeKey(0)
mSleep(100)
pressHomeKey(1)
mSleep(500)
device_check()
mSleep(1000)
os_version = getOSVer()
mSleep(1000)
if os_version == nil then
wolf_log('退出进程,取版本号失败:')
return_device_error(ios_config.ios_任务信息.device_id)
lua_exit()
end
wolf_log('系统版本'.. os_version)
-- 系统版本
os_version = tonumber(tostring(string.gsub(os_version, "%.", "")))
wolf_log('转换后系统版本'.. os_version)
if os_version >100 and os_version < 1000 then
os_version = os_version / 10
else
if os_version > 1000 and os_version < 10000 then
os_version = os_version / 100
end
end
wolf_log('最终系统版本'.. os_version)
ios_config.ios_任务信息.os_version = os_version
-- 电池电量
retTable = batteryStatus();
wolf_log('是否在充电'.. retTable.charging)
wolf_log('电池电量'.. retTable.level)
if retTable.level < 1 then
wolf_log('退出进程,电量不足:')
return_device_error(ios_config.ios_任务信息.device_id)
lua_exit()
end
-- 存储空间
local space = storage_space()
wolf_log('剩余存储空间' .. space)
if space < 1 then
wolf_log('退出进程,剩余存储空间不足:')
return_device_error(ios_config.ios_任务信息.device_id)
lua_exit()
end
-- 请求接口判断下一步执行什么任务
if ios_config.is_restart_lua then
ios_config.is_restart_lua = false
lua_restart()
end
-- 当前版本不与服务器沟通,直接执行注册任务并返回
-- res = get_register_task(ios_config.ios_任务信息.device_id)
-- task_data = res.data
-- task_func = 'register_task'
-- 与服务器沟通获取执行方法
res = get_task(ios_config.ios_任务信息.device_id)
ios_config.ios_任务信息.task_id = res.data.task_info.id or ""
ios_config.ios_任务信息.task_type = res.data.task_type or ""
ios_config.ios_任务信息.task_info = res.data.task_info
ios_config.ios_任务信息.task_data = res.data.task_data
verify_update_lua(res.data.lua_version)
toast("任务获取成功\r\n" .. "type:" .. ios_config.ios_任务信息.task_type .. "\r\n" .. "任务ID:" .. ios_config.ios_任务信息.task_id .. "\r\n" .. "版本:" .. res.data.lua_version, 2)
wolf_log("任务获取成功\r\n" .. "type:" .. ios_config.ios_任务信息.task_type .. "\r\n" .. "任务ID:" .. ios_config.ios_任务信息.task_id)
-- wolf_log("任务获取成功return: " .. ts.json.encode(res))
return ios_config.ios_任务信息
end
function task_fail(url, fail_dict, id)
-- 注册任务失败上报信息
task_ids = id or ios_config.ios_任务信息.task_data.id
if task_ids == nil then
-- 取不到任务id了,就取第一个的id
task_ids = ios_config.ios_任务信息.task_data[0].id
end
return_task_fail(url, {
task_id = task_ids,
fail_code = fail_dict.code,
fail_reason = fail_dict.reason
}, ios_config.ios_任务信息.task_data.email)
end
function new_system_device()
-- 关闭所有应用
closeApp("*",0)
closeApp("*",1)
--按下Home键 回归主页
mSleep(500)
pressHomeKey(0)
mSleep(100)
pressHomeKey(1)
mSleep(500)
wolf_log("开始刷机")
if not ios_config.ios_任务信息.task_data.device_info_status or ios_config.ios_任务信息.task_data.device_info_status == 0 then
-- 执行新机
new_ios_device()
else
new_ios_device2(ios_config.ios_任务信息.task_data.device_info.udid, ios_config.ios_任务信息.task_data.device_info.mlb_sn, ios_config.ios_任务信息.task_data.device_info.ecid, ios_config.ios_任务信息.task_data.device_info.bt_mac_addr, ios_config.ios_任务信息.task_data.device_info.wifi_mac_addr)
end
-- mSleep(1000)
removeAdiPbFiles()
end
-- ----------【注册】----------
-- 刷机并请求注册信息
function register_task()
-- 准备工作
new_system_device()
-- 重启springboard
-- reload_spring()
-- 重启vpn切换IP
-- restart_vpn()
-- mSleep(500)
-- 校验sn
-- res = check_sn()
-- if res == 400 then goto start end
-- 等待网络恢复正常
if not ios_config.action.wifi then
if not check_internet() then
return 400
end
end
if not ios_config.action.input_clipboard then
if not open_app(ios_config.ios_app_bid.设置) then
return 400
end
mSleep(5000)
if not find_multi_color(ios_config.ios_多色判断.设置_首页_加载完毕, 10) then
toast("appId界面加载失败...", 2)
return 400
end
index = 3
while index > 0 do
moveTo(440, 602, 440, 1000)
mSleep(1000)
if find_multi_color(ios_config.ios_多色判断.设置_首页_搜索框, 3) then
break
end
index = index - 1
end
if index <= 0 then
return 400
end
check_tap(222, 269)
if not switchInputText() then
return 400
end
end
return 200
end
function check_sn()
-- 获取新机后的序列号
local file = io.open("/var/mobile/device_override_wolf.plist", "r")
file_str = file:read("*a")
ios_config.ios_ini.序列号 = string.match(file_str, "SN%s*([%w]+)")
file:close()
if not ios_config.ios_ini.序列号 then
toast("等待重新刷机", 2)
return 400
end
toast("当前序列号:" .. ios_config.ios_ini.序列号, 2)
-- 【Optional】 验证序列号是否改变
::verify_sn::
pressHomeKey(0)
mSleep(1000)
pressHomeKey(1)
closeApp(ios_config.ios_app_bid.设置, 1)
mSleep(1000)
if not open_app(ios_config.ios_app_bid.设置) then
toast("等待重新刷机", 2)
return 400
end
-- 判断设置是否打开
toast("设置加载完毕判断中...", 2)
if not find_str(ios_config.ios_查找文字.设置_登录iphone, true, 5) then
toast("等待重新刷机", 2)
return 400
end
mSleep(500)
-- 点开通用
for i = 1, 5 do
toast("正在滑动查找图色...", 2)
moveTo(440, 900, 440, 702, 10, 300)
mSleep(2000)
x, y = find_x_y_colour(ios_config.ios_查找图色.设置_通用图色, 3)
if x ~= -1 then
break
end
end
if x == -1 then
-- 查找失败, 关闭进程重新执行
closeApp(ios_config.ios_app_bid.设置, 1)
mSleep(500)
toast("等待重新校验序列号", 2)
return 400
end
mSleep(500)
check_tap(x + 100, y + 15)
if not find_str(ios_config.ios_查找文字.设置_通用_关于本机, true, 5) then
toast("等待重启设置", 2)
return 400
end
check_tap(341,246)
if find_str({ios_config.ios_ini.序列号, 423, 570, 739, 635, 1, 100, 5}, true, 5) then
toast("序列号:" .. ios_config.ios_ini.序列号 .. "校验成功", 2)
return 200
else
toast("序列号:" .. ios_config.ios_ini.序列号 .. "不匹配,重新刷机", 2)
return 400
end
end
function step1_open_app()
local index_1 = 3
closeApp("*",1)
-- mSleep(1000)
-- toast("openurl app store", 2)
-- openURL("https://itunes.apple.com/WebObjects/MZStore.woa/wa/resetAndRedirect?dsf=143465&mt=8&url=/WebObjects/MZStore.woa/wa/viewSoftware?mt=8&id=1108187390&cc=cn&urlDesc=")
-- mSleep(1000)
while index_1 > 0 do
-- 关闭所有应用
closeApp("*",1)
mSleep(2000)
toast("openurl app store", 2)
openURL("https://itunes.apple.com/WebObjects/MZStore.woa/wa/resetAndRedirect?dsf=143465&mt=8&url=/WebObjects/MZStore.woa/wa/viewSoftware?mt=8&id=1108187390&cc=cn&urlDesc=")
mSleep(3000)
local index = 3
re_tap = 0
while index > 0 do
relogin_chek_alert()
toast("第".. index .."判断注册_欢迎按钮", 2)
wolf_log("第".. index .."判断注册_欢迎按钮")
if find_multi_color(ios_config.ios_多色判断.注册_欢迎按钮, 1) then
check_tap(374, 1168)
end
if find_str(ios_config.ios_查找文字.app_store_新内容确认页面, true, 1) then
wolf_log("app_store_新内容确认页面")
toast("app_store_新内容确认页面", 2)
mSleep(500)
check_tap(378, 1172)
end
if find_str(ios_config.ios_查找文字.app_store_新内容确认页面_英文, true, 1) then
wolf_log("app_store_新内容确认页面_英文")
toast("app_store_新内容确认页面", 2)
mSleep(500)
check_tap(378, 1172)
end
-- toast("第".. index .."判断app_store_today返回", 2)
wolf_log("第".. index .."判断app_store_today返回")
x, y = find_x_y_colour(ios_config.ios_查找图色.app_store_today返回, 1)
if x > -1 then
toast("app store 跳转位置错误返回", 2)
wolf_log("app store 跳转位置错误返回")
check_tap(86, 82)
re_tap = re_tap + 1
end
-- toast("第".. index .."判断注册_商店首页_头像", 2)
wolf_log("第".. index .."判断注册_商店首页_头像")
if re_tap > 0 and find_multi_color(ios_config.ios_多色判断.注册_商店首页_头像, 1) then
break
end
-- toast("第".. index .."判断app_store_首页_无法连接_重试", 2)
wolf_log("第".. index .."判断app_store_首页_无法连接_重试")
if find_multi_color(ios_config.ios_多色判断.app_store_首页_无法连接_重试, 1) then
check_tap(370, 742)
mSleep(1000)
end
index = index - 1
end
if index > 0 then
break
end
index_1 = index_1 - 1
end
if index_1 < 0 then
wolf_log("未定位到头像")
toast("未定位到头像", 10)
return 400
end
-- mSleep(1000)
return 200
end
function step2_aggre_protocol()
-- 点开 app store 右上角用户
local index = 10
local tap_num = 0
while index > 0 and tap_num < 3 do
if find_multi_color(ios_config.ios_多色判断.注册_商店首页_头像, 1) then
toast("点击头像", 1)
check_tap(672, 172)
mSleep(1000)
tap_num = tap_num + 1
end
if find_multi_color(ios_config.ios_多色判断.注册_商店首页_创建AppleID按钮, 1) then
break
end
index = index - 1
end
if index <= 0 or tap_num >= 3 then
toast("未定位到创建ID按钮", 10)
new_system_device()
return 400
end
-- mSleep (500)
-- 点击创建ID按钮
check_tap(193, 720)
mSleep(6000)
if find_multi_color(ios_config.ios_多色判断.注册_商店首页_创建AppleID按钮, 1) then
toast("创建点击失效...", 2)
return 400
end
mSleep(6000)
local index = 120
while index > 0 do
if find_multi_color(ios_config.ios_多色判断.注册_同意协议_同意按钮, 1) then
break
end
if find_multi_color(ios_config.ios_多色判断.注册_同意协议_错误展示, 1) then
return 400
end
if not find_multi_color(ios_config.ios_多色判断.注册_同意协议_加载页面, 1) then
break
end
index = index - 1
mSleep(1000)
end
if index <= 0 then
toast("同意协议未加载", 2)
return 400
end
if find_multi_color(ios_config.ios_多色判断.注册_商店首页_头像, 1) then
return 400
end
if find_multi_color(ios_config.ios_多色判断.注册_同意协议_同意按钮, 2) then
mSleep(500)
check_tap(348, 1133)
toast("点击同意", 2)
else
toast("非正常协议", 2)
return 400
end
-- 特殊处理下美区的问题
index = 30
err_num = 0
while index > 0 and err_num < 3 do
if find_multi_color(ios_config.ios_多色判断.注册_资料填写_账号信息页面, 1) then
return 200
end
if find_multi_color(ios_config.ios_多色判断.注册_资料填写_账号信息页面_美区, 1) then
new_system_device()
return 499
end
if find_str(ios_config.ios_查找文字.app_store_注册Apple, true, 1) then
err_num = err_num + 1
end
index = index - 1
end
if err_num >= 3 then
new_system_device()
end
toast("未查找到创建按钮", 10)
return 400
end
function step3_fill_email()
-- 打开同意条款
check_tap(675, 747)
mSleep(300)
-- 输入邮箱
check_tap(367, 274)
wolf_inputText(ios_config.ios_任务信息.task_data.email)
-- 输入注册密码
check_tap(312, 351)
wolf_inputText(ios_config.ios_任务信息.task_data.password)
-- 二次输入注册密码
check_tap(327, 441)
wolf_inputText(ios_config.ios_任务信息.task_data.password)
-- 点击下一页
check_tap(668, 135)
for i = 1, 10 do
if find_multi_color(ios_config.ios_多色判断.注册_资料填写_个人信息页面, 1) then
return 200
else
if find_multi_color(ios_config.ios_多色判断.注册_资料填写_邮箱异常, 1) then
toast("邮箱已注册", 2)
return 699
end
end
end
toast("未定位到页面", 2)
return 400
end
function step4_fill_name()
-- 输入随机姓氏
check_tap(313, 299)
-- mSleep(1000)
-- wolf_inputText(random_str(1))
wolf_inputText(ios_config.ios_任务信息.task_data.receiver_info.surname)
-- 输入随机名
tap(303, 386)
wolf_inputText(ios_config.ios_任务信息.task_data.receiver_info.first_name)
-- 输入随机出生日期
tap(303, 473)
math.randomseed(getRndNum()) -- 随机种子初始化真随机数
wolf_inputText(tostring(math.random(1980, 2002)))
month = math.random(1, 12)
if month < 10 then
month_str = "0" .. month
else
month_str = tostring(month)
end
wolf_inputText(month_str)
wolf_inputText(tostring(math.random(1, 28)))
-- 点击下一页
check_tap(668, 135)
if find_multi_color(ios_config.ios_多色判断.注册_资料填写_付款页面, 8) then
return 200
else
toast("基本信息提交失败,非邮箱问题", 2)
return 400
end
end
function step5_fill_payment()
-- 更改付款方式为无
if find_multi_color(ios_config.ios_多色判断.注册_资料填写_是否抖音支付, 5) then
check_tap(307, 727)
else
check_tap(307, 640)
end
mSleep(500)
-- 滑动到底部
index = 5
while index > 0 do
moveTo(440, 1172, 440, 602)
mSleep(1000)
if find_multi_color(ios_config.ios_多色判断.注册_资料填写_地址输入框, 2) then
break
end
index = index - 1
end
if index <= 0 then
toast("未定位到了解信息文字,设备问题,非邮箱问题", 2)
return 400
end
-- 输入随机街道地址
check_tap(300, 479)
wolf_inputText(ios_config.ios_任务信息.task_data.receiver_info.detailed_address)
if ios_config.action.input_clipboard then
-- -- 输入随机街道地址
check_tap(300, 586)
mSleep(500)
-- 输入随机街道地址
check_tap(300, 586)
mSleep(500)
-- 输入随机邮政编码
check_tap(300, 586)
wolf_inputText(ios_config.ios_任务信息.task_data.receiver_info.postal_code)
-- 输入随机市级行政区
check_tap(300, 586)
wolf_inputText(ios_config.ios_任务信息.task_data.receiver_info.city)
-- 选择随机省份
check_tap(300, 586)
else
-- -- 输入随机街道地址
check_tap(300, 638)
wolf_inputText("")
-- 输入随机街道地址
tap(300, 638)
wolf_inputText("")
-- 输入随机邮政编码
tap(300, 638)
wolf_inputText(ios_config.ios_任务信息.task_data.receiver_info.postal_code)
-- 输入随机市级行政区
tap(300, 638)
wolf_inputText(ios_config.ios_任务信息.task_data.receiver_info.city)
-- 选择随机省份
check_tap(300, 638)
end
if not find_multi_color(ios_config.ios_多色判断.注册_资料填写_省份输入框,30) then
toast("省份输入框定位失败,设备问题,非邮箱问题", 2)
return 400
end
-- 开始随机选省份
-- math.randomseed(getRndNum()) -- 随机种子初始化真随机数
for i = 1, ios_config.ios_省份对应表[ios_config.ios_任务信息.task_data.receiver_info.province] do
check_tap(24, 1170)
mSleep(300)
end
-- moveTo(385, 1030, 385, 1000)
mSleep(500) -- 等待滑动结束
-- 点击完成
check_tap(687, 859)
mSleep(500)
-- 点击下一页
check_tap(663, 134)
if ios_config.action.wifi then
if not find_multi_color(ios_config.ios_多色判断.注册_手机号_输入框,30) then
toast("等待重新进入", 2)
return 400
else
return 200
end
else
-- 点击完成,查验手机号页面
if find_multi_color(ios_config.ios_多色判断.注册_手机号_选择其他号码,30) then
return 200
else
toast("账单提交失败,非邮箱问题", 2)
return 400
end
end
end
function step6_fill_phone()
if ios_config.action.wifi then
check_tap(662, 790)
else
check_tap(365, 652)
if not find_multi_color(ios_config.ios_多色判断.注册_手机号_输入框, 15) then
toast("等待重新进入", 2)
return 400
end
check_tap(662, 790)
if not find_multi_color(ios_config.ios_多色判断.注册_手机号_输入框完成按钮, 15) then
toast("未定位到键盘", 2)
return 400
end
-- 清空当前手机号
for i = 1, 15 do
tap(629, 1278)
mSleep(100)
end
end
wolf_inputText(ios_config.ios_任务信息.task_data.phone)
-- 点击下一页
check_tap(663, 134)
return 200
end
function step7_fill_phone_code()
-- 检测界面
index = 10
while index > 0 do
if find_multi_color(ios_config.ios_多色判断.注册_手机号_使用上限弹窗, 10, true) then
toast("手机号使用频率上限", 2)
return 600
end
if find_multi_color(ios_config.ios_多色判断.注册_手机号验证码_输入框, 1, true) then
break
end
index = index - 1
end
if index <= 0 then
return 400
end
-- 发送验证码请求次数记录
push_phone_code_num(ios_config.ios_任务信息.task_data.id)
-- 获取验证码
res = get_mobile_sms(ios_config.ios_任务信息.task_data.id)
if res then
check_tap(331, 628)
wolf_inputText(res.data.code)
-- 下一页,验证手机验证码, 获取邮箱验证码
check_tap(663, 134)
return 200
else
toast("获取验证码失败,重启store", 2)
return 500
end
end
function step8_email_code()
if not find_multi_color(ios_config.ios_多色判断.注册_邮箱验证码_输入框, 15) then
toast("未找到页面定位,等待重新启动应用", 2)
return 400
end
res = get_email_sms(ios_config.ios_任务信息.task_data.id)
if res then
for i = 1, 3 do
toast("验证码:" .. res.data.code, 2)
wolf_inputText(res.data.code)
mSleep(500)
-- 下一页
check_tap(663, 134)
index = 8
while index > 0 do
if find_str(ios_config.ios_查找文字.app_store_弹窗_我们遇到问题稍后重试, nil, 1) then
return 698
end
if not find_str(ios_config.ios_查找文字.app_store_注册邮箱验证, nil, 1) then
break
end
index = index - 1
mSleep(1000)
end
if index > 0 then
return 200
end
end
return 400
else
toast("获取邮箱验证码失败,重启store", 2)
return 600
end
end
function step9_check_register_res()
-- 检验注册结果
for i = 1, 180 do
if find_str(ios_config.ios_查找文字.app_store_弹窗_我们遇到问题稍后重试, nil, 1) then
return 698
end
if multiColor(ios_config.ios_多色判断.注册_注册结果_成功) then
mSleep(1000)
check_tap(91, 1216)
mSleep(1000)
return 200
end
if multiColor(ios_config.ios_多色判断.注册_注册结果_请稍后再试) or multiColor(ios_config.ios_多色判断.注册_注册结果_激活icloud失败_需要重登) then
return 240
end
mSleep(1000)
end
return 400
end
function verify_and_backup()
mSleep(500)
pressHomeKey(0)
mSleep(100)
pressHomeKey(1)
closeApp("*",0)
closeApp("*",1)
mSleep(3000)
openURL("prefs:root=APPLE_ACCOUNT&path=FAMILY")
mSleep(1000)
index = 40
success = 0
reg_icloud_err = 0
find_err = 0
while index > 0 and success < 3 do
wolf_log('开始第' .. index .. '次检测')
if find_str(ios_config.ios_查找文字.设置_用户_Apple界面, false, 1) then
-- 如果媒体与购买项目关,则打开,否则记录为成功
if find_str(ios_config.ios_查找文字.设置_用户_媒体与购买项目_关, false, 1) then
x, y = find_x_y_colour(ios_config.ios_查找图色.设置_媒体与项目_关, 1)
if x > -1 then
wolf_log('设置_媒体与项目_关')
mSleep(300)
tap(x, y)
x, y = find_x_y_colour(ios_config.ios_查找图色.设置_媒体与项目_继续, 5)
if x > -1 then
wolf_log('设置_媒体与项目_继续')
mSleep(300)
tap(x, y)
end
end
else
wolf_log('success + 1')
success = success + 1
end
else
-- 优先判断掉进程情况
if not find_str(ios_config.ios_查找文字.设置_用户_Apple界面, false, 1) then
wolf_log('find_err + 1')
find_err = find_err + 1
if find_err >= 3 then
wolf_log('find_err >= 3')
return 400
end
else
-- 如果没有掉进程,在考虑iCloud的问题
if find_multi_color(ios_config.ios_多色判断.注册_注册结果_注册icloud失败1, 1) then
reg_icloud_err = reg_icloud_err + 1
if reg_icloud_err > 3 then
wolf_log('注册icloud失败1')
toast("注册icloud失败1", 2)
return 240
end
end
if not find_multi_color(ios_config.ios_多色判断.注册_同意协议_加载页面, 1) and find_multi_color(ios_config.ios_多色判断.注册_注册结果_注册icloud失败2, 1) then
wolf_log('注册icloud失败2')
toast("注册icloud失败2", 2)
return 240
end
end
end
index = index - 1
end
if success < 3 then
success = 0
find_err = 0
for i = 1, 120 do
wolf_log("第" .. i .. "次检测登录")
-- 掉进程情况
if not find_str(ios_config.ios_查找文字.设置_用户_Apple界面, false, 1) then
find_err = find_err + 1
end
if find_err > 3 then
wolf_log("异常退出" .. find_err )
return 400
end
if find_str(ios_config.ios_查找文字.设置_用户_Apple界面, false, 1) and not find_str(ios_config.ios_查找文字.设置_用户_媒体与购买项目_关, false, 1) then
success = success + 1
end
if success >= 3 then
wolf_log("成功退出" .. success)
break
end
end
end
wolf_log("识别完毕" .. success)
-- active_app_store()
index_guanlian = 3
while index_guanlian >= 0 do
wolf_log("第" .. index_guanlian .. "次检测关联设备")
toast("第" .. index_guanlian .. "次检测关联设备", 2)
moveTo(440, 1000, 440, 602)
mSleep(1000)
if find_multi_color(ios_config.ios_多色判断.设置_账号_媒体与购买项目_关联设备, 3) then
break
end
index_guanlian = index_guanlian - 1
end
if index_guanlian <= 0 then
toast("未定位到当前登录设备", 2)
wolf_log("未定位到当前登录设备")
check_tap(71,85)
mSleep(3000)
return 400
end
-- 创建成功,备份,回传
local account_id = string.match(ios_config.ios_任务信息.task_data.email, "([^@]+)@")
toast("开始备份,备份ID:" .. account_id, 2)
wolf_log("开始备份,备份ID:" .. account_id)
back_account(account_id)
mSleep(3000)
return_task_success(ios_config.ios_任务信息.task_data.id, account_id, ios_config.ios_任务信息.task_data.password, ios_config.ios_任务信息.task_data.email)
-- 重新执行
return 200
end
-- ----------【激活】----------
function activate_task()
-- 初始化激活任务
-- 判断备份文件存不存在
if not os.execute("find /var/root/" .. ios_config.ios_任务信息.task_data.backups_key) then
return 401
end
-- 恢复备份
main_index = 3
while main_index > 0 do
-- 执行新机
-- new_ios_device()
-- -- 等待网络恢复正常
-- if not ios_config.action.wifi then
-- if not check_internet() then
-- return 400
-- end
-- end
wolf_log("第" .. main_index .. "次尝试重新执行任务")
mSleep(1000)
ext_restore_func(ios_config.ios_任务信息.task_data.backups_key)
mSleep(1000)
-- 判断是否恢复成功
pressHomeKey(0)
mSleep(100)
pressHomeKey(1)
closeApp("*",0)
closeApp("*",1)
mSleep(1000)
---- 打开apple id界面
openURL("prefs:root=APPLE_ACCOUNT&path=FAMILY")
mSleep(5000)
index = 20
success = 0
while index > 0 do
toast("第" .. (21 - index) .. "检测appleid页面", 1)
if find_str(ios_config.ios_查找文字.app_store_更改商店, true, 1) or find_str(ios_config.ios_查找文字.app_store_查看条款, true, 1) then
wolf_log("更改商店")
return_deactivate_task(ios_config.ios_任务信息.task_info.backup_key)
task_fail("api/v1/app_task/fail", {
code=499,
reason='账号已封号(转区)...'
}, task_data.id)
tap(234,783)
end
if find_str(ios_config.ios_查找文字.设置_激活_新IC协议, false, 1) then
return 499
end
x, y = find_x_y_colour(ios_config.ios_查找图色.设置_媒体与项目_关, 1)
if x > -1 then
mSleep(300)
tap(661, 965)
index_1 = 5
while index_1 > 0 do
if multiColor(ios_config.ios_多色判断.设置_账号_媒体与购买项目_继续) then
mSleep(300)
tap(374, 732)
break
end
index_1 = index_1 - 1
mSleep(500)
end
end
if find_str(ios_config.ios_查找文字.设置_激活_iCloud, false, 1) then
return 400
end
if find_str(ios_config.ios_查找文字.设置_用户_Apple界面, false, 1) and not find_str(ios_config.ios_查找文字.设置_用户_媒体与购买项目_关, false, 1) then
success = success + 1
end
if success >= 3 then
return 200
end
index = index - 1
end
end
toast("账号恢复失败,异常报错", 2)
return 401
end
function activate_step1_in_account_info()
-- 判断账户界面
local index = 0
local max_wait = 20
while index < max_wait do
if find_multi_color(ios_config.ios_多色判断.重登_设置_登录_账户已停用, 1) then
toast("账户已停用...", 2)
wolf_log("账户已停用...")
return 499
end
if find_multi_color(ios_config.ios_多色判断.注册_商店首页_头像, 1) then
toast("第".. index .. "次点击头像", 1)
wolf_log("点击头像")
check_tap(672, 172)
-- mSleep(1000)
-- 不能设置 index = 0 否则点击失效的时候会死循环
end
if find_multi_color(ios_config.ios_多色判断.app_store_用户_账户页面, 1, true) then
wolf_log("账户页面加载完毕")
toast("账户页面加载完毕", 2)
-- mSleep(2000)
check_tap(451, 327)
wolf_log("定位到账户界面")
-- 不能设置 index = 0 否则点击失效的时候会死循环
end
if find_multi_color(ios_config.ios_多色判断.app_store_用户_账户密码窗口, 1, true) then
-- mSleep(2000)
wolf_inputText(ios_config.ios_任务信息.task_data.password)
-- toast("点击完成",2) 不能有弹窗 否则会挤掉键盘输入框
-- mSleep(1000)
tap(513, 573)
-- mSleep(2000)
-- 不能设置 index = 0 否则点击失效的时候会死循环
end
if find_multi_color(ios_config.ios_多色判断.app_store_新内容确认页面, 1, true) then
wolf_log("app_store_新内容确认页面")
toast("app_store_新内容确认页面", 2)
mSleep(500)
check_tap(378, 1172)
end
if find_str(ios_config.ios_查找文字.app_store_新内容确认页面, true, 1) then
wolf_log("app_store_新内容确认页面")
toast("app_store_新内容确认页面", 2)
mSleep(500)
check_tap(378, 1172)
end
if find_multi_color(ios_config.ios_多色判断.无法连接_app_store_带返回按钮, 1, true) then
wolf_log("无法连接_app_store_带返回按钮")
toast("无法连接_app_store_带返回按钮", 2)
mSleep(500)
toast("点击返回按钮", 2)
check_tap(22, 84)
end
if find_multi_color(ios_config.ios_多色判断.无法连接_app_store_带重试按钮, 1, true) then
wolf_log("无法连接_app_store_带重试按钮")
toast("无法连接_app_store_带重试按钮", 2)
mSleep(500)
toast("点击重试按钮", 2)
check_tap(377, 742)
end
if find_multi_color(ios_config.ios_多色判断.登录_登录结果_检查, 1) then
wolf_log("检测到登录弹窗")
mSleep(300)
wolf_log("点击检查按钮")
tap(509,787)
if not find_multi_color(ios_config.ios_多色判断.登录_登录结果_检查同意页, 60) then
wolf_log("检查同意页面加载失败")
return 400
end
-- 点击同意
mSleep(500)
tap(667,521)
-- 点击下一页
mSleep(1000)
check_tap(670,151)
if not find_multi_color(ios_config.ios_多色判断.登录_登录结果_检查账单页, 60) then
wolf_log("检查账单页面加载失败")
return 400
end
-- 点击下一页
mSleep(1000)
check_tap(670,151)
if not find_multi_color(ios_config.ios_多色判断.登录_登录结果_检查成功页, 15) then
wolf_log("检查成功页面加载失败")
return 400
end
mSleep(500)
check_tap(318,1210)
return 200
end
toast("多色判断.app_store_用户_账户个人资料", 2)
if find_multi_color(ios_config.ios_多色判断.app_store_用户_账户个人资料, 1) then
return 200
end
toast("多色判断.app_store_用户_账户个人资料2", 2)
if find_multi_color(ios_config.ios_多色判断.app_store_用户_账户个人资料2, 1) then
return 200
end
index = index + 1
end
return 400
-- while index > 0 do
-- if find_multi_color(ios_config.ios_多色判断.注册_商店首页_头像, 1) then
-- toast("点击头像", 1)
-- check_tap(672, 172)
-- mSleep(1000)
-- end
-- if find_multi_color(ios_config.ios_多色判断.app_store_用户_账户页面, 1) then
-- break
-- end
-- index = index - 1
-- end
-- if index <= 0 then
-- toast("未定位到账户界面", 10)
-- return 400
-- end
-- mSleep(2000)
-- check_tap(451, 327)
-- wolf_log("定位到账户界面")
-- if find_multi_color(ios_config.ios_多色判断.app_store_用户_账户密码窗口, 10,1) then
-- -- toast("点击输入框",2)
-- -- mSleep(2000)
-- -- tap(333, 479)
-- -- toast("输入密码",2) 不能有弹窗 否则会挤掉键盘输入框
-- mSleep(2000)
-- wolf_inputText(ios_config.ios_任务信息.task_data.password)
-- -- toast("点击完成",2) 不能有弹窗 否则会挤掉键盘输入框
-- mSleep(2000)
-- tap(513, 573)
-- end
-- wolf_log("开始定位账户个人资料")
-- mSleep(2000)
-- if not find_multi_color(ios_config.ios_多色判断.app_store_用户_账户个人资料, 60) then
-- toast("app store 个人资料未加载", 2)
-- return 400
-- end
-- return 200
end
function activate_step2_open_set()
closeApp("*",0)
closeApp("*",1)
-- 打开设置并进入媒体与购买项目
mSleep(500)
pressHomeKey(0)
mSleep(100)
pressHomeKey(1)
mSleep(1000)
openURL("prefs:root=APPLE_ACCOUNT&path=FAMILY")
index = 15
while index > 0 do
wolf_log("检测媒体购买项目" .. index)
if find_str(ios_config.ios_查找文字.设置_激活_新IC协议, false, 1) then
wolf_log("检测到新IC协议")
return 499
end
if find_multi_color(ios_config.ios_多色判断.设置_账号_媒体与购买项目_开, 1) then
wolf_log("媒体购买项目已打开")
break
end
index = index - 1
end
if index == 0 then
return 400
end
mSleep(300)
tap(661, 1056)
version = ios_config.ios_任务信息.os_version
if version >= 14.2 then
toast("当前版本大于等于14.2,点击密码设置",2)
mSleep(2000)
if not find_multi_color(ios_config.ios_多色判断.设置_账号_媒体与购买项目_点击, 10, true) then
toast("媒体与购买项目未点击成功", 2)
return 400
end
wolf_log("媒体与购买项目点击成功")
toast("媒体与购买项目点击成功",2)
mSleep(1000)
tap(507, 1018)
return 200
else
toast("当前版本于14.2,当前版本" .. ios_config.ios_任务信息.os_version,2)
return 200
end
end
function activate_step3_open_no_pwd()
version = ios_config.ios_任务信息.os_version
-- 完成开关需要密码步骤, 根据系统版本判断
if version < 14.2 then
-- 低版本执行
if not find_multi_color(ios_config.ios_多色判断.设置_账号_媒体与购买项目_用户设置, 15,1) then
toast("用户设置页面加载失败", 2)
mSleep(2000)
return 400
end
mSleep(1000)
tap(56, 135)
if not find_multi_color(ios_config.ios_多色判断.设置_账号_媒体与购买项目_用户设_密码设置, 15,1) then
toast("用户设置密码设置页面加载失败", 2)
mSleep(2000)
return 400
end
mSleep(1000)
tap(377, 1016)
if not find_multi_color(ios_config.ios_多色判断.设置_账号_媒体与购买项目_需要密码, 10) then
toast("需要密码页面加载失败", 2)
return 400
end
else
-- 高版本执行
if not find_multi_color(ios_config.ios_多色判断.设置_账号_媒体与购买项目_需要密码, 10) then
toast("需要密码页面加载失败", 2)
return 400
end
end
version = ios_config.ios_任务信息.os_version
if version < 14.2 then
grey_index = ios_config.ios_多色判断.设置_账号_媒体与购买项目_需要密码按钮_激活灰色_低版本
green_index = ios_config.ios_多色判断.设置_账号_媒体与购买项目_需要密码按钮_激活绿色_低版本
else
grey_index = ios_config.ios_多色判断.设置_账号_媒体与购买项目_需要密码按钮_激活灰色
green_index = ios_config.ios_多色判断.设置_账号_媒体与购买项目_需要密码按钮_激活绿色
end
index = 2
while index > 0 do
mSleep(300)
tap(487, 455)
toast('点击1',1)
mSleep(2000)
if find_multi_color(grey_index, 10) then
tap(671, 658)
toast('点击2',1)
mSleep(1000)
if find_multi_color(green_index, 10) then
tap(671, 658)
toast('点击3',1)
mSleep(1000)
if find_multi_color(grey_index, 10) then
toast('break',1)
mSleep(1000)
goto activate_step3_open_no_pwd_break
end
else
toast("需要密码按钮激活失败", 2)
end
end
if find_multi_color(ios_config.ios_多色判断.app_store_订阅输入密码框2, 1, true) then
toast('检测到需要登录页面',1)
wolf_log("检测到需要登录页面")
mSleep(500)
wolf_inputText(ios_config.ios_任务信息.task_data.password)
-- wolf_inputText("As456987@!788")
mSleep(500)
-- 回车
check_tap(676,1292)
return 400
end
if find_multi_color(green_index, 10) then
tap(671, 658)
toast('点击3',1)
mSleep(2000)
if find_multi_color(grey_index, 10) then
toast('break',1)
mSleep(1000)
goto activate_step3_open_no_pwd_break
end
else
toast("需要密码按钮激活失败", 2)
end
index = index - 1
end
if index <= 0 then
toast("多次执行异常,即将重新执行", 2)
return 400
end
::activate_step3_open_no_pwd_break::
version = ios_config.ios_任务信息.os_version
if version < 14.2 then
tap(672,168)
toast('点击完成1',1)
mSleep(2000)
-- 点击完成
tap(672,138)
toast('点击完成2',1)
mSleep(2000)
if not find_multi_color(ios_config.ios_多色判断.设置_账号_媒体与购买项目_开, 20) then
toast("点击完成失败", 2)
return 400
end
return 200
else
-- 点击完成
tap(685, 136)
if not find_multi_color(ios_config.ios_多色判断.设置_账号_媒体与购买项目_开, 20) then
toast("点击完成失败", 2)
return 400
end
return 200
end
end
function activate_backup()
toast("激活任务开始备份-备份ID:" .. ios_config.ios_任务信息.task_data.backups_key, 2)
back_account(ios_config.ios_任务信息.task_data.backups_key)
mSleep(3000)
return_task_success(ios_config.ios_任务信息.task_id, ios_config.ios_任务信息.task_data.backups_key, ios_config.ios_任务信息.password)
-- 重新执行
return 200
end
-- ----------【登录】----------
function relogin_task()
-- 初始化登录任务
-- 准备工作
-- 关闭所有应用
closeApp("*",0)
closeApp("*",1)
--按下Home键 回归主页
mSleep(500)
pressHomeKey(0)
mSleep(100)
pressHomeKey(1)
mSleep(500)
-- 执行新机
new_system_device()
mSleep(1000)
removeAdiPbFiles()
if not ios_config.action.wifi then
if not check_internet() then
return 400
end
end
switchInputText()
return 200
end
function new_relogin()
--按下Home键 回归主页
mSleep(500)
pressHomeKey(0)
mSleep(100)
pressHomeKey(1)
mSleep(500)
closeApp("*",1)
mSleep(1000)
openURL("prefs:root=APPLE_ACCOUNT")
index = 0
max_wait = 60
while index < max_wait do
if find_str(ios_config.ios_查找文字.重登_设置_Apple_ID, true, 1) or find_multi_color(ios_config.ios_多色判断.重登_设置_登录页, 1) then
mSleep(1000)
toast("设置加载成功,点击邮箱输入框", 2)
wolf_log("设置加载成功,点击邮箱输入框")
check_tap(280, 572)
mSleep(500)
check_tap(280, 572)
mSleep(500)
wolf_inputText(ios_config.ios_任务信息.task_data.email)
-- 回车
mSleep(300)
check_tap(676,1292)
if not find_multi_color(ios_config.ios_多色判断.重登_设置_登录_密码输入框, 30) then
toast("密码输入框加载失败", 2)
wolf_log("密码输入框加载失败")
return 400
end
toast("密码输入框加载成功", 2)
wolf_log("密码输入框加载成功")
mSleep(500)
wolf_inputText(ios_config.ios_任务信息.task_data.password)
-- 回车
mSleep(300)
check_tap(676, 1292)
index_v1 = 10
toast("等待登录并检测帐号状态", 1)
while index_v1 > 0 do
toast("第".. (10 - index_v1) .. "次检查登录账号状态", 1)
if find_multi_color(ios_config.ios_多色判断.登录_链接服务器_验证失败, 1) then
if find_multi_color(ios_config.ios_多色判断.重登_设置_登录_账号或密码错误, 1) then
toast("账号或密码错误...", 2)
wolf_log("账号或密码错误...")
return 498
end
toast("连接服务器失败...", 2)
wolf_log("连接服务器失败...")
return 400
end
if find_multi_color(ios_config.ios_多色判断.重登_设置_登录_账号或密码错误, 1) then
toast("账号或密码错误...", 2)
wolf_log("账号或密码错误...")
return 498
end
if find_str(ios_config.ios_查找文字.app_store_弹窗_验证失败, false, 1) then
if find_multi_color(ios_config.ios_多色判断.重登_设置_登录_账号或密码错误, 1) then
toast("账号或密码错误...", 2)
wolf_log("账号或密码错误...")
return 498
end
toast("验证失败...", 2)
wolf_log("验证失败...")
return 400
end
if find_multi_color(ios_config.ios_多色判断.重登_设置_登录_账户已停用, 1) then
toast("账户已停用...", 2)
wolf_log("账户已停用...")
return 499
end
if find_str(ios_config.ios_查找文字.app_store_订阅弹窗_已锁定2, false, 1) then
toast("账户已停用...", 2)
wolf_log("账户已停用...")
return 499
end
if find_multi_color(ios_config.ios_多色判断.登录_双重验证_设备验证码界面, 1) then
break
end
if find_str(ios_config.ios_查找文字.设置_登录_输入验证码, false, 1) then
break
end
mSleep(1000)
index_v1 = index_v1 - 1
end
if index_v1 <= 0 then
wolf_log("双重认证页面加载失败")
return 400
end
-- 带这个会报错
-- if ios_config.ios_任务信息.task_data.phone > 0 then
if not find_str(ios_config.ios_查找文字.重登_设置_双重认证_短信, false, 5) then
wolf_log("点击没有收到验证码")
check_tap(365,655)
mSleep(1000)
wolf_log("点击发送至手机")
mSleep(1000)
tap(366,800)
mSleep(1000)
if not find_str(ios_config.ios_查找文字.重登_设置_双重认证_短信, false, 10) then
wolf_log("双重认证页面二次加载失败")
return 400
end
end
-- 发送验证码请求次数记录
push_phone_code_num(ios_config.ios_任务信息.task_data.id)
-- end
res = get_mobile_sms(ios_config.ios_任务信息.task_data.id)
if res then
wolf_log("输入验证码")
inputKey(res.data.code)
else
wolf_log("获取验证码失败,开始反馈")
toast("获取验证码失败,开始反馈", 2)
return 500
end
wolf_log("输入验证码,下一页判断")
index_v2 = 20
while index_v2 > 0 do
x, y = find_x_y_colour(ios_config.ios_查找图色.异常弹窗_检测字_好, 1)
if x > -1 then
if find_str(ios_config.ios_查找文字.设置_登录_验证码不正确, false, 1) or find_multi_color(ios_config.ios_多色判断.登录_双重验证_验证码错误, 1) then
wolf_log("验证码不正确")
return 403
end
wolf_log("异常弹窗")
return 403
end
if find_str(ios_config.ios_查找文字.设置_登录_验证码不正确, false, 1) or find_multi_color(ios_config.ios_多色判断.登录_双重验证_验证码错误, 1) then
wolf_log("验证码不正确")
return 403
end
if find_str(ios_config.ios_查找文字.重登_设置_同意协议加载界面, false, 1) then
break
end
x, y = find_x_y_colour(ios_config.ios_查找图色.异常弹窗_检测字_好, 1)
if x > -1 then
wolf_log("登录异常弹窗")
return 403
end
if find_multi_color(ios_config.ios_多色判断.重登_设置_登录_登录成功, 1) then
wolf_log("登录页面加载成功")
mSleep(500)
return 200
end
index_v2 = index_v2 - 1
end
if index_v2 <= 0 then
wolf_log("同意协议页面加载失败")
return 400
end
mSleep(500)
wolf_log("点击同意协议按钮")
check_tap(376,1142)
end
if find_multi_color(ios_config.ios_多色判断.重登_设置_登录_云上贵州, 1) then
wolf_log("检测到云上贵州")
mSleep(500)
wolf_log("点击同意协议按钮")
check_tap(376,1142)
end
if find_multi_color(ios_config.ios_多色判断.重登_设置_登录_登录成功, 1) then
wolf_log("登录页面加载成功")
mSleep(500)
return 200
end
if find_multi_color(ios_config.ios_多色判断.重登_设置_登录_合并弹窗, 1, 1) then
mSleep(500)
wolf_log("识别到合并弹窗,选择不合并")
tap(379,1256)
end
if find_multi_color(ios_config.ios_多色判断.重登_设置_登录_icloud协议, 1) then
mSleep(500)
wolf_log("检测到icloud协议")
tap(371,1198)
if not find_multi_color(ios_config.ios_多色判断.重登_设置_登录_icloud协议条款, 30) then
wolf_log("条款加载异常")
return 400
end
mSleep(500)
wolf_log("条款加载成功,点击同意")
tap(679,1294)
if not find_multi_color(ios_config.ios_多色判断.重登_设置_登录_icloud协议条款同意弹窗, 30, 1) then
wolf_log("弹窗加载异常")
return 400
end
mSleep(500)
wolf_log("点击同意")
tap(507,780)
end
x, y = find_x_y_colour(ios_config.ios_查找图色.异常弹窗_检测字_好, 1)
if x > -1 then
wolf_log("登录异常弹窗")
return 403
end
if find_multi_color(ios_config.ios_多色判断.重登_设置_登录_登录成功, 1) then
wolf_log("登录页面加载成功")
mSleep(500)
return 200
end
index = index + 1
end
return 400
end
function step2_check_set_app()
index = 0
max_wait = 60
success = 0
while index < max_wait do
wolf_log('检测设置_媒体与项目_关')
x, y = find_x_y_colour(ios_config.ios_查找图色.设置_媒体与项目_关, 1)
if x > -1 then
wolf_log("点击媒体与项目关")
mSleep(300)
tap(x, y)
index_1 = 5
while index_1 > 0 do
wolf_log('检测设置_媒体与项目_继续')
if find_str(ios_config.ios_查找文字.设置_登录_媒体与购买项目_继续, false, 1) then
wolf_log("点击媒体与项目 继续")
mSleep(300)
tap(374, 732)
break
end
index_1 = index_1 - 1
mSleep(500)
end
if index == 0 then
wolf_log("点击媒体与项目 继续")
mSleep(3000)
wolf_log("点击媒体与项目 继续2")
tap(374, 732)
end
end
wolf_log("检测媒体与项目打开状态")
if find_str(ios_config.ios_查找文字.设置_用户_Apple界面, false, 1) and not find_str(ios_config.ios_查找文字.设置_用户_媒体与购买项目_关, false, 1) then
success = success + 1
end
if find_str(ios_config.ios_查找文字.设置_用户_媒体与购买项目_打开成功登录判断, false, 1) then
success = success + 1
end
if success >= 3 then
-- 备份
-- 创建成功,备份,回传
local account_id = string.match(ios_config.ios_任务信息.task_data.email, "([^@]+)@")
toast("开始备份,备份ID:" .. account_id, 2)
back_account(account_id)
mSleep(3000)
return_task_success(ios_config.ios_任务信息.task_data.id, account_id, ios_config.ios_任务信息.task_data.password)
return 200
end
index = index + 1
end
return 400
end
function step2_account_login()
-- 输入参数并登录
local index = 10
while index > 0 do
if find_multi_color(ios_config.ios_多色判断.注册_商店首页_头像, 1) then
toast("点击头像", 1)
check_tap(672, 172)
mSleep(1000)
end
if find_multi_color(ios_config.ios_多色判断.注册_商店首页_创建AppleID按钮, 1) then
break
end
if find_multi_color(ios_config.ios_多色判断.登录_登录结果_登录成功, 1) then
wolf_log("检测到登录成功")
return 299
end
index = index - 1
end
if index <= 0 then
toast("未定位到创建ID按钮", 10)
return 400
end
check_tap(255, 304)
mSleep(500)
wolf_inputText(ios_config.ios_任务信息.task_data.email)
mSleep(500)
check_tap(255, 398)
wolf_inputText(ios_config.ios_任务信息.task_data.password)
mSleep(500)
wolf_log("点击登录按钮")
check_tap(255, 536)
-- 判断窗口加载情况
for i = 1, 30 do
wolf_log("第" .. i .. "轮检测")
if multiColor(ios_config.ios_多色判断.登录_登陆结果_账号锁定弹窗) then
toast("账号被锁定", 3)
wolf_log("账号被锁定")
-- 账号被锁定
return 403
end
if find_str(ios_config.ios_查找文字.app_store_订阅弹窗_已锁定2, false, 1) then
toast("账号被锁定2", 3)
wolf_log("账号被锁定2")
-- 账号被锁定2
return 403
end
if find_multi_color(ios_config.ios_多色判断.登录_登陆结果_密码错误, 1) then
toast("密码错误", 3)
wolf_log("密码错误")
return 600
end
if find_multi_color(ios_config.ios_多色判断.登录_双重验证_设备验证码界面, 1) then
wolf_log("登录成功")
return 200
end
end
return 400
end
function step3_get_phone_code()
wolf_log('点击获取验证码')
-- 判断情况
check_tap(360, 649)
if not find_multi_color(ios_config.ios_多色判断.登录_双重验证_弹窗选择, 5, 1) then
wolf_log("验证码选择未弹窗")
toast("验证码选择未弹窗", 10)
return 400
end
-- 点击发送验证码
mSleep(300)
tap(358, 802)
if not find_multi_color(ios_config.ios_多色判断.登录_双重验证_短信验证码界面, 15) then
wolf_log("手机验证码窗口未记载")
toast("手机验证码窗口未记载", 10)
return 400
end
mSleep(10000)
-- 获取验证码
res = get_mobile_sms(ios_config.ios_任务信息.task_data.id)
mSleep(1000)
if res then
wolf_log("输入验证码")
inputKey(res.data.code)
mSleep(1000)
return 200
else
wolf_log("获取验证码失败")
toast("获取验证码失败", 2)
return 500
end
end
function step4_verify_login()
index = 0
max_wait = 40
while index < max_wait do
-- 判断情况
if find_multi_color(ios_config.ios_多色判断.登录_双重验证_登陆成功同意协议书, 1,1) then
mSleep(500)
wolf_log("点击同意协议")
check_tap(363, 1139)
end
if find_multi_color(ios_config.ios_多色判断.登录_登录结果_检查, 1, 1 ) then
wolf_log("检测到检查弹窗")
mSleep(300)
wolf_log("点击检查按钮")
tap(509,787)
if not find_multi_color(ios_config.ios_多色判断.登录_登录结果_检查同意页, 60, 1 ) then
wolf_log("检查同意页面加载失败")
return 400
end
-- 点击同意
mSleep(500)
tap(667,521)
-- 点击下一页
mSleep(1000)
check_tap(670,151)
if not find_multi_color(ios_config.ios_多色判断.登录_登录结果_检查账单页, 60, 1 ) then
wolf_log("检查账单页面加载失败")
return 400
end
-- 点击下一页
mSleep(1000)
check_tap(670,151)
if not find_multi_color(ios_config.ios_多色判断.登录_登录结果_检查成功页, 15, 1 ) then
wolf_log("检查成功页面加载失败")
return 400
end
mSleep(500)
check_tap(318,1210)
return 200
end
if find_multi_color(ios_config.ios_多色判断.登录_登录结果_登录成功, 1 , 1) then
wolf_log("检测到登录成功")
return 200
end
end
return 400
end
function step5_verify_icloud()
openURL("prefs:root=APPLE_ACCOUNT")
if not find_multi_color(ios_config.ios_多色判断.登录_设置检查_未激活icloud, 20, 1) then
wolf_log("未检测到激活icloud按钮")
return 400
end
-- 点击激活icloud
wolf_log("点击激活iCloud")
mSleep(1000)
tap(208,828)
if not find_multi_color(ios_config.ios_多色判断.登录_设置检查_激活icloud弹窗, 10, 1) then
wolf_log("未检测到激活icloud弹窗")
return 400
end
-- 点击继续
wolf_log("检测到弹窗,点击继续按钮")
mSleep(500)
check_tap(379,734)
index = 0
max_wait = 30
while index < max_wait do
if find_multi_color(ios_config.ios_多色判断.登录_设置检查_激活icloud密码输入框, 1) then
wolf_log("检测到密码输入弹窗")
-- 输入密码
wolf_inputText(ios_config.ios_任务信息.task_data.password)
-- 点击登录按钮
mSleep(1000)
tap(678,140)
return 400
end
if find_multi_color(ios_config.ios_多色判断.登录_设置检查_激活icloud合并数据弹窗, 1, 1) then
wolf_log("检测到合并弹窗弹出")
-- 点击不合并
mSleep(1000)
check_tap(378,1253)
mSleep(10000)
break
end
end
return 200
end
-- ----------【抓包回传】----------
function grab_app_task()
-- 初始化抓包任务
-- 写入ad2.plist文件
local xml_content = [[
id
TH
]]
if not writeFileString("/var/mobile/ad2.plist", tostring(xml_content:gsub("TH", ios_config.ios_任务信息.task_data.app_id))) then
return 400
end
mSleep(500)
pressHomeKey(0)
mSleep(100)
pressHomeKey(1)
mSleep(1000)
closeApp("*",0)
closeApp("*",1)
mSleep(1000)
os.execute("rm -rf /var/mobile/tmp.txt")
return 200
end
function step1_open_search()
for i = 1, 3 do
statusa = step1_open_app()
if statusa == 200 then
break
end
end
if statusa ~= 200 then
return statusa
end
openURL("itms-apps://search.itunes.apple.com/WebObjects/MZSearch.woa/wa/search?media=software&term=" .. urlEncoder(ios_config.ios_任务信息.task_data.name))
mSleep(1000)
local index = 20
while index > 0 do
if find_multi_color(ios_config.ios_多色判断.app_store_搜索界面无法连接, 1) then
check_tap(377, 732)
end
if find_multi_color(ios_config.ios_多色判断.app_store_搜索结果, 1) then
break
end
index = index - 1
mSleep(1000)
end
if index < 1 then
toast("app store 搜索结果加载失败...", 2)
wolf_log("app store 搜索结果加载失败...", 2)
return 400
end
-- 读tmp.txt转base64回传
index = 30
while index > 0 do
if os.execute("find /var/mobile/tmp.txt") then
break
end
mSleep(1000)
end
if index < 0 then
toast("/var/mobile/tmp.txt 文件不存在", 2)
wolf_log("/var/mobile/tmp.txt 文件不存在", 2)
return 400
end
tmp_test = readFileString("/var/mobile/tmp.txt")
tmp_test = tmp_test:base64_encode()
-- nLog(tmp_test)
return_upload_task(ios_config.ios_任务信息.task_data.app_id, tmp_test)
return 200
end
-- ----------【配置排行文件】----------
function set_app_rank_task()
local xml_content = [[
THTHTH
]]
local re_xml_content = [[
GJZ
TH
]]
local re_xml_th_str = ""
for i, task in ipairs(ios_config.ios_任务信息.task_data) do
re_xml_th_str = re_xml_th_str .. re_xml_content:gsub("GJZ", task.download_key):gsub("TH", tostring(task.app_data))
-- re_xml_th_str = re_xml_th_str .. re_xml_content:gsub("GJZ", task.download_key):gsub("TH", task.keyword .. "|" .. tostring(task.app_data))
end
xml_content = xml_content:gsub("THTHTH", re_xml_th_str)
-- nLog(xml_content)
if writeFileString("/var/mobile/ads.plist", xml_content) then
return_setRank_task(ios_config.ios_任务信息.device_id)
end
return 200
end
-- ----------【下载订阅】----------
function download_restore_account()
-- 判断备份文件是否存在
if not os.execute("find /var/root/" .. ios_config.ios_任务信息.task_info.backup_key) then
return 401
end
-- 恢复备份
check_alert()
mSleep(1000)
ext_restore_func(ios_config.ios_任务信息.task_info.backup_key)
mSleep(1000)
-- 判断是否恢复成功
pressHomeKey(0)
mSleep(100)
pressHomeKey(1)
closeApp("*",0)
closeApp("*",1)
mSleep(2000)
check_alert()
return 200
end
function download_account_not_found()
-- 下载任务失败的时候要每个任务都上报
for i, task_data in ipairs(ios_config.ios_任务信息.task_data) do
task_fail("api/v1/app_task/fail", {
code=401,
reason='账号不存在'
}, task_data.id)
end
return 200
end
function step1_download_app()
-- 直接开始搜索并订阅
-- {"code": 200, "msg": "成功", "data": {"task_type": "download_task_func", "task_info": {}, "task_data": [{"id": 250, "key": "快手", "backup_key": "s4"}]}}
run_num = 0
for i, task_data in ipairs(ios_config.ios_任务信息.task_data) do
check_alert_v2()
download_error_num = download_error_num + 1
run_num = run_num + 1
if download_error_num > 5 then
toast("app store 设备疑似点击失效...", 2)
task_fail("api/v1/app_task/fail", {
code=500,
reason='设备疑似点击失效...'
}, task_data.id)
goto download_app_continue
end
wolf_log("app 订阅执行任务 " .. task_data.id .. " - " .. task_data.key)
-- while status_code~= 200 do
-- wolf_log("尝试启动app store...")
-- toast("尝试启动app store...")
-- status_code = step1_open_app()
-- mSleep(1000)
-- closeApp("*",1)
-- end
for i = 1, 3 do
-- 重置app store状态
pressHomeKey(0)
mSleep(100)
pressHomeKey(1)
closeApp("*",1)
mSleep(1000)
open_app(ios_config.ios_app_bid.app_store)
local index = 10
while index > 0 do
if find_multi_color(ios_config.ios_多色判断.注册_欢迎按钮, 1) then
check_tap(374, 1168)
end
if find_multi_color(ios_config.ios_多色判断.注册_商店首页_头像, 1) then
break
end
if find_multi_color(ios_config.ios_多色判断.app_store_首页_无法连接_重试, 1) then
check_tap(370, 742)
mSleep(1000)
end
index = index - 1
end
if index > 0 then
break
end
end
if index <= 0 then
toast("app store 启动失败...", 2)
wolf_log("app store 搜索页面加载失败...", 2)
task_fail("api/v1/app_task/fail", {
code=500,
reason='app store 启动失败...'
}, task_data.id)
goto download_app_continue
end
toast("点击搜索...", 1)
check_tap(652, 1270)
if not find_multi_color(ios_config.ios_多色判断.app_store_搜索页面, 20) then
toast("app store 搜索页面加载失败...", 2)
wolf_log("app store 搜索页面加载失败...", 2)
if find_str(ios_config.ios_查找文字.app_store_更改商店, true, 1) or find_str(ios_config.ios_查找文字.app_store_查看条款, true, 1) then
wolf_log("更改商店")
return_deactivate_task(ios_config.ios_任务信息.task_info.backup_key)
task_fail("api/v1/app_task/fail", {
code=499,
reason='账号已封号(转区)...'
}, task_data.id)
tap(234,783)
else
task_fail("api/v1/app_task/fail", {
code=500,
reason='搜索页面加载失败...'
}, task_data.id)
end
goto download_app_continue
end
toast("点击输入框...", 1)
check_tap(387, 267)
if not find_multi_color(ios_config.ios_多色判断.输入键盘页面, 20) then
toast("app store 搜索框点击失败...", 2)
wolf_log("app store 搜索框点击失败...")
task_fail("api/v1/app_task/fail", {
code=500,
reason='搜索框点击失败...'
}, task_data.id)
goto download_app_continue
end
wolf_inputText(task_data.key)
toast("点击search...", 1)
check_tap(666, 1287)
toast("等待搜索结果...", 1)
index = 5
while index > 0 do
toast("第".. (5 - index) .. "次检测搜索状态", 1)
-- if find_multi_color(ios_config.ios_多色判断.app_store_搜索界面无法连接, 1) then
-- toast("搜索界面无法连接点击重试...", 2)
-- check_tap(377, 732)
-- end
if find_str(ios_config.ios_查找文字.app_store_无法连接_重试, false, 1) then
toast("搜索界面无法连接点击重试...", 1)
check_tap(377, 732)
end
if find_multi_color(ios_config.ios_多色判断.app_store_搜索结果2, 1) then
toast("搜索正常跳出检测...", 1)
break
end
if index % 2 == 0 then
toast("检测账号被锁定2", 1)
if find_str(ios_config.ios_查找文字.app_store_订阅弹窗_已锁定2, false, 1) then
wolf_log("账号被锁定2...")
return_deactivate_task(ios_config.ios_任务信息.task_info.backup_key)
task_fail("api/v1/app_task/fail", {
code=499,
reason='账号被锁定2...'
}, task_data.id)
download_error_num = 3
goto download_app_continue
end
end
index = index - 1
mSleep(1000)
end
if not find_multi_color(ios_config.ios_多色判断.app_store_搜索结果, 15) then
toast("app store 搜索结果加载失败...", 2)
wolf_log("app store 搜索结果加载失败...")
task_fail("api/v1/app_task/fail", {
code=500,
reason='搜索结果加载失败...'
}, task_data.id)
goto download_app_continue
end
index = 10
tap_num = 0
while index > 0 do
x, y = find_x_y_colour(ios_config.ios_查找图色.订阅APP获取, 1)
if x > -1 then
break
end
if index % 4 == 0 then
if find_str(ios_config.ios_查找文字.app_store_更改商店, true, 1) or find_str(ios_config.ios_查找文字.app_store_查看条款, true, 1) then
wolf_log("更改商店")
return_deactivate_task(ios_config.ios_任务信息.task_info.backup_key)
task_fail("api/v1/app_task/fail", {
code=499,
reason='账号已封号(转区)...'
}, task_data.id)
download_error_num = 0
tap(234,783)
goto download_app_continue
end
x, y = find_x_y_colour(ios_config.ios_查找图色.重复订阅云下载标志_2, 1)
if x > -1 then
wolf_log("app store 已被订阅")
toast("app store 已被订阅", 2)
task_fail("api/v1/app_task/fail", {
code=503,
reason='账号已订阅该项目...'
}, task_data.id)
download_error_num = 0
goto download_app_continue
end
end
index = index - 1
end
-- 点击获取按钮
if index > 0 and x > -1 then
check_tap(x + 2, y + 2)
-- check_tap(x + 2, y + 2)
-- for i = 1, 2 do
-- check_tap(x + 2, y + 2)
-- -- toast("第".. i .. "次点击获取按钮", 1)
-- -- mSleep(200)
-- end
else
wolf_log("app store 获取按钮定位失败...")
toast("app store 获取按钮定位失败...", 2)
task_fail("api/v1/app_task/fail", {
code=489,
reason='获取按钮定位失败...'
}, task_data.id)
goto download_app_continue
end
toast("等待三秒钟后开始检测", 1)
mSleep(3000)
index = 20
tap_num = 0
while index > 0 do
toast("第".. (20 - index) .. "次检查安装账号状态", 1)
-- toast("开始检查安装账号状态", 2)
if find_multi_color(ios_config.ios_多色判断.app_store_订阅安装弹窗, 1) then
mSleep(500)
check_tap(373, 1236)
--check_tap(373, 1236)
mSleep(500)
tap_num = tap_num +1
elseif tap_num > 0 then
break
end
if index % 3 == 0 then
toast("重复订阅云下载标志", 1)
x, y = find_x_y_colour(ios_config.ios_查找图色.重复订阅云下载标志_2, 1)
if x > -1 then
wolf_log("app store 已被订阅")
toast("app store 已被订阅", 2)
task_fail("api/v1/app_task/fail", {
code=503,
reason='账号已订阅该项目5105...'
}, task_data.id)
goto download_app_continue
end
end
if index % 3 == 0 then
x, y = find_x_y_colour(ios_config.ios_查找图色.订阅APP获取, 1)
toast("重复点击获取按钮", 1)
check_tap(x + 2, y + 2)
end
if find_str(ios_config.ios_查找文字.app_store_订阅弹窗_5105, false, 1) then
wolf_log("app store 已被订阅 2")
toast("app store 已被订阅 2", 2)
task_fail("api/v1/app_task/fail", {
code=503,
reason='账号已订阅该项目5105...'
}, task_data.id)
goto download_app_continue
end
if index % 6 == 0 then
toast("检测帐号状态-1", 1)
if find_multi_color(ios_config.ios_多色判断.商店_下载_异常,1,true) then
wolf_log("账号未激活,反馈状态")
return_deactivate_task(ios_config.ios_任务信息.task_info.backup_key)
task_fail("api/v1/app_task/fail", {
code=499,
reason='账号未激活...'
}, task_data.id)
goto download_app_continue
end
if find_str(ios_config.ios_查找文字.app_store_订阅弹窗_未激活需要登录2, false, 1) then
wolf_log("账号未激活,反馈状态2")
return_deactivate_task(ios_config.ios_任务信息.task_info.backup_key)
task_fail("api/v1/app_task/fail", {
code=449,
reason='账号未激活2...'
}, task_data.id)
download_error_num = 0
goto download_app_continue
end
if find_str(ios_config.ios_查找文字.app_store_订阅弹窗_未激活需要登录3, false, 1) then
wolf_log("账号未激活,反馈状态2")
return_deactivate_task(ios_config.ios_任务信息.task_info.backup_key)
task_fail("api/v1/app_task/fail", {
code=449,
reason='账号未激活2...'
}, task_data.id)
download_error_num = 0
goto download_app_continue
end
if find_str(ios_config.ios_查找文字.app_store_订阅弹窗_未激活需要登录4, false, 1) then
wolf_log("账号未激活,反馈状态2")
return_deactivate_task(ios_config.ios_任务信息.task_info.backup_key)
task_fail("api/v1/app_task/fail", {
code=449,
reason='账号未激活2...'
}, task_data.id)
download_error_num = 0
goto download_app_continue
end
if find_str(ios_config.ios_查找文字.app_store_更改商店, true, 1) or find_str(ios_config.ios_查找文字.app_store_查看条款, true, 1) or find_str(ios_config.ios_查找文字.app_store_更改商店2, true, 1) or find_str(ios_config.ios_查找文字.app_store_账户不在此店面, true, 1) then
wolf_log("更改商店")
toast("账号已封号(转区)", 1)
return_deactivate_task(ios_config.ios_任务信息.task_info.backup_key)
task_fail("api/v1/app_task/fail", {
code=499,
reason='账号已封号(转区)...'
}, task_data.id)
download_error_num = 0
tap(234,783)
goto download_app_continue
end
if find_str(ios_config.ios_查找文字.app_store_订阅弹窗_已停用, false, 1) or find_str(ios_config.ios_查找文字.app_store_订阅弹窗_已停用2, false, 1)then
wolf_log("账号被停用...")
return_deactivate_task(ios_config.ios_任务信息.task_info.backup_key)
task_fail("api/v1/app_task/fail", {
code=499,
reason='账号被停用...'
}, task_data.id)
download_error_num = 3
goto download_app_continue
end
if find_str(ios_config.ios_查找文字.app_store_订阅弹窗_被禁用, false, 1) then
wolf_log("账号被禁用...")
return_deactivate_task(ios_config.ios_任务信息.task_info.backup_key)
task_fail("api/v1/app_task/fail", {
code=499,
reason='账号被禁用...'
}, task_data.id)
download_error_num = 3
goto download_app_continue
end
if find_str(ios_config.ios_查找文字.app_store_订阅弹窗_已锁定, false, 1) then
wolf_log("账号被锁定...")
return_deactivate_task(ios_config.ios_任务信息.task_info.backup_key)
task_fail("api/v1/app_task/fail", {
code=499,
reason='账号被锁定...'
}, task_data.id)
download_error_num = 3
goto download_app_continue
end
toast("检测账号被锁定2", 1)
if find_str(ios_config.ios_查找文字.app_store_订阅弹窗_已锁定2, false, 1) then
wolf_log("账号被锁定2...")
return_deactivate_task(ios_config.ios_任务信息.task_info.backup_key)
task_fail("api/v1/app_task/fail", {
code=499,
reason='账号被锁定2...'
}, task_data.id)
download_error_num = 3
goto download_app_continue
end
end
index = index - 1
mSleep(1000)
end
if tap_num == 0 then
wolf_log("app store 订阅安装弹窗加载失败...")
toast("app store 订阅安装弹窗加载失败...", 2)
task_fail("api/v1/app_task/fail", {
code=400,
reason='订阅安装弹窗加载失败...'
}, task_data.id)
goto download_app_continue
end
for i = 1, 10 do
toast("第".. i .. "次检测获取后帐号状态", 1)
if find_str(ios_config.ios_查找文字.app_store_弹窗服务条款更改, false, 1) then
toast("app store 媒体服务条款变更弹窗", 2)
mSleep(500)
check_tap(508, 808)
check_tap(508, 808)
mSleep(1000)
end
if find_str(ios_config.ios_查找文字.app_store_同意条款, false, 1) then
toast("app store 同意条款", 2)
mSleep(500)
check_tap(680, 135)
check_tap(680, 135)
mSleep(500)
toast("app store 点击同意", 2)
check_tap(508, 808)
mSleep(500)
goto download_app_continue
end
if find_multi_color(ios_config.ios_多色判断.订阅_app_store_异常弹窗, 1, true) then
wolf_log("app store 已被订阅 2")
toast("app store 已被订阅 2", 2)
task_fail("api/v1/app_task/fail", {
code=503,
reason='账号已订阅该项目2...'
}, task_data.id)
goto download_app_continue
end
if find_str(ios_config.ios_查找文字.app_store_订阅弹窗_5105, false, 1) then
wolf_log("app store 已被订阅 2")
toast("app store 已被订阅 2", 2)
task_fail("api/v1/app_task/fail", {
code=503,
reason='账号已订阅该项目5105...'
}, task_data.id)
goto download_app_continue
end
if find_multi_color(ios_config.ios_多色判断.app_store_订阅输入密码框, 1, true) then
wolf_log("账号未激活,反馈状态1")
return_deactivate_task(ios_config.ios_任务信息.task_info.backup_key)
task_fail("api/v1/app_task/fail", {
code=449,
reason='账号未激活1...'
}, task_data.id)
download_error_num = 0
goto download_app_continue
end
if find_str(ios_config.ios_查找文字.app_store_获取检测, true, 1) then
return_download_task_success(task_data.id, task_data.key)
download_error_num = 0
goto download_app_continue
end
end
::download_app_continue::
end
if download_error_num > 5 then
reload_spring()
-- return_device_error(ios_config.ios_任务信息.device_id)
-- lua_exit()
lua_restart()
end
return 200
end
-- ----------【任务沉睡】----------
function get_task_sleep()
-- mSleep(60000)
mSleep(math.random(30000, 60000))
return 200
end
-- ----------【执行命令】----------
function run_extension()
os.execute(ios_config.ios_任务信息.task_data.bash)
return_deviceExtUpdate_task(ios_config.ios_任务信息.device_id, ios_config.ios_任务信息.task_data.version)
reload_spring()
lua_restart()
return 200
end
-- ----------【以下功能暂未使用】----------
function register_mobile_district()
-- 注册手机号选地区
toast("进入下一页", 2)
tap(663, 134)
mSleep(1000)
-- 点击完成,查验手机号页面
if find_str(ios_config.ios_查找文字.app_store_注册apple手机号_选择其他号码, true, 5) then
tap(365, 652)
mSleep(1000)
end
if not find_str(ios_config.ios_查找文字.app_store_注册apple手机号验证, true, 5) then
toast("等待重新进入", 2)
tap(82, 132)
mSleep(1000)
return register_mobile_district()
end
toast("加载完毕", 2)
return 0, 0
end
function step2_login_account()
-- relogin_chek_alert()
-- wolf_log('检测弹窗2')
-- find_table = ios_config.ios_查找文字.重登_设置_电话异常弹窗
-- if findTextUntil(find_table[1], find_table[2], find_table[3], find_table[4], find_table[5], find_table[6], "", find_table[7], 1) then
-- toast("异常弹窗_电话", 2)
-- tap(223, 760)
-- end
-- 点开 app store 右上角用户
local index = 10
local tap_num = 0
while index > 0 and tap_num < 3 do
if index % 10 == 5 then
relogin_chek_alert()
end
toast("第" .. index .. "次检测登录结果" .. tap_num, 1)
wolf_log("第" .. index .. "次检测登录结果" .. tap_num)
if find_multi_color(ios_config.ios_多色判断.注册_商店首页_头像, 1) then
wolf_log("定位到头像")
toast("点击头像", 1)
check_tap(672, 172)
tap_num = tap_num + 1
end
if find_multi_color(ios_config.ios_多色判断.注册_商店首页_创建AppleID按钮, 1) then
wolf_log("定位到创建ID按钮")
break
end
if find_str(ios_config.ios_查找文字.app_store_登录, false, 1) then
-- 还没登录就已经有账号登录了
wolf_log("检测到已经登录成功")
return 200
end
toast("多色判断.app_store_用户_账户个人资料", 2)
if find_multi_color(ios_config.ios_多色判断.app_store_用户_账户个人资料, 1) then
return 200
end
toast("多色判断.app_store_用户_账户个人资料2", 2)
if find_multi_color(ios_config.ios_多色判断.app_store_用户_账户个人资料2, 1) then
return 200
end
index = index - 1
end
if index <= 0 or tap_num >= 3 then
wolf_log("未定位到创建ID按钮")
toast("未定位到创建ID按钮", 10)
new_system_device()
return 400
end
check_tap(286, 300)
mSleep(500)
wolf_inputText(ios_config.ios_任务信息.task_data.email)
check_tap(271, 407)
mSleep(500)
wolf_inputText(ios_config.ios_任务信息.task_data.password)
mSleep(500)
-- 回车
check_tap(676,1292)
::check_login_result::
i = 0
while i < 30 do
toast("第" .. i .. "次检测双重认证", 1)
wolf_log("第" .. i .. "次检测双重认证")
if i % 10 == 5 then
relogin_chek_alert()
end
if find_str(ios_config.ios_查找文字.重登_设置_双重认证, false, 1) then
wolf_log("双重认证页面检测成功")
-- 获取验证码
res = get_mobile_sms(ios_config.ios_任务信息.task_data.id)
if res then
wolf_log("输入验证码")
inputKey(res.data.code)
break
else
wolf_log("获取验证码失败,开始反馈")
toast("获取验证码失败,开始反馈", 2)
return 400
end
end
if find_str(ios_config.ios_查找文字.重登_商店_封号, false, 1) then
wolf_log("检测到封号")
return 500
end
if find_str(ios_config.ios_查找文字.app_store_订阅弹窗_已锁定2, false, 1) then
wolf_log("账号被锁定2")
return 499
end
if find_str(ios_config.ios_查找文字.重登_设置_双重异常弹窗, false, 1) then
wolf_log("检测到异常")
return 400
end
if find_str(ios_config.ios_查找文字.app_store_登录, false, 1) then
-- 上次输入过验证码了,直接登录成功
wolf_log("检测到已经登录成功")
return 200
end
if find_multi_color(ios_config.ios_多色判断.重登_商店_锁定, 1, true) then
wolf_log("检测到ID锁定")
tap(511,781)
return 499
end
i = i + 1
end
if i >= 29 then
wolf_log("双重认证页面检测失败")
return 400
end
for i=1,8 do
if i % 10 == 5 then
relogin_chek_alert()
end
toast("第" .. i .. "次检测登录结果", 1)
wolf_log("第" .. i .. "次检测登录结果")
if find_multi_color(ios_config.ios_多色判断.重登_商店_云上贵州协议, 1, true) then
wolf_log("检测到云上贵州/Apple协议,点击同意")
check_tap(373,1139)
i = 1
end
if find_str(ios_config.ios_查找文字.app_store_登录, false, 1) then
wolf_log("登录成功")
return 200
end
if find_multi_color(ios_config.ios_多色判断.重登_商店_首次登录失败, 1) and find_multi_color(ios_config.ios_多色判断.注册_商店首页_创建AppleID按钮, 1) then
wolf_log("定位到创建ID按钮,重新登录")
check_tap(87,539)
goto check_login_result
end
end
wolf_log("登录失败")
return 400
end
function step3_open_icloud()
relogin_chek_alert()
openURL("prefs:root=APPLE_ACCOUNT&path=FAMILY")
if find_multi_color(ios_config.ios_多色判断.重登_设置_登录成功, 1, true) then
wolf_log("登录成功")
return 200
end
i = 0
while i < 20 do
wolf_log("第" .. i .. "次检测继续")
if find_str(ios_config.ios_查找文字.重登_设置_开始使用IC, false, 1) then
wolf_log("重登_设置_开始使用IC加载成功")
check_tap(178,820)
end
if find_str(ios_config.ios_查找文字.重登_设置_继续使用IC, true, 1) then
wolf_log("重登_设置_继续使用IC加载成功")
check_tap(376,752)
mSleep(4000)
break
end
i = i + 1
end
if i >= 20 then
wolf_log("继续加载失败 退出")
return 400
end
i = 0
while i < 10 do
wolf_log("第".. i .. "次检测")
if i % 10 == 5 then
relogin_chek_alert()
end
if find_multi_color(ios_config.ios_多色判断.重登_设置_登录成功, 1, true) then
wolf_log("登录成功")
return 200
end
if find_str(ios_config.ios_查找文字.重登_设置_IC密码, false, 1) then
wolf_log("重登_设置_IC密码加载成功")
mSleep(500)
wolf_inputText(ios_config.ios_任务信息.task_data.password)
-- wolf_inputText("As456987@!788")
mSleep(500)
-- 回车
check_tap(676,1292)
break
end
if find_multi_color(ios_config.ios_多色判断.重登_设置_开启IC服务, 1, true) then
wolf_log("检测到服务协议")
check_tap(374,1193)
i = 1
end
if find_str(ios_config.ios_查找文字.重登_设置_IC协议, false, 1) then
wolf_log("重登_设置_IC协议加载成功")
mSleep(500)
check_tap(679,1289)
mSleep(1000)
if find_str(ios_config.ios_查找文字.重登_设置_IC协议同意, false, 1) then
wolf_log("弹窗识别成功 点击同意")
check_tap(519,768)
i = 1
break
end
break
end
if find_str(ios_config.ios_查找文字.重登_设置_激活IC上限, false, 1) then
wolf_log("IC激活上限")
return 400
end
if find_str(ios_config.ios_查找文字.重登_设置_双重异常弹窗, false, 1) then
wolf_log("IC激活上限")
return 400
end
i = i + 1
end
if i >= 29 then
return 400
end
for i = 1, 60 do
if i % 10 == 5 then
relogin_chek_alert()
end
if find_multi_color(ios_config.ios_多色判断.重登_设置_登录成功, 1, true) then
wolf_log("登录成功")
return 200
end
end
return 400
end