Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加订阅这一分 #75

Open
colincai opened this issue Jun 19, 2020 · 3 comments
Open

增加订阅这一分 #75

colincai opened this issue Jun 19, 2020 · 3 comments

Comments

@colincai
Copy link

colincai commented Jun 19, 2020

/**

  • @description: 学习平台订阅

  • @param: null

  • @return: null
    */
    function dingyue()
    {
    h=device.height;//屏幕高
    w=device.width;//屏幕宽
    x=(w/3)*2;//横坐标2分之3处
    h1=(h/6)*5;//纵坐标6分之5处
    h2=(h/6);//纵坐标6分之1处

    click("订阅");
    sleep(random(1000,2000)) ;
    click("添加");
    sleep(random(1000,2000)) ;
    var i=0
    while(i<cCount){
    var object = desc("订阅").find();
    if (!object.empty()) {

         // 遍历订阅图标
         object.forEach(function (currentValue, index) {
            
             // currentValue:订阅按钮           
             if (currentValue && i<cCount) {
                 var like = currentValue.parent()
    
                 if (like.click()) {
                     console.log("订阅成功")
                     i++;
                     sleep(random(1000,2000))  //随机延时
                 } else {
                     console.log("Error:订阅失败")
                 }
             }
         })
    
     } else if( text("你已经看到我的底线了").exists()){
         console.log("Error:没有可以订阅的平台了!");
         break;}
         else{
         swipe(x,h1,x,h2,500);
        
     }
    

    }
    back();
    sleep(random(1000,2000)) ;
    }

getScores();//获取积分 ,在获取积分后面增加一个if语句
if (myScores['订阅'] != 1) {
dingyue();//订阅
}

在function main() 中增加一行调用

dingyue();//订阅学习平台

本人初学者,写的不好,请大家指正

@sanfordkai
Copy link

大佬你好,这个要粘贴到哪里呢?

@sanfordkai
Copy link

这上面的全部要复制吗?

@colincai
Copy link
Author

上面是函数部分,放在3.13最下面就好,
下面加粗部分是说明
放在相应的地方就好

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@colincai @sanfordkai and others