blogger

柠阿乐の博客

于是,我为之努力
职教云自动签到php版

身为大学生深受签到毒害
受到自动签到python脚本启发
写了这份php版职教云自动签到
技术不好 写的就那样


<?php
/*
*------------------------------------------------------
* Title : 职教云自动签到PHP版
*------------------------------------------------------
* Author : 750116098@qq.com
*------------------------------------------------------
* Time : 2020-04-25
*------------------------------------------------------
* Tips : 感谢@童话的python脚本提供参考
*------------------------------------------------------
*/
header('content-type:text/html;charset=UTF-8');
date_default_timezone_set("PRC");
//$api="https://zjyapp.icve.com.cn/newmobileapi";
$url_api="https://zjyapp.icve.com.cn/newmobileapi/mobilelogin/newlogin";
$url_api2="https://zjyapp.icve.com.cn/newmobileapi/faceteach/getStuFaceTeachList";
$url_api3="https://zjyapp.icve.com.cn/newmobileapi/faceteach/newGetStuFaceActivityList";
$url_api4="https://zjyapp.icve.com.cn/newmobileapi/faceteach/isJoinActivities";
$url_api5="https://zjyapp.icve.com.cn/newmobileapi/faceteach/saveStuSign";
//$url_api6="https://sc.ftqq.com/[skey].send";//自己看server酱说明配置
//$url_api6="";//qq发信api
$headers = array(
            "Content-Type"=>"application/x-www-form-urlencoded","Host"=>"zjyapp.icve.com.cn","Connection"=>"Keep-Alive","Accept-Encoding"=>"gzip","User-Agent"=>"okhttp/3.10.0"
        );
$mail="750116098@qq.com";//邮箱地址
$userName="账号";//账号
$userPwd="密码";//密码
$loginData = array("clientId"=>"432701808fe1403e80903fb32730e4d4", "sourceType"=>"2", "userPwd"=>$userPwd, "userName"=>$userName,"appVersion"=>"2.8.19");

