getTeacherIdByName($printName); if($teachers){ $condition[] = "(e.teacher_id in(".implode(',',$teachers).") or e.name like '%{$printName}%')"; }else{ $condition[] = "e.name like '%{$printName}%'"; } } if ( empty($display)) { $condition[] = "e.is_display = 0"; }else { $condition[] = "e.is_display = ".$display; } // $condition[] = "e.subject_id = '{$this->subjectId}'"; $condition[] = "eg.is_third = 1"; $condition[] = "eg.xb_homework = 1"; if(in_array(Yii::app()->session['session_duoxueke_subject_id'],$this->mathSubjectId)){ $condition[] = "e.subject_id in (".implode(',',$this->mathSubjectId).")"; }else{ $condition[] = "e.subject_id = ".Yii::app()->session['session_duoxueke_subject_id']; } // 年级条件 if($grade>0) { $class_data = $this->schoolManager->getSchoolByGrade($grade,$this->semesterId); if($class_data) { foreach($class_data as $v) { $class_ids[$v['class_id']] = $v['class_id']; } $exam_class_data = $this->schoolManager->getClassIdByExam($class_ids); if($exam_class_data) { foreach($exam_class_data as $v) { $l_b_exam_ids[$v['exam_id']] = $v['exam_id']; } } unset($exam_class_data); } unset($class_data); } if(isset($l_b_exam_ids)) { if($l_b_exam_ids) { $condition[] = "e.exam_id in (".implode(',',$l_b_exam_ids).")"; }else { $condition[] = "e.exam_id in (0)"; } } $gradeCardLength=array(); $gradeData=SGrade::model()->findAll(); foreach ($gradeData as $datum){ if($datum->card_status==1){ $gradeCardLength[$datum->id]=$datum->card_length; }else{ $gradeCardLength[$datum->id]=0; } } $resultList = $this->schoolManager->getThirdPrintList($condition,array('e.create_time desc','e.exam_id desc')); $printList = array(); if($resultList["rs"]){ $ExamModel=new Exam(); $StudentPaperRelation=new SStudentPaperRelation(); foreach ($resultList['rs'] as $k=>$v) { $exam_group_ids[$v['exam_group_id']] = $v['exam_group_id']; $time = time(); $classinfo=ClassModel::model()->find('class_id=:class_id',array(':class_id'=>$v['class_id'])); $v['grade']=$classinfo['grade']; $printList[$k] = $v; $tplData = json_decode($v["tpl_data"], true); //考试时间 if(isset($tplData['examDate'])) { $examDate = strtotime($tplData["examDate"]); } if(!isset($tplData["examDate"])) { $examDate = $v["create_time"]; } $printList[$k]['examDate'] = $examDate; $onlineMultiplex=$this->schoolManager->getOnlineCardMultiplexByGroupId($v['exam_group_id']); if($onlineMultiplex && $onlineMultiplex['is_download']){ $printList[$k]['downloaded'] = 1; }else{ $printList[$k]['downloaded'] = 0; } } } $sheet_ids = array(); $exam_sheet_download=array(); $criteria = new CDbCriteria(); $criteria->addInCondition('exam_group_id',$exam_group_ids); $exam_sheet_data = SThirdAnswerSheet::model()->findAll($criteria); if($exam_sheet_data) { foreach($exam_sheet_data as $v) { $exam_sheets[$v->exam_group_id] = $v->online_card_pdf; if($v->online_card){ $onlineMultiplex=$this->schoolManager->getOnlineCardMultiplexByGroupId($v->exam_group_id); if($onlineMultiplex && $onlineMultiplex['is_download']){ $exam_sheet_download[$v->exam_group_id] = 1; } } } } $subject_exam_data=Yii::app()->params['subjectId']; $teachers_data = Teacher::model()->findAll(); $class_teacher_data = array(); if($teachers_data) { foreach($teachers_data as $k=>$v) { $class_teacher_data[$v->teacher_id] = $v->teacher_name; } } $data = array(); $data['is_qxk']=1; $data['printList'] = $printList; $data['pages'] = $resultList['pager']; $data['page_total'] = $resultList['pager']->rowsCount; $data["printType"] = $printType; $data["printName"] = $printName; $data["teachers"] = $class_teacher_data; $data["classId"] = $classId; $data["grade"] = $grade; $data["sheets"] = $sheets; $data["exam_sheets"] = $exam_sheets; $data["sheet_rs"] = $sheet_rs; $data["labelled"] = $labelled; $data["display"] = $display; $data["is_print"] = $is_print; $data["subject"] = $subject_exam_data; $data['list_type'] =$list_type; $data['showAssist'] =0; $data['extendSubject'] =$this->extendSubject; unset($resultList); $data['schoolId'] =$this->schoolId; if(Yii::app()->params['section']==0){ $this->render('index_section',$data); }else{ $this->render('index',$data); } } public function actionOprateexam() { $exam_group_id = Req::post("exam_group_id"); $flag = Req::post("flag"); $error['success'] = 0; if (empty($exam_group_id)) { $error['message'] = '操作失败!'; echo json_encode($error);exit(); } $this->setIs_new($exam_group_id); if ($this->schoolManager->ThirdOprateExamDisplay($exam_group_id,$flag)) { $error['success'] = 1; $error['message'] = '操作成功!'; } else { $error['message'] = '操作失败!'; } echo json_encode($error);exit(); } public function actionExam_list() { ini_set("memory_limit","300M"); $exam_group_id = Req::get("exam_group_id"); $branch = Req::get("branch"); $grade = Req::get("grade"); $exam_date = ''; //考试日期 $exam_name = ''; //考试名称 $exam_uploaded=0; if($exam_group_id>0) { if($exam_group_id <= 0) { Yii::app()->jump->error('未找到考试信息!'); } $exam_group_data = ExamGroup::model()->find('exam_group_id=:exam_group_id',array(':exam_group_id'=>$exam_group_id)); if(!$exam_group_data) { Yii::app()->jump->error('未找到考试信息!'); } if($exam_group_data->upload_status>0){ $exam_uploaded=1; } $classId = Req::get("classId"); $condition = array(); if($classId) $condition[] = "e.class_id = '{$classId}'"; $condition[] = "eg.exam_group_id = '{$exam_group_id}'"; $classes = $this->schoolManager->getSemesterClasses($this->semesterId); if(!$classes) { Yii::app()->jump->error('本学期尚未建班级!'); } $_classes = array(); foreach($classes as $v) { $_classes[$v['class_id']][$v['class_id']] = $v; } $resultList = $this->schoolManager->getExamList($condition,array('e.create_time desc','e.exam_id desc')); if($resultList && isset($resultList['rs'][0])){ $tplData=json_decode($resultList['rs'][0]['tpl_data'],true); }else{ Yii::app()->jump->error('未找到考试信息!'); } if(!$exam_date) $exam_date=$tplData['examDate']; if(!$exam_name) $exam_name=$resultList['rs'][0]['exam_name']; $data['exam_id']=$resultList['rs'][0]['exam_id']; if(isset($tplData['is_change_to_third']) && $tplData['is_change_to_third']==1){ $data['is_change_to_third'] = 1; }else{ $data['is_change_to_third'] = 0; } //获取paper 表数据 $paper_data = SPaper::model()->find('exam_id=:exam_id',array(':exam_id'=>$resultList['rs'][0]['exam_id'])); if(!$paper_data) { Yii::app()->jump->error('未找到考试信息!'); } //读取试题数据 $isAllSelect=1; //全部客观题判断 $paperTopic=SPaperTopicRelation::model()->findAll('paper_id=:paper_id',array(':paper_id'=>$paper_data->paper_id)); //选择题类型判断 $allSubjectType=array(); if($exam_group_data['qxk_paper_id']>0){ $allSubjectType=array(1,2,3,4,12); }else{ $allSubjectType=array(1,2,11); } if($paperTopic){ $data['answer_card_saved'] = 1; foreach ($paperTopic as $item){ if(!in_array($item->type,$allSubjectType)){ $isAllSelect=0; break; } } }else{ //未制作答题卡 $data['answer_card_saved'] = 0; } //读取试题推送设置 $topicPushSettingModel=new SExamPushTopicsSetting(); $topicPushSetting=$topicPushSettingModel->getTopicSetting($exam_group_id); $topicPushSettingRelation=array(); if($topicPushSetting){ foreach ($topicPushSetting as $item){ if($item['topic_ids']){ $topicSetting=json_decode($item['topic_ids'],true); if($topicSetting){ $topicPushSettingRelation[(string)$item['exam_id']]=1; } } } } // $subject_exam_data = $this->schoolManager->getxuekeStatus($this->semesterId); $this->setIs_new($exam_group_id); //查询还原记录 $examRestore=SExamRestore::model()->find('exam_group_id=:exam_group_id',array(':exam_group_id'=>$exam_group_id)); if($examRestore){ $data['restore'] = 1; }else{ $data['restore'] = 0; } //是否使用在线答题卡 $studentAnswerOnline=$this->schoolManager->getAnswerSheetOnline($exam_group_id); if($studentAnswerOnline){ $data['online_card']=$studentAnswerOnline['online_card']; $data['is_qrcode_online']=$studentAnswerOnline['is_qrcode_online']; }else{ $data['online_card']=0; $data['is_qrcode_online']=0; } $has_marked = false; $studentAnswerCardOnline=new SStudentAnswerCardOnline(); foreach ($resultList['rs'] as $key => $item){ if($item['status'] == 1){ $has_marked = true; } //查询生成数量 if($data['online_card']==1 && $data['is_qrcode_online']==1){ $studentCardOnline= $studentAnswerCardOnline->getCountByExamId($item['exam_id']); if($studentCardOnline){ $resultList['rs'][$key]['card_created']=$studentCardOnline['count']; } } } //是否能添加班级 FIXME add_class_0924 //打印中 $enable_add_class = false; if($exam_group_data['status'] == 1 || $exam_group_data['mark_type'] == 0){ $enable_add_class = true; }else{ //混合阅卷 if($exam_group_data['mark_type'] == 3){ $enable_add_class = ($exam_group_data['mark_status']==2 && $exam_group_data['upload_status']== 2) ? false : true; } //单独阅卷 if($exam_group_data['mark_type'] == 4){ $enable_add_class = $has_marked ? false : true; } } $data['pages'] = $resultList['pager']; $data['page_total'] = $resultList['pager']->rowsCount; if(isset($this->schoolInfo->use_zhixue) && !empty($this->schoolInfo->use_zhixue)) { $data["use_zhixue"] = $this->schoolInfo->use_zhixue; }else { $data["use_zhixue"] = 0; } $data['printList'] = $resultList['rs']; $data["classes"] = $_classes; $data["classId"] = $classId; $data["exam_group_id"] = $exam_group_id; $data["exam_group_data"] = $exam_group_data; // $data["subject"] = $subject_exam_data; $data["branch"] = $branch; $data["grade"] = $grade; $data["enable_add_class"] = $enable_add_class; $data['is_all_select']=$isAllSelect; $data["exam_name"] = $exam_name; $data['version_number']=$this->version_number; $data['exam_date']=$exam_date; $data['exam_uploaded']=$exam_uploaded; $data['topic_push_setting']=$topicPushSettingRelation; $this->render('exam_list',$data); } } public function actionChange(){ ini_set("memory_limit","300M"); Url::clean(); $sname = Req::get("sname"); $cid = Req::get("cid"); $eid = Req::get("eid"); $tid = Req::get("tid"); $isFeedback=0; switch($tid){ case "0": $printType = 'wp'; break; case "1": $printType = 'wb'; break; case "2": $printType = 'isp'; break; default: $printType = 'wp'; } $classInfo = ClassModel::model()->findByPk($cid); if (empty($classInfo)) { Yii::app()->jump->error('未找到班级!'); } $examInfo = Exam::model()->findByPk($eid); if (empty($examInfo)) { Yii::app()->jump->error('未找到周周练!'); } $getResult = ClassExamPrinter::model()->find('class_id=:cid and exam_id=:eid and type=0',array(':cid'=>$cid,':eid'=>$eid)); if (empty($getResult)) { Yii::app()->jump->error('未找到班级与试卷对应关系!'); } $paperInfo = SPaper::model()->find('exam_id=:eid',array(':eid'=>$eid)); if (empty($paperInfo)) { Yii::app()->jump->error('未找到试卷信息!'); } $paperData = $this->schoolManager->getPaperWithTopicsDetails_v2($paperInfo->paper_id); if(trim($paperInfo->answer_card_src)) $answerCardUploaded = true; else $answerCardUploaded = false; $tpl = 1;// 需要上传模板 $tplTwo= 1; if (!in_array($examInfo->tpl_index,Yii::app()->params['no_template_id']) ) { $paperType = 1; if (empty($paperInfo->tpl_doc_src)) { $tpl = 2; } $tplTwo= 2; }else{ $paperType = 2; } if(in_array($examInfo->tpl_index,Yii::app()->params['merge_topic_tpl'])) { $tpl = 1; $paperType = 1; $tplTwo= 2; } if(in_array($examInfo->tpl_index, Yii::app()->params['custom_tpls_ids'])){ $isCustomTpl = true; } else{ $isCustomTpl = false; } // 获取阅卷类型 $markType = 0; $groupInfo = $this->schoolManager->getExam($eid); if (!empty($groupInfo)) { $findInfo = SExamGroup::model()->find('exam_group_id=:eg_id',array('eg_id'=>$groupInfo['exam_group_id'])); if (!empty($findInfo)) { $markType = $findInfo->mark_type; if($findInfo->mark_type==0 && $findInfo->is_third==1){ $isUnderLine = 1; } } } $result = array(); $relateStudent = SStudentPaperRelation::model()->findAll('paper_id=:paid and class_id=:caid and is_del=:is_del',array(':paid'=>$paperInfo->paper_id,':caid'=>$cid,':is_del'=>0)); //if (empty($relateStudent)) { // Yii::app()->jump->error('未找该试卷关联的学生!'); //} else { //$studentModel = StudentInfo::model(); // 获取学生姓名 $_student_id = array(); foreach($relateStudent as $v) { $_student_id[$v->student_id] = $v->student_id; } //if(!$_student_id) //{ // Yii::app()->jump->error('未找该试卷关联的学生!'); //} $b_student_arr = Yii::app()->redis_business_student->hgetAll('redis_business_del_student:'.$this->schoolId); if(!$b_student_arr ){ $array_student = array(); $b_student_arr = array(); $criteria = new CDbCriteria(); $criteria->select = 'student_id'; $criteria->addCondition('school_id=:school_id'); $criteria->addCondition('status=:status'); $criteria->params[':school_id'] = $this->schoolId; $criteria->params[':status'] = 1; $b_student_data = BusinessStudent::model()->findAll($criteria); if($b_student_data){ foreach ($b_student_data as $k=>$v){ $array_student[$v->student_id] = $v->student_id; } } Yii::app()->redis_business_student->del('redis_business_del_student:'.$this->schoolId); if($array_student){ Yii::app()->redis_business_student->hmset('redis_business_del_student:'.$this->schoolId,$array_student); Yii::app()->redis_business_student->expire('redis_business_del_student:'.$this->schoolId,1296000); } unset($criteria); if($b_student_data) { foreach($b_student_data as $v) { $b_student_arr[$v->student_id] = $v->student_id; } } unset($b_student_data); unset($criteria); } $studentNames = array(); $criteria = new CDbCriteria(); $criteria->addInCondition('student_id',$_student_id); $studentArray = SStudentInfo::model()->findAll($criteria); if (!empty($studentArray)) { foreach ($studentArray as $student) { $studentNames[$student->student_id] = $student->realname; } } //查询是否上传答题图片 $uploadAnswerImgStudent=array(); $student_answer_img=$this->schoolManager->getUpAnswerStudent($paperInfo->paper_id,$_student_id,0); if($student_answer_img){ foreach ($student_answer_img as $val){ $uploadAnswerImgStudent[(string)$val['student_id']]=$val['student_id']; } } foreach ($relateStudent as $key=>$val) { //查询学生身份证号 $studentInfo=SStudentInfo::model()->find('student_id=:s_id',array('s_id'=>$val->student_id)); if($studentInfo){ $result[$key]['id_number'] = $studentInfo->id_number; }else{ $result[$key]['id_number'] = ''; } $result[$key]['student_card'] = $val['student_card']; $result[$key]['school_student_card'] = $val['school_student_card']; $result[$key]['upload_answer_img'] =0; if($val->is_feedback==1){ $isFeedback=1; if(isset($uploadAnswerImgStudent[(string)$val->student_id])){ $result[$key]['upload_answer_img'] =1; } } //查询在线答题卡是否生成 $rs=$this->sConn->createCommand("select answer_card_online_created from student_answer_card_online where exam_id='{$eid}' and student_id='{$val->student_id}' ")->queryRow(); if($rs && $rs['answer_card_online_created']==1){ $result[$key]['online_created'] = 1; }else{ $result[$key]['online_created'] = 0; } if (empty($sname)) { $result[$key]['clazzName'] = $classInfo->class_name; $result[$key]['paperName'] = $examInfo->name; $result[$key]['studentCode'] = $val->student_id; $result[$key]['studentName'] = isset($studentNames[$val->student_id]) ? $studentNames[$val->student_id] : null; $result[$key]['is_feedback'] = $val->is_feedback; $result[$key]['student_img_paper'] = $val->student_img_paper; $result[$key]['is_complete'] = $val->is_complete; } else { if ($sname == $studentNames[$val->student_id]) { $result[$key]['clazzName'] = $classInfo->class_name; $result[$key]['paperName'] = $examInfo->name; $result[$key]['studentCode'] = $val->student_id; $result[$key]['studentName'] = $studentNames[$val->student_id]; $result[$key]['is_feedback'] = $val->is_feedback; $result[$key]['student_img_paper'] = $val->student_img_paper; $result[$key]['is_complete'] = $val->is_complete; }else{ unset($result[$key]); } unset($relateStudent[$key]); } $printCheck = true; } //} $no_paper_student = array(); $paper_student_array = array(); $c_paper_student_array = array(); $class_student_info_data = array(); $_student_ids = array(); $_student_id_names = array(); $class_student_data = $this->schoolManager->getClassStudentByClassId($cid); //student_class_relation if($class_student_data) { foreach($class_student_data as $v) { $_student_ids[$v['student_id']] = $v['student_id']; } $criteria = new CDbCriteria(); $criteria->addInCondition('student_id',$_student_ids); $studentArray = SStudentInfo::model()->findAll($criteria); if (!empty($studentArray)) { foreach ($studentArray as $student) { $_student_id_names[$student->student_id] = $student->realname; } } } ///$class_student_info_data = $this->schoolManager->getClassStudentInfoByClassId($cid); //student_info $paper_student_data = $this->schoolManager->getClassPaperByClassAndPaper($cid,$paperInfo->paper_id,1);//已删除考试学生 $c_paper_student_data = $this->schoolManager->getClassPaperByClassAndPaper($cid,$paperInfo->paper_id);//考试学生 if ($paper_student_data) { foreach ($paper_student_data as $v) { $paper_student_array[$v['student_id']] = $v['student_id']; } $class_student_info_data = $this->schoolManager->getStudentByStudentIds($paper_student_array); //student_info } if ($c_paper_student_data) { foreach ($c_paper_student_data as $v) { $c_paper_student_array[$v['student_id']] = $v['student_id']; } //$class_student_info_data = $this->schoolManager->getStudentByStudentIds($paper_student_array); //student_info } if ($class_student_info_data) { foreach ($class_student_info_data as $v) { $class_student_info_array[$v['student_id']] = $v['realname']; } } if ($class_student_data) { foreach($class_student_data as $v) { if(!isset($b_student_arr[$v['student_id']])) { if ($paper_student_array) { if(isset($paper_student_array[$v['student_id']])){ $no_paper_student[$v['student_id']] = array( 'student_id' => $v['student_id'], 'realname' => isset($class_student_info_array[$v['student_id']]) ?$class_student_info_array[$v['student_id']]:'', ); } } if($c_paper_student_array ) { if(!isset($c_paper_student_array[$v['student_id']]) ) { $no_paper_student[$v['student_id']] = array( 'student_id' => $v['student_id'], 'realname' => isset($_student_id_names[$v['student_id']]) ?$_student_id_names[$v['student_id']]:'', ); } }else { $no_paper_student[$v['student_id']] = array( 'student_id' => $v['student_id'], 'realname' => isset($_student_id_names[$v['student_id']]) ?$_student_id_names[$v['student_id']]:'', ); } } } } //判断在线答题卡使用情况 $useAnswerCardOnlineQrcode=0; $answerCardOnline=$this->schoolManager->getAnswerSheetOnline($groupInfo['exam_group_id']); if($answerCardOnline && $answerCardOnline['online_card']==1 && $answerCardOnline['is_qrcode_online']==1){ $useAnswerCardOnlineQrcode=1; } $this->setIs_new($examInfo->exam_group_id); $data = array(); if(isset($isUnderLine)){ $data['under_line']=$isUnderLine; } //判断在线答题卡使用情况 $answerCardOnline=$this->schoolManager->getAnswerSheetOnline($groupInfo['exam_group_id']); if($answerCardOnline && $answerCardOnline['online_card']==1 && $answerCardOnline['is_qrcode_online']==1){ $data['use_answer_card_online_qrcode']=1; }else{ $data['use_answer_card_online_qrcode']=0; } $_num= ''; $use_version = ''; if(isset(Yii::app()->session['coachInfo']->use_version)) { $use_version = Yii::app()->session['coachInfo']->use_version; }else { $use_version = Yii::app()->session['coachInfo']['use_version']; } if(!$use_version) { $use_version = 100; } $version_number = implode('',explode('.',$use_version)); if(strlen($version_number)<7) { for($i=0;$i<7-strlen($version_number);$i++) { $_num.='0'; } } $version_number=(int)$version_number.$_num; $data['version_number']=$version_number; $data['no_paper_student'] = $no_paper_student; $data['result'] = $result; $data["printType"] = $printType; $data["sname"] = $sname; $data['paper_id'] = $paperInfo->paper_id; $data['exam_id'] = $eid; $data['class_id'] = $cid; $data['type_id'] = $tid; if(isset($this->schoolInfo->use_zhixue) && !empty($this->schoolInfo->use_zhixue)) { $data["use_zhixue"] = $this->schoolInfo->use_zhixue; }else { $data["use_zhixue"] = 0; } // $subject_exam_data = $this->schoolManager->getxuekeStatus($this->semesterId); // $data["subject"] = $subject_exam_data; $data['wp_type'] = $examInfo->tpl_index; $data['className'] = $classInfo->class_name; $data['paperName'] = $examInfo->name; $data['tpl'] = $tpl; $data['tplTwo'] = $tplTwo; $data['markType'] = $markType; $data['examInfo'] = $examInfo; $data['paperType'] = $paperType; $data['answerCardUploaded'] = $answerCardUploaded; $data['paperData'] = $paperData; $data['isCustomTpl'] = $isCustomTpl; $data['isFeedback'] = $isFeedback; $data['printCheck'] = $printCheck; $data['useAnswerCardOnlineQrcode'] = $useAnswerCardOnlineQrcode; $this->render('change',$data); } public function actionSet_new() { $exam_group_id = Req::post("exam_group_id"); if($exam_group_id>0) { $this->setIs_new($exam_group_id); } } // // 更新试卷在线答题卡打印状态、时间 public function actionUpdateOnlinePaperPrintTime() { $exam_group_id = Req::post("eid"); $thirdAnswerSheet=$this->sConn->createCommand("select multiplex_id from online_card_multiplex where exam_group_id='{$exam_group_id}' ")->queryRow(); if($thirdAnswerSheet){ $this->sConn->createCommand("update online_card_multiplex set is_download=1,update_time=".time()." where multiplex_id='{$thirdAnswerSheet['multiplex_id']}'")->execute(); } } public function UUID_SHORT($length = 20) { $query = $this->sConn->createCommand("SELECT UUID_SHORT() AS UUID_SHORT")->query()->read(); $result = $query['UUID_SHORT']; if ($length AND is_int($length)) { $result = substr($result, ($length * -1)); } return $result; } /* * 作业答题卡读取token * */ public function actionGetCardUrl(){ $homeworkId = Req::post("homeworkId"); if(YII_ENV=='production'){ $tokenUrl='https://tchr-cs.mgr.miaobikj.com/api/teacher/taskAssistant/token'; $cardUrl='http://xbzy.schcur.com/#/assistant/exam-builder?taskId='.$homeworkId.'&schoolId='.$this->schoolId; }else{ $tokenUrl='http://182.108.40.54:50100/curriculum-teacher-api-test/teacher/taskAssistant/token'; $cardUrl='http://xbzy.testing.xiaoben.com/#/assistant/exam-builder?taskId='.$homeworkId.'&schoolId='.$this->schoolId; } $return=array('status'=>0,'data'=>'','msg'=>''); $curl = @curl_init(); if ($curl) { curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); curl_setopt($curl, CURLOPT_TIMEOUT, 5); curl_setopt($curl, CURLOPT_URL, $tokenUrl); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, ''); curl_setopt($curl, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json' )); if(substr($tokenUrl,0,5)=='https'){ curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,false); } $response = curl_exec($curl); curl_close($curl); $result=json_decode($response,true); if(isset($result['code']) && $result['code']=='200'){ $return['status']=1; $cardUrl.="&token=".$result['data']; $return['data']=$cardUrl; }else{ if(isset($result['msg'])){ $return['msg']=$result['msg']; } } } exit(json_encode($return)); } }