职教云自动签到最新PHP接口版

<?php
/*
*------------------------------------------------------
* Title : 职教云自动签到PHP版 V3.1
*------------------------------------------------------
* Author : 青山 (qingshan@88.com)
*------------------------------------------------------ 
* Time : 2021-03-01
*------------------------------------------------------
* Tips : 更新签到API 本源码不得贩卖
*------------------------------------------------------
*/


header('content-type:text/html;charset=UTF-8');
date_default_timezone_set("PRC");


/*
**获取GET参数 让用户自定义签到频率 
*/

$wxkey=$_GET['wxkey'];//wx推送
$skey=$_GET['skey'];//qq推送
$userName=$_GET['userName'];//账号
$userPwd=$_GET['userPwd'];//密码

/*
**跟随更新协议头
*/
$emit=time()."000";
//echo date('Y-m-d H:i:s');
$equipmentModel="Xiaomi Redmi K20 Pro";
$equipmentApiVersion="11";
$equipmentAppVersion=getver();
$device=getDevice($equipmentModel,$equipmentApiVersion,$equipmentAppVersion,$emit);
//header        
$headers = array('Content-Type:'.'application/x-www-form-urlencoded','emit:'.$emit,'device:'.$device);      
//print_r($header);




/*
**自动签到部分
*/
    //login                
    $url="https://zjyapp.icve.com.cn/newMobileAPI/MobileLogin/newSignIn";
    $data=array("clientId"=>"d902c875d5f34c0f93362139f5af0c4c","sourceType"=>"2","userPwd"=>$userPwd,"userName"=>$userName,"appVersion"=>$equipmentAppVersion,"equipmentAppVersion"=>$equipmentAppVersion,"equipmentApiVersion"=>$equipmentApiVersion,"equipmentModel"=>$equipmentModel);
    //print_r($data);
    $output=httppost($url,$headers,$data);
    //print_r($output);


        if($output['code'] == "1"){
            $stuId = $output["userId"];
            $newtoken=$output['newToken'];
                $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=httppost($url2,$headers,$data);
        //print_r($output);
            $todayClassInfo=$output["dataList"];
        
//        
            $url3="https://zjyapp.icve.com.cn/newmobileapi/faceteach/newGetStuFaceActivityList";
            if(!empty($todayClassInfo)){
                        foreach($todayClassInfo as $i){
                                $data=array("activityId"=>$i['Id'],"stuId"=>$stuId,"classState"=>$i['state'],"openClassId"=>$i['openClassId'],"newToken"=>$newtoken);
        
                    $output=httppost($url3,$headers,$data);
                    //print_r($output);                
                    $inClassInfo=$output["dataList"];

//
                $url4="https://zjyapp.icve.com.cn/newmobileapi/faceteach/isJoinActivities";
                        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","newToken"=>$newtoken);
                                    $output=httppost($url4,$headers,$attendData);
                                //print_r($output);
                                    $attendInfo=$output;
        
        
                $url5="https://zjyapp.icve.com.cn/newmobileapi/faceTeach/saveStuSignNew";
                            if($attendInfo["isAttend"] != "1"){
                                $signInData = array("signId"=>$n['Id'],"stuId"=>$stuId,"openClassId"=>$i['openClassId'],"sourceType"=>"3","checkInCode"=>$n['Gesture'],"activityId"=>$i['Id'],"newToken"=>$newtoken);
                                        $output=httppost($url5,$headers,$signInData);
                                        //print_r($output);
                                        $time=date("Y-m-d H:i:s");
                                        echo '{"code":"200","msg":"sign success"}';
                                        
                                        if($output['code'] != '1'){
                                       echo '{"code":"200","msg":"sign end"}';
                                    }else{
                                        //coolpush
                                                $url6="https://push.xuthus.cc/send/{$skey}?c=账号:{$userName}的{$i['courseName']}签到成功/n**网课联系QQ:1808027167";
                                    $output=file_get_contents($url6);
                                             if(isset($wxkey)){
                                                 //server 酱
                                                 $url7="https://sc.ftqq.com/{$wxkey}.send";
                                                 $data = array("text"=>"职教云签到结果","desp"=>"
##{$i['courseName']}签到成功
   
##获取答案:sign.imz.xyz

##网课联系wx:Not-Missing 

##赞助二维码:
![hqyx2 icon](https://s2.ax1x.com/2020/02/12/1bfYS1.jpg)
![hqyx2 icon](https://s2.ax1x.com/2020/02/12/1H4uTg.jpg)");
                                            $output=httppost($url7,$headers,$data);
                                                };
                                                
                                            };
                                }else{
                                                echo '{"code":"200","msg":"already sign"}';
                                                        
                                        };
                            }else{
                                        if($n["DataType"] == "签到"){
                                            echo '{"code":"200","msg":"already sign"}';
                                                    
                                          };
                                };
                                    };
                            };
                    };        
            }else{
                    echo '{"code":"200","msg":"no lessons"}';
            };
        
        
    }else{
        echo '{"code":"200","msg":"{$output["msg"]}"}';
            
    }
        
        
        
