CyletController.php 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243
  1. <?php
  2. /**
  3. * Created by 上海互教教育科技有限公司.
  4. * User: li
  5. * Date: 2018/5/16 0016
  6. * Time: 下午 15:29
  7. */
  8. class CyletController extends Controller
  9. {
  10. /*统考列表*/
  11. public function actionIndex(){
  12. Url::clean();
  13. $printType = Req::get("type");
  14. $Grade=intval(Req::get('grade'));
  15. $Class=Req::get('classId');
  16. $Page=intval(Req::get('page'));
  17. $Display=intval(Req::get('display'));
  18. $arts_science=intval(Req::get('arts_science'));
  19. $cylet_type=intval(Req::get('cylet_type'));
  20. $coach_id = $this->coachId;
  21. $semester_id = $this->semesterId;
  22. $PageLimit=9;
  23. if(!$Page) $Page=1;
  24. $CyletModel=new Cylet();
  25. $result=$CyletModel->getList($Grade,$Class,$semester_id,$Page,$PageLimit,$Display,$arts_science,$cylet_type);
  26. if($result['data']){
  27. $ExamModel=new SExam();
  28. foreach($result['data'] as $key=>$val){
  29. $SubjectArr=array();
  30. $SubjectName=array();
  31. $val['subject_ids'] && $SubjectArr=explode(',',$val['subject_ids']);
  32. $classArr=explode(',',$val['class_ids']);
  33. $result['data'][$key]['classCount']=count($classArr);
  34. $result['data'][$key]['classComplete']=0;
  35. foreach ($SubjectArr as $v){
  36. if(isset(Yii::app()->params['subjectId'][$v])){
  37. $SubjectName[]=Yii::app()->params['subjectId'][$v];
  38. }
  39. }
  40. $result['data'][$key]['SubjectName']=array_unique($SubjectName);
  41. $result['data'][$key]['SubjectCount']=count(array_unique($SubjectName));
  42. //判断成绩生成情况
  43. $Complete=0;
  44. $downloadBtn=0; //是否可以下载
  45. if($val['examinfo']){
  46. $ExamInfo=json_decode($val['examinfo'],true);
  47. $ClassListInfo=$this->ExamClassList($ExamInfo,$classArr);
  48. $ClassTemp=array();
  49. foreach ($ClassListInfo as $subject=>$v){
  50. foreach ($v as $cid=>$value){
  51. if(!isset($ClassTemp[$cid])){
  52. $ClassTemp[$cid]=$value['isComplete'];
  53. }else{
  54. $ClassTemp[$cid]+=$value['isComplete'];
  55. }
  56. if($value['isComplete']) $downloadBtn=1;
  57. }
  58. }
  59. foreach ($ClassTemp as $cid=>$item){
  60. if($item==count($SubjectArr)){
  61. $Complete++;
  62. }
  63. }
  64. }
  65. $result['data'][$key]['classComplete']=$Complete;
  66. $result['data'][$key]['downloadBtn']=$downloadBtn;
  67. }
  68. }
  69. $viewData=array(
  70. 'pageTotal' =>$result['pageTotal'],
  71. 'dataList' =>$result['data'],
  72. 'page' =>$Page,
  73. 'grade' =>$Grade,
  74. 'class' =>$Class,
  75. 'printType' =>$printType,
  76. 'display' =>$Display,
  77. 'arts_science' =>$arts_science,
  78. 'cylet_type' =>$cylet_type,
  79. 'totalCount' =>$result['totalCount'],
  80. );
  81. $HeadInfo=$this->getHeadInfo();
  82. $viewData=array_merge($viewData,$HeadInfo);
  83. $this->render('index',$viewData);
  84. }
  85. /*班级完成情况*/
  86. public function actionGetClassInfo(){
  87. $Cylet_id=intval(Req::post('cid'));
  88. $return=array(
  89. 'status'=>0
  90. );
  91. if(!$Cylet_id){
  92. exit(json_encode($return));
  93. }
  94. $CyletModel=new Cylet();
  95. $EaxmModel=new SExam();
  96. $CyletInfo=$CyletModel->findById($Cylet_id);
  97. if(!$CyletInfo){
  98. $return['msg']='统考ID不正确';
  99. exit(json_encode($return));
  100. }
  101. if(!$CyletInfo['examinfo']){
  102. exit(json_encode($return));
  103. }
  104. $ExamInfo=json_decode($CyletInfo['examinfo'],true);
  105. $classArr=explode(',',$CyletInfo['class_ids']);
  106. $SubjectCount=count(explode(',',$CyletInfo['subject_ids']));
  107. $another_Class_Name=array();
  108. $Select_Class_Name=array();
  109. $result=$this->ExamClassList($ExamInfo,$classArr);
  110. $Class=array();
  111. foreach ($result as $subject=>$val){
  112. foreach ($val as $cid=>$value){
  113. if(!isset($Class[$cid])){
  114. $Class[$cid]=$value['isComplete'];
  115. }else{
  116. $Class[$cid]+=$value['isComplete'];
  117. }
  118. }
  119. }
  120. foreach ($Class as $cid=> $item){
  121. $ClassName=ClassModel::model()->getClassName($cid);
  122. if($item<$SubjectCount){
  123. $another_Class_Name[]=$ClassName;
  124. }else{
  125. $Select_Class_Name[]=$ClassName;
  126. }
  127. }
  128. if($another_Class_Name){
  129. $another_Class_Name=array_unique($another_Class_Name);
  130. foreach ($another_Class_Name as $key=>$val){
  131. $another_Class_Name[$key]='<span class="c-red">'.$val.'</span>';
  132. }
  133. }
  134. if($Select_Class_Name){
  135. $Select_Class_Name=array_unique($Select_Class_Name);
  136. foreach ($Select_Class_Name as $key=>$val){
  137. $Select_Class_Name[$key]='<span class="c-red">'.$val.'</span>';
  138. }
  139. }
  140. $html=' <i class="icon icon-close"></i><div class="class-modal-head">'.$CyletInfo['title'].'</div>';
  141. $html.='<div class="class-modal-body">';
  142. foreach ($result as $subject=>$class){
  143. $html.='<div class="classes">';
  144. $html.='<label for="" class="subject-name">';
  145. if(isset(Yii::app()->params['subjectId']) && Yii::app()->params['subjectId']){
  146. $html.=Yii::app()->params['subjectId'][$subject];
  147. }
  148. $html.='</label>';
  149. $html.='<div>';
  150. foreach ($class as $val){
  151. if($val['isComplete']==1){
  152. $html.='<a href="#" >'.$val['className'].'</a>';
  153. }else{
  154. $html.='<a href="#" class="active">'.$val['className'].'</a>';
  155. }
  156. }
  157. $html.='</div>';
  158. $html.='</div>';
  159. }
  160. $html.='</div>';
  161. $html.='</div>';
  162. $html.='<p class="c-gray" style="font-size: 14px">';
  163. if($Select_Class_Name){
  164. $html.='<span class="c-red">*</span>此次参加统考分析的班级有 ';
  165. $html.=implode(',',$Select_Class_Name).'已生成报告。';
  166. }
  167. if($another_Class_Name){
  168. $html.=implode(',',$another_Class_Name).'部分科目未出成绩无报告';
  169. }
  170. $html.='</p>';
  171. $return['status']=1;
  172. $return['html']=$html;
  173. exit(json_encode($return));
  174. }
  175. /*编辑统考信息*/
  176. public function actionEdit(){
  177. $Cylet_id=Req::get('cid');
  178. $viewData=array();
  179. if($Cylet_id){
  180. $CyletModel=new Cylet();
  181. $CyletInfo=$CyletModel->findById($Cylet_id);
  182. if(!$CyletInfo){
  183. exit('统考ID不正确');
  184. }
  185. if($CyletInfo['examinfo']){
  186. $CyletInfo['examinfo']=json_decode($CyletInfo['examinfo'],true);
  187. }
  188. if(isset($CyletInfo['teacher_view_limit']) && $CyletInfo['teacher_view_limit']){
  189. $CyletInfo['teacher_view_limit']=explode(',',$CyletInfo['teacher_view_limit']);
  190. }else{
  191. $CyletInfo['teacher_view_limit']=array(1,2,3,4,5);
  192. }
  193. $viewData['formInfo']=$CyletInfo;
  194. }
  195. if(isset(Yii::app()->params['subjectId']) && Yii::app()->params['subjectId']){
  196. $viewData['subject']=Yii::app()->params['subjectId'];
  197. unset($viewData['subject'][3]);
  198. unset($viewData['subject'][51]);
  199. if(isset($viewData['subject'][20])) unset($viewData['subject'][20]);
  200. }
  201. //读取年级分科
  202. $grade = SGrade::model()->findAll(array('order'=>'id asc'));
  203. foreach ($grade as $value){
  204. $viewData['grade'][$value['id']]=$value['arts_science'];
  205. }
  206. $HeadInfo=$this->getHeadInfo();
  207. $viewData=array_merge($viewData,$HeadInfo);
  208. $this->render('edit',$viewData);
  209. }
  210. /*保存统考信息*/
  211. public function actionSave(){
  212. $Title=Req::post('title');
  213. $Grade=Req::post('grade');
  214. $Subject_ids=Req::post('subject_ids');
  215. $Class_ids=Req::post('class_ids');
  216. $Exam_json=htmlspecialchars_decode(Req::post('exam_ids')); //这个字段存的是考试的eaxm_id生成的json
  217. $Cylet_id=Req::post('cylet_id');
  218. $create_time=Req::post('examDate');
  219. $cylet_type=Req::post('cylet_type');
  220. $arts_science=Req::post('arts_science');
  221. $push_status=Req::post('push_status');
  222. $exam_mode=Req::post('exam_mode');
  223. $teacher_view_limit=Req::post('teacher_view_limit');
  224. if(!$arts_science){
  225. $arts_science=0;
  226. }
  227. if(replaceSpecialChar($Title)){
  228. Yii::app()->jump->error('考试名称不能包含特殊字符!');
  229. }
  230. //读取年级分科
  231. $gradeAll = SGrade::model()->findAll(array('order'=>'id asc'));
  232. $CyletModel=new Cylet();
  233. $examIds=array();
  234. $examInfoArr=json_decode($Exam_json,true);
  235. if(isset($examInfoArr['exam'])){
  236. foreach ($examInfoArr['exam'] as $value){
  237. $examIds[]=$value;
  238. }
  239. }
  240. if(isset($examInfoArr['same_exam'])){
  241. foreach ($examInfoArr['same_exam'] as $value){
  242. if(is_array($value)){
  243. $examIds=array_merge($examIds,$value);
  244. }
  245. }
  246. }
  247. $Data=array(
  248. 'title'=>$Title,
  249. 'semester_id'=>$this->semesterId,
  250. 'subject_ids'=>$Subject_ids,
  251. 'class_ids'=>$Class_ids,
  252. 'examinfo'=>$Exam_json,
  253. 'exam_ids'=>implode(",",$examIds),
  254. 'grade'=>$Grade,
  255. 'create_time'=>strtotime($create_time),
  256. 'cylet_type'=>$cylet_type,
  257. 'push_status'=>$push_status,
  258. 'exam_mode'=>$exam_mode,
  259. 'teacher_view_limit'=>implode(',',$teacher_view_limit)
  260. );
  261. $Data['arts_science']=0;
  262. foreach ($gradeAll as $value){
  263. if($value['id']==$Grade && $value['arts_science']==2){
  264. $Data['arts_science']=$arts_science;
  265. }
  266. }
  267. $Data['save_time'] = time();
  268. if($Cylet_id){
  269. $CyletInfo=$CyletModel->findById($Cylet_id);
  270. if(!$CyletInfo['push_status'] && $push_status==1){
  271. $arr=array(
  272. 'schoolId' => $this->schoolId,
  273. 'cyletId' =>$Cylet_id
  274. );
  275. $send_json=$arr;
  276. sendDataToKafka('zsyte-academic-cylet-achievement-notify',$send_json);
  277. unset($stompconn);
  278. }
  279. $Condition=array('cylet_id'=>$Cylet_id);
  280. $CyletModel->updateByCondition($Data,$Condition);
  281. }else{
  282. $cyletId=$CyletModel->InsertByData($Data);
  283. //发送app推送通知
  284. //学生消息
  285. $studentReceiverList=array();
  286. $studentIds=$this->schoolManager->getCyletStudentByExamIds($examIds,explode(",",$Class_ids));
  287. foreach ($studentIds as $val){
  288. $studentReceiverList[]=$val;
  289. }
  290. if(count($studentReceiverList)>100){
  291. $chunk_result = array_chunk($studentReceiverList, 50);
  292. foreach ($chunk_result as $value){
  293. $studentNotice[]=array(
  294. 'app'=>0,
  295. 'extraData'=>array(
  296. 'semesterId'=>$this->semesterId,
  297. 'cyletId'=>$cyletId
  298. ),
  299. 'templateId'=>5,
  300. 'templateParams'=>array($Title),
  301. 'userIds'=>$value
  302. );
  303. }
  304. }else{
  305. $studentNotice[]=array(
  306. 'app'=>0,
  307. 'extraData'=>array(
  308. 'semesterId'=>$this->semesterId,
  309. 'cyletId'=>$cyletId
  310. ),
  311. 'templateId'=>5,
  312. 'templateParams'=>array($Title),
  313. 'userIds'=>$studentReceiverList
  314. );
  315. }
  316. $receiverList=array();
  317. $teachers=$this->schoolManager->getTeachersByClassesIds(explode(",",$Class_ids));
  318. foreach ($teachers as $val){
  319. if(!isset($receiverList[(string)$val['teacher_id']])){
  320. $receiverList[(string)$val['teacher_id']]=$val['teacher_id'];
  321. }
  322. }
  323. $receiverList=array_values($receiverList);
  324. $teacherNotice=array(
  325. 'app'=>1,
  326. 'extraData'=>array(
  327. 'semesterId'=>$this->semesterId,
  328. 'cyletId'=>$cyletId
  329. ),
  330. 'templateId'=>6,
  331. 'templateParams'=>array($Title),
  332. 'userIds'=>$receiverList
  333. );
  334. foreach ($studentNotice as $msg){
  335. sendAppNotify($msg);
  336. }
  337. sendAppNotify($teacherNotice);
  338. }
  339. if(Yii::app()->params['handle_log_on_off'])
  340. {
  341. writeFileLog(jsonEncode(array(
  342. "cylet" => $Cylet_id,
  343. "operate_project" => 'zsyas2',
  344. "school_id" => $this->schoolId,
  345. "title" => '保存统考',
  346. "operate_account" => Yii::app()->session['coachInfo']['coach_name'],
  347. "operate_method" => $this->action,
  348. "operate_url" => $this->getRoute(),
  349. "operate_param" =>json_encode(array('post'=>$_POST,'get'=>$_GET)),
  350. "date"=>date('Y-m-d H:i:s')
  351. )));
  352. }
  353. $this->redirect('/index.php/cylet/index');
  354. }
  355. /*根据科目读取考试列表*/
  356. public function actionGetExamBySubject(){
  357. $Subject_id = Req::post("subject_id");
  358. $Grade = Req::post("grade");
  359. $Cylet_id = Req::post("cylet_id");
  360. $Arts_s = Req::post("arts_s");
  361. $SemesterId = Yii::app()->session['session_semester_id'];
  362. $SExamModel = new SExam();
  363. if($Grade){
  364. $Grade=explode(',',$Grade);
  365. }
  366. if($Cylet_id){
  367. $CyletModel=new Cylet();
  368. $CyletInfo=$CyletModel->findById($Cylet_id);
  369. $ExamInfo=json_decode($CyletInfo['examinfo'],true);
  370. }
  371. $result=array(
  372. 'status'=>1
  373. );
  374. if($Subject_id == 12){
  375. $is_all_quan = 0;
  376. }else{
  377. $is_all_quan = 0;
  378. }
  379. if(isset($ExamInfo['exam'][$Subject_id]) && $ExamInfo['exam'][$Subject_id]){
  380. if($Subject_id==6){
  381. $Data=$SExamModel->getExamBySubject_Semester_nogroup($this->mathSubjectId,$SemesterId,$Grade,$Arts_s,$is_all_quan);
  382. }else{
  383. $Data=$SExamModel->getExamBySubject_Semester_nogroup($Subject_id,$SemesterId,$Grade,$Arts_s,$is_all_quan);
  384. }
  385. $Exam=array();
  386. $SelectExam=array();
  387. if($Data){
  388. foreach ($Data as $val){
  389. if(strcmp($val['exam_id'], $ExamInfo['exam'][$Subject_id])==0){
  390. $SelectExam=$val;
  391. }
  392. $Exam[$val['exam_group_id']]=$val;
  393. }
  394. if($SelectExam){
  395. $Exam[$SelectExam['exam_group_id']]=$SelectExam;
  396. }
  397. }
  398. $Exam=array_values($Exam);
  399. }else{
  400. if($Subject_id==6){
  401. $Exam=$SExamModel->getExamBySubject_Semester($this->mathSubjectId,$SemesterId,$Grade,$Arts_s,$is_all_quan);
  402. }else{
  403. $Exam=$SExamModel->getExamBySubject_Semester($Subject_id,$SemesterId,$Grade,$Arts_s,$is_all_quan);
  404. }
  405. }
  406. $result['data']=$Exam;
  407. $result['subject_name']=Yii::app()->params['subjectId'][$Subject_id];
  408. exit(json_encode($result));
  409. }
  410. /*根据考试读取班级列表*/
  411. public function actionGetClassByExam(){
  412. $exam_id = Req::post("examId");
  413. $grade = Req::post("grade");
  414. $arts_science = intval(Req::post("arts_science"));
  415. $semesterId = Yii::app()->session['session_semester_id'];
  416. $result = array('status'=>0);
  417. $ExamModel = new SExam();
  418. $ExamGroupModel = new SExamGroup();
  419. $ClassArr=array();
  420. //读取examGroupid
  421. $ExamInfo=$ExamModel->getDetailByExamId($exam_id);
  422. if(!$ExamInfo){
  423. $result['msg']="考试id不正确";
  424. exit(json_encode($result));
  425. }
  426. $isAll=0;
  427. //加载所有班级
  428. if($arts_science){
  429. $classList = SClass::model()->findAll("semester_id=:semester_id and grade=:grade and arts_science=:arts_science ",array(':semester_id'=>$semesterId,':arts_science'=>$arts_science,':grade'=>$grade));
  430. }else{
  431. $classList = SClass::model()->findAll("semester_id=:semester_id and grade=:grade ",array(':semester_id'=>$semesterId,':grade'=>$grade));
  432. }
  433. $ExamGroupId=$ExamInfo['exam_group_id'];
  434. $TotalClass=$ExamModel->getClassByExamGroupId($ExamGroupId,$arts_science);
  435. if($TotalClass){
  436. foreach($TotalClass as $val){
  437. $ClassArr[]=$val['class_id'];
  438. }
  439. }
  440. if($ClassArr){
  441. $ClassArr=ClassModel::model()->getClassArrayByIds($ClassArr);
  442. }
  443. if(count($ClassArr)==count($classList)){
  444. $isAll=1;
  445. }
  446. $tplData=json_decode($ExamInfo['tpl_data'],true);
  447. $return=array(
  448. 'status'=>1,
  449. 'class'=>$ClassArr,
  450. 'create_time'=>$tplData['examDate'],
  451. 'is_all'=>$isAll
  452. );
  453. exit(json_encode($return));
  454. }
  455. /*非数学学科查找相似考试
  456. *匹配规则 :考试日期匹配最近5天,题型,试题分数
  457. * 班级不能重复
  458. */
  459. private function findSamePaperForMostSubject($Exam){
  460. $ExamModel = new SExam();
  461. $SemesterId = Yii::app()->session['session_semester_id'];
  462. $resultExam=array();
  463. if(!$Exam){
  464. return null;
  465. }
  466. $ExamInfo=$Exam;
  467. if(!$ExamInfo){
  468. return null;
  469. }
  470. $nowExamGroupId=$ExamInfo['exam_group_id'];
  471. $ClassInfo=ClassModel::model()->findByPk($ExamInfo['class_id']);
  472. $Grade=$ClassInfo['grade'];
  473. //被匹配的考试所有参加的班级
  474. $ClassArr=array();
  475. $TotalClass=$ExamModel->getClassByExamGroupId($nowExamGroupId);
  476. if($TotalClass){
  477. foreach($TotalClass as $val){
  478. $ClassArr[]=$val['class_id'];
  479. }
  480. }
  481. //读取试卷规则
  482. $rules=$this->getRules($ExamInfo['tpl_data']);
  483. //读取对应科目5天内考试完成试卷
  484. $StartTime=$ExamInfo['create_time']-86400*5;
  485. $allExam=$ExamModel->getExamBySubjectTime($ExamInfo['subject_id'],$SemesterId,$nowExamGroupId,$StartTime,$Grade);
  486. if($allExam){
  487. foreach($allExam as $value){
  488. if(!$value){
  489. continue;
  490. }
  491. $examRule=$this->getRules($value['tpl_data']);
  492. if(!$this->checkRule($examRule,$rules)){
  493. continue;
  494. }
  495. $TempClassArr=array();
  496. //检测班级是否重复
  497. $TempExamClass=$ExamModel->getClassByExamGroupId($value['exam_group_id']);
  498. if($TempExamClass){
  499. foreach($TempExamClass as $val){
  500. $TempClassArr[]=$val['class_id'];
  501. }
  502. }
  503. if(!$TempClassArr || array_intersect($TempClassArr,$ClassArr)){
  504. continue;
  505. }
  506. $resultExam[]=$value;
  507. }
  508. }
  509. return $resultExam;
  510. }
  511. private function getRules($jsonStr){
  512. $rules=array();
  513. $tpl_data=json_decode($jsonStr,true);
  514. if(isset($tpl_data['new_items'])){
  515. foreach($tpl_data['new_items'] as $key=>$val){
  516. $rules[$val['topic_type']][]=$val['score'];
  517. }
  518. }elseif(isset($tpl_data['items'])){
  519. foreach($tpl_data['items'] as $key=>$val){
  520. $rules[$key]=$val['perScores'];
  521. }
  522. }
  523. return $rules;
  524. }
  525. //对比两个试卷规则
  526. private function checkRule($rule1,$rule2){
  527. //题型
  528. if(count($rule1)!=count($rule2)){
  529. return false;
  530. }
  531. foreach($rule1 as $topic_type=>$val){
  532. if(count($val)!=count($rule2[$topic_type])){
  533. return false;
  534. }
  535. if(array_sum($val)!=array_sum($rule2[$topic_type])){
  536. return false;
  537. }
  538. }
  539. return true;
  540. }
  541. //处理统考班级考试完成情况
  542. private function ExamClassList($ExamInfo,$classArr){
  543. $EaxmModel=new SExam();
  544. $result=array();
  545. foreach($ExamInfo['exam'] as $subject =>$exam){
  546. if(!isset($ExamInfo['same_exam'][$subject]) || empty($ExamInfo['same_exam'][$subject])){
  547. $TempExamInfo=$EaxmModel->getDetailByExamId($exam);
  548. foreach($classArr as $cid){
  549. $ExamClass=$EaxmModel->getForExamGroupId_ClassId($TempExamInfo['exam_group_id'],$cid);
  550. if($ExamClass){
  551. if($ExamClass['status']==1){
  552. $result[$subject][$cid]=array(
  553. 'className'=>$ExamClass['class_name'],
  554. 'isComplete'=>1,
  555. 'exam_id'=>$ExamClass['exam_id']
  556. );
  557. }else{
  558. $result[$subject][$cid]=array(
  559. 'className'=>$ExamClass['class_name'],
  560. 'isComplete'=>0,
  561. 'exam_id'=>$ExamClass['exam_id']
  562. );
  563. }
  564. }
  565. }
  566. }else{
  567. //有匹配试卷
  568. $tempClassArr=$classArr;
  569. $TempExamInfo=$EaxmModel->getDetailByExamId($exam);
  570. $ThisAllExam=$EaxmModel->getExamByGroupId($TempExamInfo['exam_group_id']);
  571. if($ThisAllExam){
  572. foreach ($ThisAllExam as $val){
  573. if(in_array((string)$val['class_id'],$tempClassArr,true) && $val['status']!=1){
  574. $Class_Name_Temp=ClassModel::model()->getClassName($val['class_id']);
  575. $result[$subject][$val['class_id']]=array(
  576. 'className'=>$Class_Name_Temp,
  577. 'isComplete'=>0,
  578. 'exam_id'=>$val['exam_id']
  579. );
  580. unset($tempClassArr[array_search((string)$val['class_id'],$tempClassArr,true)]);
  581. break;
  582. }
  583. }
  584. }
  585. //查询匹配考试班级完成情况
  586. foreach($ExamInfo['same_exam'][$subject] as $value){
  587. if(!$tempClassArr){
  588. break;
  589. }
  590. $TempExamInfo=$EaxmModel->getDetailByExamId($value);
  591. $ThisAllExam=$EaxmModel->getExamByGroupId($TempExamInfo['exam_group_id']);
  592. if($ThisAllExam){
  593. foreach ($ThisAllExam as $val){
  594. if(in_array((string)$val['class_id'],$classArr,true) && $val['status']!=1){
  595. $Class_Name_Temp=ClassModel::model()->getClassName($val['class_id']);
  596. $result[$subject][$val['class_id']]=array(
  597. 'className'=>$Class_Name_Temp,
  598. 'isComplete'=>0,
  599. 'exam_id'=>$value
  600. );
  601. unset($tempClassArr[array_search((string)$val['class_id'],$tempClassArr,true)]);
  602. break;
  603. }
  604. }
  605. }
  606. }
  607. if($tempClassArr){
  608. foreach ($tempClassArr as $cid){
  609. $ClassName=ClassModel::model()->getClassName($cid);
  610. $result[$subject][$cid]=array(
  611. 'className'=>$ClassName,
  612. 'isComplete'=>1
  613. );
  614. }
  615. }
  616. }
  617. }
  618. return $result;
  619. }
  620. /*匹配试卷*/
  621. public function actionFindSamePaper(){
  622. $exam_id = Req::post("examId");
  623. $ExamModel = new SExam();
  624. $SemesterId = Yii::app()->session['session_semester_id'];
  625. $result=array(
  626. 'status'=>0
  627. );
  628. $SameExam=array();
  629. $SameExamId=array();
  630. $ExamInfo=$ExamModel->getDetailByExamId($exam_id);
  631. if(!$ExamInfo){
  632. exit(json_encode($result));
  633. }
  634. $Exam_Subject=$ExamInfo['subject_id'];
  635. if(in_array($Exam_Subject,$this->mathSubjectId)){
  636. $ClassInfo=ClassModel::model()->findByPk($ExamInfo['class_id']);
  637. $Grade=$ClassInfo['grade'];
  638. //数学
  639. $nowExamGroupId=$ExamInfo['exam_group_id'];
  640. $PaperInfo=SPaper::model()->getPapersByExamId($exam_id);
  641. if(!$PaperInfo){
  642. exit(json_encode($result));
  643. }
  644. //参加的班级
  645. $ClassArr=array();
  646. $TotalClass=$ExamModel->getClassByExamGroupId($nowExamGroupId);
  647. if($TotalClass){
  648. foreach($TotalClass as $val){
  649. $ClassArr[]=$val['class_id'];
  650. }
  651. }
  652. //根据试卷信息查找相同试卷的同期考试
  653. $paperId=$PaperInfo[0]['paper_id'];
  654. $Topics=array();
  655. $TopicInfo=array();
  656. $paperRelation=SPaperTopicRelation::model()->getRelationsByPaperId2($paperId);
  657. if($paperRelation){
  658. foreach ($paperRelation as $val){
  659. $Topics[]= $val['topic_id'];
  660. $TopicInfo[$val['topic_id']]['topic_id']=$val['topic_id'];
  661. $TopicInfo[$val['topic_id']]['order']=$val['order']; //排序
  662. $TopicInfo[$val['topic_id']]['score']=$val['score']; //分数
  663. }
  664. }
  665. $samePaper=array();
  666. if($Topics){
  667. $AllPaperTopic=SPaperTopicRelation::model()->getPaperByTopicIds($Topics,$SemesterId,$nowExamGroupId,$Grade);
  668. if($AllPaperTopic){
  669. $Paper_Topic=array();
  670. foreach($AllPaperTopic as $val){
  671. $Paper_Topic[$val['paper_id']][]=$val['topic_id'];
  672. }
  673. if($Paper_Topic){
  674. foreach ($Paper_Topic as $key=>$val){
  675. $tempTopics=array_unique($val);
  676. $isTrue=true;
  677. if(count($tempTopics)!=count($Topics)){
  678. continue;
  679. }
  680. $TempPaperRelation=SPaperTopicRelation::model()->getRelationsByPaperId2($key);
  681. if($TempPaperRelation){
  682. foreach ($TempPaperRelation as $v){
  683. if(!isset($TopicInfo[$v['topic_id']]) || $TopicInfo[$v['topic_id']]['order']!=$v['order'] || $TopicInfo[$v['topic_id']]['score']!=$v['score']){
  684. $isTrue=false;
  685. break;
  686. }
  687. }
  688. }
  689. if($isTrue){
  690. $samePaper[]=$key;
  691. }
  692. }
  693. }
  694. }
  695. //读取考试id
  696. if($samePaper){
  697. foreach($samePaper as $pid){
  698. //读取考试id,排除相同班级
  699. $Exam=$ExamModel->getExamByPaperExcludeClass($pid,$ClassArr);
  700. if($Exam){
  701. $TempClassArr=array();
  702. //检测班级是否重复
  703. $TempExamClass=$ExamModel->getClassByExamGroupId($Exam['exam_group_id']);
  704. if($TempExamClass){
  705. foreach($TempExamClass as $val){
  706. $TempClassArr[]=$val['class_id'];
  707. }
  708. }
  709. if(!$TempClassArr || array_intersect($TempClassArr,$ClassArr)){
  710. continue;
  711. }
  712. $SameExam[]=$Exam;
  713. }
  714. }
  715. }
  716. }
  717. }else{
  718. //非数学学科
  719. $SameExam= $this->findSamePaperForMostSubject($ExamInfo);
  720. }
  721. if($SameExam){
  722. foreach ($SameExam as $key=>$val){
  723. if(empty($val) || !isset($val['name'])){
  724. unset($SameExam[$key]);
  725. }
  726. }
  727. }
  728. if($SameExam){
  729. $SameExam=array_values($SameExam);
  730. $result['status']=1;
  731. }
  732. $result['data']=$SameExam;
  733. exit(json_encode($result));
  734. }
  735. /*根据年级读取班级*/
  736. public function actionGetClassByGrade(){
  737. $grade=Req::post('grade');
  738. $semester=$this->semesterId;
  739. $class=ClassModel::model()->getClassBySemesternianji($semester,$grade);
  740. $result=array(
  741. 'status'=>1
  742. );
  743. $data=array();
  744. if($class){
  745. foreach($class as $val){
  746. $data[]=array(
  747. 'class_id'=>$val->class_id,
  748. 'class_name'=>$val->class_name,
  749. );
  750. }
  751. }
  752. $result['data']=$data;
  753. exit(json_encode($result));
  754. }
  755. /*切换统考记录状态*/
  756. public function actionChangeStatus(){
  757. $display=intval(Req::post('display'));
  758. $cylet_id=intval(Req::post('cid'));
  759. $result=array(
  760. 'status'=>0
  761. );
  762. if(!$cylet_id || !in_array($display,array(0,1))){
  763. exit(json_encode($result));
  764. }
  765. $CyletModel=new Cylet();
  766. $data=array(
  767. 'is_display'=>$display
  768. );
  769. $Condition=array(
  770. 'cylet_id'=>$cylet_id
  771. );
  772. $res=$CyletModel->updateByCondition($data,$Condition);
  773. if($res){
  774. $result['status']=1;
  775. }
  776. exit(json_encode($result));
  777. }
  778. public function actionCheckTime(){
  779. $Time=Req::post('create_time');
  780. $cylet_id=Req::post('cylet_id');
  781. $grade=Req::post('grade');
  782. $arts_s=Req::post('arts_s');
  783. $result=array('status'=>0);
  784. if(!$Time){
  785. $result['msg']='时间格式不正确';
  786. exit(json_encode($result));
  787. }
  788. $CyletModel=new Cylet();
  789. $create_time=strtotime(date('Y-m-d',$Time));
  790. $data=$CyletModel->getByTime($create_time,$grade,$arts_s);
  791. if($data){
  792. if($data['cylet_id']==$cylet_id){
  793. $result=array('status'=>1,'msg'=>'统考时间可以使用');
  794. }else{
  795. $result=array('status'=>0,'msg'=>'已有相同时间统考');
  796. }
  797. }else{
  798. $result=array('status'=>1,'msg'=>'统考时间可以使用');
  799. }
  800. exit(json_encode($result));
  801. }
  802. public function actionDownload(){
  803. $cylet_id=Req::post('cylet_id');
  804. $postData=array(
  805. 'cyletId'=>$cylet_id,
  806. 'hasStudentNo'=>1,
  807. 'hasStudentSchoolCard'=>1,
  808. 'hasStudentSystemCard'=>1
  809. );
  810. $url = Yii::app()->params['zsy_api_url'].'/teacher/academic/download/all/subject/'.$this->schoolInfo->school_id;
  811. $username = $this->schoolInfo->school_id;
  812. $password = md5($this->schoolId.Yii::app()->params['zsy_api_key']);
  813. $rs = $this->CrmApiPost($url,$postData,$username,$password);
  814. if(isset($rs->errCode) && $rs->errCode =='00')
  815. {
  816. echo json_encode(array('status'=>1,'result'=>$rs->data));exit;
  817. }
  818. $errMsg = '下载失败';
  819. if(isset($rs->errMsg))
  820. {
  821. $errMsg = $rs->errMsg;
  822. }
  823. if(Yii::app()->params['handle_log_on_off'])
  824. {
  825. writeFileLog(jsonEncode(array(
  826. "cylet" => $cylet_id,
  827. "operate_project" => 'zsyas2',
  828. "school_id" => $this->schoolId,
  829. "title" => '下载统考报表',
  830. "operate_account" => Yii::app()->session['coachInfo']['coach_name'],
  831. "operate_method" => $this->action,
  832. "operate_url" => $this->getRoute(),
  833. "operate_param" =>json_encode(array('post'=>$_POST,'get'=>$_GET)),
  834. "date"=>date('Y-m-d H:i:s')
  835. )));
  836. }
  837. echo json_encode(array('status'=>0,'result'=>$errMsg));exit;
  838. }
  839. public function CrmApiPost($url, $arr, $username,$password,$method='POST')
  840. {
  841. $ch = @curl_init();
  842. $result = FALSE;
  843. if ($ch)
  844. {
  845. $data = json_encode($arr);
  846. if($method=='POST'){
  847. // Digest认证
  848. curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
  849. curl_setopt($ch, CURLOPT_USERPWD, $username .':'. $password);
  850. // 不输出头部
  851. curl_setopt($ch, CURLOPT_HEADER, 0);
  852. // curl_exec 获取到的内容不直接输出, 而是返回
  853. curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  854. // 请求重启路由器的地址 传参 进行重启
  855. curl_setopt($ch, CURLOPT_URL, $url);
  856. curl_setopt($ch, CURLOPT_USERAGENT, 'Api Client/1.0.0 (chengfei@liancaitech.com)');
  857. curl_setopt($ch, CURLOPT_POST, 1);
  858. curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  859. curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  860. 'Content-Type: application/json',
  861. 'Content-Length: '. strlen($data),
  862. ));
  863. }else{
  864. // Digest认证
  865. curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
  866. curl_setopt($ch, CURLOPT_USERPWD, $username .':'. $password);
  867. // 不输出头部
  868. curl_setopt($ch, CURLOPT_HEADER, 0);
  869. // curl_exec 获取到的内容不直接输出, 而是返回
  870. curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  871. // 请求重启路由器的地址 传参 进行重启
  872. curl_setopt($ch, CURLOPT_URL, $url);
  873. curl_setopt($ch, CURLOPT_USERAGENT, 'Api Client/1.0.0 (chengfei@liancaitech.com)');
  874. }
  875. curl_setopt($ch, CURLOPT_TIMEOUT,30);
  876. if( !curl_errno($ch))
  877. {
  878. $result = json_decode(curl_exec($ch));
  879. }
  880. // 释放资源
  881. curl_close($ch);
  882. }
  883. return $result;
  884. }
  885. /*头部菜单信息*/
  886. private function getHeadInfo(){
  887. $coach_id = $this->coachId;
  888. $semester_id = $this->semesterId;
  889. $criteria = new CDbCriteria();
  890. if(Yii::app()->session['session_duoxueke_subject_id']==3)
  891. {
  892. $criteria->addInCondition('subjects',$this->mathSubjectId);
  893. }else
  894. {
  895. $criteria->addCondition('subjects = '.Yii::app()->session['session_duoxueke_subject_id']);
  896. }
  897. $criteria->addCondition('status = 0');
  898. $teacher_data = Teacher::model()->findAll($criteria);
  899. $teacher_arr = array();
  900. if($teacher_data){
  901. $i = 0;
  902. foreach($teacher_data as $v){
  903. $teacher_arr[$i]['teacher_id'] = $v->teacher_id;
  904. $teacher_arr[$i]['teacher_name'] = $v->teacher_name;
  905. $i++;
  906. }
  907. }
  908. $data['teacher_arr'] = $teacher_arr;
  909. if(isset($this->schoolInfo->use_zhixue) && !empty($this->schoolInfo->use_zhixue))
  910. {
  911. $data["use_zhixue"] = $this->schoolInfo->use_zhixue;
  912. }else
  913. {
  914. $data["use_zhixue"] = 0;
  915. }
  916. return $data;
  917. }
  918. function jsonEncode($arr)
  919. {
  920. $jsonSupport = version_compare(PHP_VERSION, '5.4', '>=');
  921. if ($jsonSupport)
  922. {
  923. $result = json_encode($arr, JSON_UNESCAPED_UNICODE);
  924. }
  925. else
  926. {
  927. $result = json_encode($arr);
  928. $result = preg_replace("#\\\u([0-9a-f]{4})#ie", "iconv('UCS-2', 'UTF-8', pack('H4', '\\1'))", $result);
  929. // $result = preg_replace("#\\\u([0-9a-f]+)#ie", "iconv('UCS-2', 'UTF-8', pack('H4', '\\1'))", $result);
  930. }
  931. return $result;
  932. }
  933. public function actionLoadCyletInfo(){
  934. $cylet_id=intval(Req::post('cylet_id'));
  935. if(!$cylet_id){
  936. echo json_encode(array('status'=>0,'result'=>'统考ID不正确'));exit;
  937. }
  938. $CyletModel=new Cylet();
  939. $CyletInfo=$CyletModel->findById($cylet_id);
  940. if(!$CyletInfo){
  941. echo json_encode(array('status'=>0,'result'=>'统考ID不正确'));exit;
  942. }
  943. $subjectIds=explode(',',$CyletInfo['subject_ids']);
  944. $isHasEnglish=0;
  945. if(in_array(8,$subjectIds)){
  946. $isHasEnglish=1;
  947. }
  948. $waiData = array();
  949. $waiDefaultSubjectIds = array(8,21,22,23,24,25,26,31);//默认外语学科
  950. if(array_intersect($waiDefaultSubjectIds,$subjectIds)){
  951. $waiSubjectIds = array_intersect($waiDefaultSubjectIds,$subjectIds);
  952. $sql = "select subject_id,subject_name from subject where subject_id in (".implode(",",$waiSubjectIds).")";
  953. $subject_info = $this->conn->createCommand($sql)->queryAll();
  954. if($subject_info){
  955. foreach($subject_info as $k=>$v){
  956. $waiData[] = array("subject_id"=>$v['subject_id'],"subject_name"=>$v['subject_name']);
  957. }
  958. }
  959. }
  960. if(in_array(array(8,21,22,23,24,25,26,31),$subjectIds)){
  961. $sql = "select subject_id,subject_name from subject where subject_id = '{$sub_name}'";
  962. $subject_info = $this->conn->createCommand($sql)->queryRow();
  963. }
  964. $classIds=explode(',',$CyletInfo['class_ids']);
  965. $class=ClassModel::model()->getClassArrayByIds($classIds);
  966. $ScoreSection=array();
  967. $CountSection=array();
  968. $rs=$this->getSection($cylet_id);
  969. //debug($rs);
  970. $studentNumber=1;
  971. if($rs){
  972. $ScoreSection=$rs['ScoreSection'];
  973. $CountSection=$rs['CountSection'];
  974. if(isset($ScoreSection[0])){
  975. $TotalScore=$ScoreSection[0];
  976. unset($ScoreSection[0]);
  977. }
  978. if(isset($ScoreSection[10])){
  979. unset($ScoreSection[10]);
  980. }
  981. if(isset($CountSection[0])){
  982. unset($CountSection[0]);
  983. }
  984. if(isset($CountSection[10])){
  985. $studentNumber=$CountSection[10];
  986. unset($CountSection[10]);
  987. }
  988. $ScoreSection=array_values($ScoreSection);
  989. $CountSection=array_reverse(array_values($CountSection));
  990. }
  991. $resultData=array(
  992. 'score'=>$TotalScore,
  993. 'student_count'=>$studentNumber,
  994. 'class'=>$class,
  995. 'score_section'=>$ScoreSection,
  996. 'count_section'=>$CountSection,
  997. 'score_report'=>$CyletInfo['generate_new_exam_score_report_status'],
  998. 'is_has_english'=>$isHasEnglish,
  999. 'waiData'=>$waiData
  1000. );
  1001. exit(json_encode($resultData));
  1002. }
  1003. public function actionDownloadTable(){
  1004. $reportTypeList=Req::post('table');
  1005. $clazzIdList=Req::post('classlist');
  1006. $ratio=Req::post('ratio'); //英语系数值
  1007. $ratioSwitch=Req::post('ratio_switch'); //英语系数是否开启
  1008. $subjectIds=Req::post('subject_id'); //外语学科
  1009. $hasStudentNo=(int)Req::post('hasStudentNo'); //学号
  1010. $hasStudentSystemCard=(int)Req::post('hasStudentSystemCard'); //系统准考证
  1011. $hasStudentSchoolCard=(int)Req::post('hasStudentSchoolCard'); //学校准考证
  1012. $hasIdNumber=(int)Req::post('hasIdNumber'); //身份证
  1013. $subjectCoefficients = array();
  1014. if($ratio && $subjectIds && count($ratio) == count($subjectIds)){
  1015. foreach($subjectIds as $k=>$v){
  1016. $key='decimal'.$v;
  1017. $totalScoreCoefficientIsRounding=Req::post($key);
  1018. $subjectCoefficients[] = array("subjectId"=>$v,"coefficient"=>$ratio[$k],'totalScoreCoefficientIsRounding'=>$totalScoreCoefficientIsRounding);
  1019. }
  1020. }
  1021. $scoreSectionList=array();
  1022. for($i=0;$i<10;$i++){
  1023. $inputName='score_'.$i;
  1024. if(Req::post($inputName)){
  1025. $scoreSectionList[]=Req::post('score_'.$i);
  1026. }
  1027. }
  1028. $scoreSectionList[]='0';
  1029. $rankSectionList=array();
  1030. for($i=10;$i>=0;$i--){
  1031. $rankSectionList[]=Req::post('count_'.$i);
  1032. }
  1033. $cyletId=Req::post('cylet_id');
  1034. $isNative=Req::post('isNative');
  1035. $param=array();
  1036. $param['clazzIdList']=$clazzIdList;
  1037. $param['cyletId']=$cyletId;
  1038. $param['rankSectionList']=$rankSectionList;
  1039. $param['reportTypeList']=$reportTypeList;
  1040. $param['scoreSectionList']=$scoreSectionList;
  1041. $param['removeZeroStudent']=Req::post('removeZeroStudent');
  1042. $param['clazzAnalysisMode']=Req::post('clazzAnalysisMode');
  1043. if($isNative){
  1044. $param['isNative']=1;
  1045. }else{
  1046. $param['isNative']=0;
  1047. }
  1048. if($ratioSwitch){
  1049. // $param['englishCoefficient']=$ratio;
  1050. }
  1051. $param['schoolId']=$this->schoolId;
  1052. if($subjectCoefficients){
  1053. $param['subjectCoefficients']=$subjectCoefficients;
  1054. }
  1055. $param['hasStudentNo'] = $hasStudentNo;
  1056. $param['hasStudentSystemCard'] = $hasStudentSystemCard;
  1057. $param['hasStudentSchoolCard'] = $hasStudentSchoolCard;
  1058. $param['hasIdNumber'] = $hasIdNumber;
  1059. //发送消息
  1060. sendDataToKafka('zsyte-hm-download-cylet-report',$param);
  1061. echo json_encode(array('status'=>1));exit;
  1062. // $url = Yii::app()->params['zsy_api_url'].'/teacher/hm/report/download/exam/group/analysis/report';
  1063. // $username = $this->schoolInfo->school_id;
  1064. // $password = md5($this->schoolId.Yii::app()->params['zsy_api_key']);
  1065. //
  1066. // $rs = $this->CrmApiPost($url,$param,$username,$password);
  1067. // if(isset($rs->errCode) && $rs->errCode =='00')
  1068. // {
  1069. // echo json_encode(array('status'=>1,'result'=>$rs->data));exit;
  1070. // }
  1071. // $errMsg = '下载失败';
  1072. // if(isset($rs->errMsg))
  1073. // {
  1074. // $errMsg = $rs->errMsg;
  1075. // }
  1076. // echo json_encode(array('status'=>0,'result'=>$errMsg));exit;
  1077. }
  1078. private function getSection($cylet_id){
  1079. $param=array();
  1080. $username = $this->schoolInfo->school_id;
  1081. $password = md5($this->schoolId.Yii::app()->params['zsy_api_key']);
  1082. $url = Yii::app()->params['zsy_api_url'].'/teacher/hm/report/exam/group/rank/section/'.$cylet_id;
  1083. $rs = $this->CrmApiPost($url,$param,$username,$password,'GET');
  1084. $CountSection=array(); //排名分段
  1085. if(isset($rs->errCode) && $rs->errCode =='00')
  1086. {
  1087. $CountSection=$rs->data;
  1088. }
  1089. $url = Yii::app()->params['zsy_api_url'].'/teacher/hm/report/exam/group/score/section/'.$cylet_id;
  1090. $rs = $this->CrmApiPost($url,$param,$username,$password,'GET');
  1091. $ScoreSection=array(); //总分分段
  1092. if(isset($rs->errCode) && $rs->errCode =='00')
  1093. {
  1094. $ScoreSection=$rs->data;
  1095. }
  1096. return array('CountSection'=>$CountSection,'ScoreSection'=>$ScoreSection);
  1097. }
  1098. }