此为个人使用简化版脚本,因个人使用“秋风”插件来实现给大号浇水等功能,所以,此脚本仅用来批量登陆支付宝账号,并同步步数使用。

//插入代码
toastLog("此脚本用于支付宝小号步数同步");
work()
//启动支付宝
shell("am start com.eg.android.AlipayGphone/.AlipayLogin",true)
//////函数部分
function work() {
    console.show()
    console.setPosition(0,device.height/2);
    syn_steps_accounts();
    app.startActivity("console");
}

function syn_steps_accounts() {
    var Accounts =[]
    var Passwords=[]

    Accounts[0]=""
    Passwords[0]=""
    
    Accounts[1]=""
    Passwords[1]=""

    //有更多小号,一次添加即可


    for (let k = 0; k <Accounts.length; k++) {
        account = Accounts[k]
        password = Passwords[k]
        if(account){
            switchAccount(account, password);
        }else{
            console.error("当前账号为空,已跳过")
            log("------------------")
            sleep(200)
            continue         
        }
        log("= = = = = = = = = =")
        accountOrder=k+1
        log("当前为第" + accountOrder +"//总" + Accounts.length +"个账号")
        log("= = = = = = = = = =")
        log("账号/密码:" + account +"/"+ password +"")
        log("- - - - - - - - -")
        sleep(3000)
        if (text("首页").exists()){
            log("登录成功,开始同步步数…")
            log("- - - - - - - - - -")
            sleep(500)
        }else{
            console.error("账号登不上,切换")
            log("- - - - - - - - - -")
            sleep(2000)
            continue
        }
        syncToAlipay();
    }
}


function syncToAlipay() {
    for (var i = 0; i < 2; i++) {
        go_sports()
        desc("今日步数").findOne(3000)
        sleep(3500)
        back();
        text("首页").findOne(2500)  //设置2秒 超时 返回null
        sleep(1500)
        
    }
    //back()
}

//打开支付宝运动
function go_sports(){
    shell("am start alipayqr://platformapi/startapp?saId=20000869",true)
    sleep(1500)
}


function switchAccount(account, key) {

    //切换账号
    shell("am start alipayqr://platformapi/startapp?appId=20000008",true)

        text("换个账号登录").click()
        sleep(2000)
        setText(account);
        sleep(1000)
        idContains("nextButton").click()
        sleep(1000)
        if (text("短信验证码登录").exists()){
            text("换个方式登录").click();
            sleep(1500);
            //text("密码登录").findOne().click()
            click(280,870);
            sleep(1000);
            setText(0, account);
            sleep(100);
            setText(1, key);
            sleep(100);
            setText(0, account);
        }else{
            sleep(1000);
            setText(0, account);
            sleep(100);
            setText(1, key);
            sleep(100);
            setText(0, account);
        }

        sleep(1500)
        //idContains("loginButton").findOne().click()
        idContains("loginButton").click()

    log("- - -开始登陆- - -")
}