最新职教云自动签到PHP版

  • Author: qingshan
  • Tips: 感谢@童话的python脚本提供参考

5月30日更新

数据库形式的自动签到,多帐号的自己创建个conn.php然后连接数据库就行了;不想弄的就把foreach删掉。

<?php
//数据库
include('conn.php');
header('content-type:text/html;charset=UTF-8');
date_default_timezone_set("PRC");
$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"
        );
foreach ($rows as $row){
$mail=$row['mail'];//邮箱地址
$userName=$row['userName'];//账号
$userPwd=$row['userPwd'];//密码
//get newtoken

$urls="https://zjyapp.icve.com.cn/newmobileapi/mobilelogin/getNewToken";
$data = array("userName"=>$userName,"userPwd"=>$userPwd,"sourceType"=>"3","clientId"=>"04fbaf3b874041b68db529f24b5aa86b");
$output=curl_post($urls,$headers,$data);
//print_r($output);
$newtoken=$output['newToken'];


//login        
$url="https://zjyapp.icve.com.cn/newMobileAPI/MobileLogin/newLogin";
$data=array("appVersion"=>"2.8.23","clientId"=>"04fbaf3b874041b68db529f24b5aa86b","sourceType"=>"3","userName"=>$userName,"userPwd"=>$userPwd);
$output=curl_post($url,$headers,$data);
//print_r($output);
if($output['code'] !== "1"){
    $stuId = $output["userId"];
    $faceDate = date("Y-m-d");
    //echo $stuId;
    
//get jrkt    
$url2="https://zjyapp.icve.com.cn/newmobileapi/faceteach/getStuFaceTeachList";
$data="stuId={$stuId}&faceDate={$faceDate}&newToken={$newtoken}";

//$data=array("stuId"=>$stuId,"faceDate"=>$faceDate,"newToken"=>$newtoken);
$output=curl_post($url2,$headers,$data);
//print_r($output);
    $todayClassInfo=$output["dataList"];
    
//    
$url_api3="https://zjyapp.icve.com.cn/newmobileapi/faceteach/newGetStuFaceActivityList";
if(!empty($todayClassInfo)){
        foreach($todayClassInfo as $i){
            $data="activityId={$i["Id"]}&stuId={$stuId}&classState={$i['state']}&openClassId={$i['openClassId']}&newToken={$newtoken}";
    
$output=curl_post($url_api3,$headers,$data);
//print_r($output);        
$inClassInfo=$output["dataList"];

//
$url_api4="https://zjyapp.icve.com.cn/newmobileapi/faceteach/isJoinActivities";
    if(count($inClassInfo) != "0"){
            foreach($inClassInfo as $n){
                 if ($n["DataType"] == "签到" and $n["State"] !== "3"){
                 $attendData = "activityId={$i['Id']}&openClassId={$i['openClassId']}&stuId={$stuId}&typeId={$n['Id']}&type=1&newToken={$newtoken}";
    $output=curl_post($url_api4,$headers,$attendData);
    //print_r($output);
    $attendInfo=$output;
    
    
$url_api5="https://zjyapp.icve.com.cn/newmobileapi/faceteach/saveStuSign";
            if($attendInfo["isAttend"] != "1"){
            $signInData = "signId={$n['Id']}&stuId={$stuId}&openClassId={$i['openClassId']}&sourceType=3&checkInCode={$n['Gesture']}&activityId={$i['Id']}&newToken={$newtoken}";
                    $output=curl_post($url_api5,$headers,$signInData);
                    $time=date("Y-m-d H:i:s");
                    echo '账号:'.$row['userName'].'的'.$i["courseName"]." ".$time." ".$output["msg"]."\r\n";
                    $url_api6="http://api.muxiaoguo.cn/api/mail?address={$mail}&name=职教云助手签到通知&certno={$i['courseName']}";
                    $output6=file_get_contents($url_api6.$time.$output["msg"]);
                             $counter = intval(file_get_contents("qdcounter.dat"));  
                             $_SESSION['#'] = true;  
                             $counter++;  
                             $fp = fopen("qdcounter.dat","w");  
                             fwrite($fp, $counter);  
                             fclose($fp); 
                        
                        }else{
                            echo"账号:".$row['userName']."的".$n['DateCreated'].$i["courseName"]."的签到已经签到!"."<br>";
                            
                        };
                    }else{
                        if($n["DataType"] == "签到"){
                        echo  "状态:".$output['code']."账号:".$row['userName']."的".$n['DateCreated'].$i["courseName"]."的签到已经签到!"."<br>";
                            
                        };
                    };
                };
            };
        };    
    }else{
        echo "状态:".$output['code']."账号:".$row['userName']."今日没有课唉 要好好休息哦"."<br>";

    };
        }else{
            echo $output['msg'];
            
        }
    };
    
    
    
    function curl_post($url,$headers,$data){
        $curl=curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        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, $data);
        
        $output = curl_exec($curl);
        
        curl_close($curl);
        $output=json_decode($output,true);
        return $output;
        //print_r($output);
} 

添加新评论

评论列表