//curl初始化
                $ch=curl_init();
                curl_setopt($ch, CURLOPT_URL, $url_api);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); 
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
                
                curl_setopt($ch, CURLOPT_POST, 1);
                
        curl_setopt($ch, CURLOPT_POSTFIELDS, $loginData);
                
        $output = curl_exec($ch);
                
        curl_close($ch);
        $output = json_decode($output,true);
        //print_r($output);

    $stuId = $output["userId"];
        $faceDate = date("Y-m-d");
        $todayClassData = array("stuId"=>$stuId, "faceDate"=>$faceDate);
        $curl=curl_init();
                curl_setopt($curl, CURLOPT_URL, $url_api2);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); 
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); 
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl,CURLOPT_HTTPHEADER,$headers);
                
                curl_setopt($curl, CURLOPT_POST, 1);
                
        curl_setopt($curl, CURLOPT_POSTFIELDS, $todayClassData);
                
        $output2 = curl_exec($curl);
                
        curl_close($curl);
        $output2 = json_decode($output2,true);
       //print_r($output2);
           
           
           
                $todayClassInfo=$output2["dataList"];
        if(!empty($todayClassInfo)){
                foreach($todayClassInfo as $i){
                        $inClassData = array(
            "activityId"=>$i["Id"], "stuId"=>$stuId, "classState"=>$i["state"], "openClassId"=>$i["openClassId"]
        );
                };
                $curl2=curl_init();
                curl_setopt($curl2, CURLOPT_URL, $url_api3);
        curl_setopt($curl2, CURLOPT_SSL_VERIFYPEER, FALSE); 
        curl_setopt($curl2, CURLOPT_SSL_VERIFYHOST, FALSE); 
        curl_setopt($curl2, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl2,CURLOPT_HTTPHEADER,$headers);
                
                curl_setopt($curl2, CURLOPT_POST, 1);
                
        curl_setopt($curl2, CURLOPT_POSTFIELDS, $inClassData);
                
        $output3 = curl_exec($curl2);
                
        curl_close($curl2);
        $output3 = json_decode($output3,true);
        //print_r($output3);
                $inClassInfo=$output3["dataList"];
                if(count($inClassInfo) != 0){
                        foreach($inClassInfo as $n){
                                 if ($n["DataType"] == "签到" and $n["State"] != 3){
                                         $attendData = array("activityId"=>$i["Id"], "openClassId"=>$i["openClassId"], "stuId"=>$stuId, "typeId"=>$n["Id"], "type"=>"1");
                                                 $curl3=curl_init();
                                                curl_setopt($curl3, CURLOPT_URL, $url_api4);
                                                curl_setopt($curl3, CURLOPT_SSL_VERIFYPEER, FALSE); 
                                                curl_setopt($curl3, CURLOPT_SSL_VERIFYHOST, FALSE); 
                                                curl_setopt($curl3, CURLOPT_RETURNTRANSFER, 1);
                                                curl_setopt($curl3,CURLOPT_HTTPHEADER,$headers);
                
                                                curl_setopt($curl3, CURLOPT_POST, 1);
                
                                                curl_setopt($curl3, CURLOPT_POSTFIELDS, $attendData);
                
                                                $output4 = curl_exec($curl3);
                
                                                curl_close($curl3);
                                                $output4 = json_decode($output4,true);
                                                //print_r($output4);
                                                $attendInfo=$output4;
                                        
                                                if($attendInfo["isAttend"] != 1){
                                                $signInData = array("signId"=>$n["Id"], "stuId"=>$stuId, "openClassId"=>$i["openClassId"],"sourceType"=>"2", "checkInCode"=>"","activityId"=>"");
                                                $curl4=curl_init();
                                                curl_setopt($curl4, CURLOPT_URL, $url_api5);
                                                curl_setopt($curl4, CURLOPT_SSL_VERIFYPEER, FALSE); 
                                                curl_setopt($curl4, CURLOPT_SSL_VERIFYHOST, FALSE); 
                                                curl_setopt($curl4, CURLOPT_RETURNTRANSFER, 1);
                                                curl_setopt($curl4,CURLOPT_HTTPHEADER,$headers);
                
                                                curl_setopt($curl4, CURLOPT_POST, 1);
                
                                                curl_setopt($curl4, CURLOPT_POSTFIELDS, $signInData);
                
                                                $output5 = curl_exec($curl4);
                                                curl_close($curl4);
                                                $output5 = json_decode($output5,true);
                                                //print_r($output5);
                                                $time=date("Y-m-d H:i:s");
                                                //$result=$i["courseName"] + " " + $time + " " + $output5["msg"]+"\r\n";
                                                echo $i["courseName"]." ".$time." ".$output5["msg"]."\r\n";
                                                //发信啊通知宝贝!!
                                                $curl5=curl_init();
                                                //wx通知就删除下面一行开头的双斜杠
                                                //$msgData = array("text"=>"签到通知","desp"=>$i["courseName"].$time.$output5["msg"]);
                                                //扣扣邮箱通知就删除下面一行开头的双斜杠
                                                //$msgData = array("address"=>$mail,"name"=>"签到通知","certno"=>$i["courseName"].$time.$output5["msg"]);
                                                curl_setopt($curl5, CURLOPT_URL, $url_api6);
                                                curl_setopt($curl5, CURLOPT_SSL_VERIFYPEER, FALSE); 
                                                curl_setopt($curl5, CURLOPT_SSL_VERIFYHOST, FALSE); 
                                                curl_setopt($curl5, CURLOPT_RETURNTRANSFER, 1);
                                                //curl_setopt($curl5,CURLOPT_HTTPHEADER,$headers);
                
                                                curl_setopt($curl5, CURLOPT_POST, 1);
                                        
                                                curl_setopt($curl5, CURLOPT_POSTFIELDS, $msgData);
                
                                                $output6 = curl_exec($curl5);
                
                                                curl_close($curl5);
                                                $output6 = json_decode($output6,true);
                                                //print_r($output6);
                                                }else{
                                                        echo $i["courseName"].$n['DateCreated']."的签到已经签到!"."<br>";
                                                        
                                        };
                                };
                                echo "暂时没有其他签到!"."<br>";
                        };
        };        
        }else{
                echo "今日没有课唉 要好好休息哦!";
};


评论(1)

© 2018  柠阿乐の博客  · emlog

蜀ICP备19013579号-柠阿乐   Design by 柠阿乐