/*
**核心函数 请勿更改
*/

function httppost($url,$headers,$data){
                $curl=curl_init();
                curl_setopt($curl, CURLOPT_URL, $url);
                curl_setopt($curl, CURLOPT_HEADER, 0); 
        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,http_build_query($data));
                
        $output = curl_exec($curl);
                
        curl_close($curl);
                $output=json_decode($output,true);
        return $output;
                //print_r($output);
} 

function curl_get($url,$headers,$data,$cookie){
                $curl=curl_init();
                curl_setopt($curl, CURLOPT_URL, $url);
                curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
        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_COOKIE,$cookie);
                //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);
}

function curl_post($url,$headers,$data,$cookie){
                $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_COOKIE,$cookie);
                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);
}






function post_curl($url, $params=[], $headers=[]){   
    $httpInfo = array();   
    $ch = curl_init();      
    curl_setopt($ch, CURLOPT_HEADER, 1);   
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
    curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT , 30 );   
    curl_setopt( $ch, CURLOPT_TIMEOUT , 30);   
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER , true );      
    curl_setopt( $ch , CURLOPT_POST , true );   
    curl_setopt( $ch , CURLOPT_POSTFIELDS , http_build_query($params));   
    curl_setopt( $ch , CURLOPT_URL , $url );        
    $response = curl_exec( $ch );   
    if ($response === FALSE) {      
        return false;   
        
    }        
    curl_close( $ch );    
    return $response;
    
}
//
function object_array($array) {  
    if(is_object($array)) {  
        $array = (array)$array;  
     } if(is_array($array)) {  
         foreach($array as $key=>$value) {  
             $array[$key] = object_array($value);  
             }  
     }  
     return $array;  
}

function getDevice($model,$vsersionAndroid,$versionName,$timeStamp){
    $tmp=md5($model);
    //echo $tmp."<br>";
    $tmp1=$tmp.$vsersionAndroid;
    //echo $tmp."<br>";
    $tmp=md5($tmp1);
    //echo $tmp."<br>";
    $tmp1=$tmp.$versionName;
    //echo $tmp."<br>";
    $tmp=md5($tmp1);
    //echo $tmp."<br>";
    $tmp1=$tmp.$timeStamp;
    //echo $tmp."<br>";
    return md5($tmp1);
}

function getver(){
    $url="https://zjy2.icve.com.cn/portal/AppVersion/getLatestVersionInfo";
    $output = file_get_contents($url);
    $version = json_decode($output,true)['appVersionInfo']['VersionCode'];
    return $version;
}

代码介绍

这是青山写的php版职教云自动签到API

支持server酱 coolpush推送通知

© 版权声明
THE END
喜欢就支持一下吧
点赞0
分享
评论 抢沙发

请登录后发表评论