IspgiftController.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2020/7/29 0029
  6. * Time: 10:18
  7. */
  8. class IspgiftController extends Controller
  9. {
  10. public function actionIndex()
  11. {
  12. Url::clean();
  13. $data = array();
  14. $printName = Req::get("name");
  15. $classId = Req::get("classId");
  16. $grade = (int)Req::get("grade");
  17. $newCondition = array();
  18. if($grade){
  19. $newCondition[] = 'm.grade='.$grade;
  20. }
  21. if($printName){
  22. $newCondition[] = 'm.name like "%'.$printName.'%"';
  23. }
  24. if($classId){
  25. $newCondition[] = 'm.class_id='.$classId;
  26. }
  27. $newCondition[] = 'm.micro_type=2';
  28. $microProduct = new MicroProduct();
  29. $resultList = $microProduct->getList($newCondition,array('m.create_time desc','m.micro_id desc'));
  30. $printList = array();
  31. if($resultList["rs"]){
  32. foreach ($resultList['rs'] as $k=>$v) {
  33. $printList[$k]=$v;
  34. }
  35. }
  36. if (empty($grade)) {
  37. $grade = 'ALL';
  38. }
  39. $classes = $this->schoolManager->getClasses($grade);
  40. $data['pages'] = $resultList['pager'];
  41. $data['page_total'] = $resultList['pager']->rowsCount;
  42. $data['printList'] = $printList;
  43. $data["printName"] = $printName;
  44. $data["classes"] = $classes;
  45. $data["classId"] = $classId;
  46. $data["grade"] = $grade;
  47. $this->render('index',$data);
  48. }
  49. //个性化学习宝赠品设置
  50. public function actionSetting()
  51. {
  52. $data =array();
  53. $result = $this->apiPost('/product/batch',array(
  54. 'productId' => 2,
  55. 'parentId' => 0
  56. ));
  57. $data['topNode']= isset($result->data) ? $result->data : array();
  58. $this->render('setting', $data);
  59. }
  60. //获取好题本子节点
  61. public function actionAjaxChildNode()
  62. {
  63. $parentId = Req::get("parentId");
  64. $data = $this->apiPost('/product/batch',array(
  65. 'productId' => 2,
  66. 'parentId' => $parentId
  67. ));
  68. if ($data->status!= 1 && !empty($data->error)) {
  69. echo json_encode(array("status" => 0, "message" => $data->error));exit();
  70. }
  71. $data = !empty($data->data) ? $data->data : null;
  72. $res = $this->apiPost('/product/detail',array('pcIds'=> $parentId));
  73. $details = array();
  74. if($res->status== 1){
  75. $resData = $res->data;
  76. $details = isset($resData[0]->details) ? $resData[0]->details : array();
  77. }
  78. echo json_encode(array('status'=>1,'data'=>$data, 'detail'=>$details));exit;
  79. }
  80. //保存个性化学习宝赠品设置
  81. public function actionAjaxSaveGift(){
  82. $result = array();
  83. $error = array();
  84. if (! Yii::app()->request->isAjaxRequest || ! Yii::app()->request->isPostRequest){
  85. $error[] = '错误的来源!';
  86. }else{
  87. $grade=(int)Req::post('grade');
  88. $classIds = Req::post('selectClassIds');
  89. $pcIds = (array)Req::post('pcIds');
  90. if(!$grade){
  91. $error[] = '请选择年级';
  92. }
  93. if(!$classIds){
  94. $error[] = '请选择班级';
  95. }
  96. if(!$pcIds){
  97. $error[] = '请指定目录';
  98. }
  99. }
  100. $pcName ='';
  101. foreach ($pcIds as $item){
  102. $pcName .= $item['pcName'];
  103. }
  104. $nodeArr = self::createTree($pcIds);
  105. if(!$error){
  106. $time = time();
  107. $strModel = new SStudentClassRelation();
  108. $transaction = $this->sConn->beginTransaction();
  109. try{
  110. $date = date("Y-m-d", $time);
  111. $lastday = date("Y-m-d",strtotime("$date Sunday"));
  112. $firstday = date("Y-m-d",strtotime("$lastday - 6 days"));
  113. $microGroupId = getUniqueId($this->schoolId);
  114. foreach($classIds as $k=>$v){
  115. $microId = getUniqueId($this->schoolId);
  116. $this->sConn->createCommand()->insert('math_micro_setting',array(
  117. 'micro_group_id'=>$microGroupId,
  118. 'micro_id' => $microId,
  119. 'micro_type' => 2,
  120. 'name' => $pcName,
  121. 'semester_id' => $this->semesterId,
  122. 'grade' => $grade,
  123. 'class_id' => $v,
  124. 'is_all_html' => 0,
  125. 'node_ids' => json_encode($nodeArr, true),
  126. 'school_group_id'=> $this->schoolGroupId,
  127. 'create_time' => $time,
  128. ));
  129. $sql = <<<SQL
  130. SELECT * FROM math_micro_class_limit l LEFT JOIN math_micro_setting s ON l.class_id=s.class_id
  131. WHERE l.class_id='{$v}' and '{$date}' BETWEEN l.week_start_time AND l.week_end_time;
  132. SQL;
  133. $data = $this->sConn->createCommand($sql)->queryRow();
  134. if(empty($data)) {
  135. $this->sConn->createCommand()->insert('math_micro_class_limit',array(
  136. 'micro_type' => 2, //微产品类型 2:个性化学习宝培优版赠品
  137. 'semester_id' => $this->semesterId,
  138. 'grade' => $grade,
  139. 'class_id' => $v,
  140. 'limit' => 3,
  141. 'week_start_time' => $firstday,
  142. 'week_end_time' => $lastday,
  143. 'create_time' => $time,
  144. ));
  145. }
  146. //获取班级学生
  147. $stuData = $strModel->getRelationsByClassId_Status_0($v);
  148. if($stuData){
  149. foreach($stuData as $kk=>$vv){
  150. $this->sConn->createCommand()->insert('math_micro_student',array(
  151. 'micro_id' => $microId,
  152. 'class_id' => $v,
  153. 'student_id' => $vv['student_id'],
  154. 'create_time'=>$time
  155. ));
  156. }
  157. }
  158. }
  159. $transaction->commit();
  160. }catch(Exception $e){
  161. $transaction->rollBack();
  162. if (YII_ENV == 'production') {
  163. $error[] = '系统错误[SQL]';
  164. } else {
  165. $error[] = $e->getMessage();
  166. }
  167. }
  168. }
  169. if($error){
  170. echo json_encode(array('status'=>0,'error'=>$error));exit;
  171. }else{
  172. echo json_encode(array('status'=>1));exit;
  173. }
  174. }
  175. /**
  176. * 获取菜单功能层级树
  177. */
  178. private static function createTree($data,$parentId = 0)
  179. {
  180. if(!$data){
  181. return array();
  182. }
  183. $tree = array();
  184. foreach($data as $k => $v)
  185. {
  186. //递归查找
  187. if($v['parentId'] == $parentId)
  188. {
  189. $v['level'] = $k + 1;
  190. $v['children'] = static::createTree($data, $v['pcId']);
  191. $tree[] = $v;
  192. }
  193. }
  194. return $tree;
  195. }
  196. /*
  197. * 获取班级
  198. */
  199. public function actionAjaxGetClasses(){
  200. $result = array();
  201. $grade=(int)Req::post('grade');
  202. $time = time();
  203. $date = date('Y-m-d',$time);
  204. $endDate = date("Y-m-d",strtotime("$date Sunday"));
  205. $startDate = date("Y-m-d",strtotime("$endDate - 6 days"));
  206. $startTime = strtotime($startDate. ' 00:00:00');
  207. $endTime = strtotime($endDate. ' 23:59:59');
  208. //获取班级
  209. $hasLimitClassIds = array();
  210. $sql = <<<SQL
  211. SELECT l.class_id,l.`limit`,count(*) as c_count FROM math_micro_class_limit l LEFT JOIN math_micro_setting s ON l.class_id=s.class_id
  212. WHERE s.create_time>={$startTime} and s.create_time<={$endTime} and '{$date}' BETWEEN l.week_start_time AND l.week_end_time GROUP BY s.class_id;
  213. SQL;
  214. $data = $this->sConn->createCommand($sql)->queryAll();
  215. if($data){
  216. foreach($data as $k=>$v){
  217. if($v['c_count'] >= $v['limit']){
  218. $hasLimitClassIds[] = (string)$v['class_id'];
  219. }
  220. }
  221. }
  222. if($grade){
  223. $sql = "select class_id,class_name from class where semester_id = '{$this->semesterId}' and grade = {$grade} and class_type = 1";
  224. $data = $this->sConn->createCommand($sql)->queryAll();
  225. if($data){
  226. $i = 0;
  227. foreach($data as $k => $v){
  228. $sql = "select count(student_id) count from student_class_relation where class_id = '{$v['class_id']}' and status = 0";
  229. $class_student = $this->sConn->createCommand($sql)->queryRow();
  230. if($class_student && $class_student['count']>0){
  231. $result[$i]['class_id'] = $v['class_id'];
  232. $result[$i]['class_name'] = $v['class_name'];
  233. if(in_array((string)$v['class_id'],$hasLimitClassIds,true)){
  234. $result[$i]['status'] = 1;
  235. }else{
  236. $result[$i]['status'] = 0;
  237. }
  238. $i++;
  239. }
  240. }
  241. }
  242. }
  243. echo json_encode($result);exit;
  244. }
  245. //选择学生 好题本
  246. public function actionSelectStu(){
  247. $data = array();
  248. $sname = (string)Req::get("sname"); //学生名字
  249. $microId = (string)Req::get("microId");
  250. if(!$microId){
  251. Yii::app()->jump->error('参数错误!');
  252. }
  253. //获取班级名称以及周后推送名称
  254. $sql = "select s.name,c.class_name,s.grade,s.class_id,s.create_time,s.semester_id from math_micro_setting s join class c on s.class_id = c.class_id where s.micro_id = '{$microId}'";
  255. $names = $this->sConn->createCommand($sql)->queryRow();
  256. if(!$names){
  257. $names = array();
  258. $names['name'] = '';
  259. $names['class_name'] = '';
  260. $names['grade'] = 0;
  261. }else{
  262. $data['name'] = isset($names['name'])?$names['name']:'';
  263. }
  264. $sql = "select student_id,is_micro_pdf from math_micro_student where micro_id = '{$microId}'";
  265. $relateStudent = $this->sConn->createCommand($sql)->queryAll();
  266. $studentIds = array();
  267. $stuIsPdf = array();
  268. if($relateStudent){
  269. foreach ($relateStudent as $studentInfo) {
  270. $studentIds[] = (string)$studentInfo['student_id'];
  271. $stuIsPdf[(string)$studentInfo['student_id']] = $studentInfo['is_micro_pdf'];
  272. }
  273. }
  274. if($studentIds){
  275. $studentNames = SStudentInfo::model()->getStudents($studentIds); //求学生名字
  276. if($studentNames){
  277. if($sname){
  278. $i = 1;
  279. foreach($studentNames as $k=>$v){
  280. if(strpos($v['realname'],$sname) !== false){
  281. $data['list'][$i]['stu_id'] = (string)$v['student_id'];
  282. $data['list'][$i]['stu_name'] = $v['realname'];
  283. $data['list'][$i]['name'] = $names['class_name'].$v['realname'].$names['name'];
  284. $data['list'][$i]['is_pdf'] = isset($stuIsPdf[(string)$v['student_id']])?$stuIsPdf[(string)$v['student_id']]:0;
  285. $i++;
  286. }
  287. }
  288. }else{
  289. $i = 1;
  290. foreach($studentNames as $k=>$v){
  291. $data['list'][$i]['stu_id'] = (string)$v['student_id'];
  292. $data['list'][$i]['stu_name'] = $v['realname'];
  293. $data['list'][$i]['name'] = $names['class_name'].$v['realname'].$names['name'];
  294. $data['list'][$i]['is_pdf'] = isset($stuIsPdf[(string)$v['student_id']])?$stuIsPdf[(string)$v['student_id']]:0;
  295. $i++;
  296. }
  297. }
  298. }
  299. }
  300. $Sem=new SSemester();
  301. $code= $Sem->conn->createQuery()
  302. ->from('semester')
  303. ->where("semester_id = '".$names['semester_id']."'")
  304. ->limit(1)
  305. ->query()
  306. ->read();
  307. if($studentIds){
  308. $intarr=array(
  309. "schoolId"=>$this->schoolId,
  310. "clazzId"=>$names['class_id'],
  311. "semester"=>$code['refer_code'],
  312. "grade"=>$names['grade'],
  313. "students"=>$studentIds,
  314. "examTime"=>$names['create_time'],
  315. "subject"=>3
  316. );
  317. $basic = imsBasicAuth($this->schoolId.'_'.Yii::app()->session['coachInfo']['coach_name'],Yii::app()->params["zsy_api_key"]);
  318. $intarr['classify'] = 1;
  319. $openStuIds = array();
  320. while ($intarr['classify'] <= 3) {
  321. $rs = json_decode(Curl::http_post_Basic_json(Yii::app()->params["get_limit_url"], json_encode($intarr), $basic));
  322. if(!$rs){
  323. Yii::app()->jump->error("接口错误");
  324. }
  325. if($rs->errCode!="00"){
  326. Yii::app()->jump->error($rs->errMsg);
  327. }
  328. $openStuIds = array_merge($openStuIds, $rs->data);
  329. $intarr['classify']++;
  330. }
  331. $openStuIds = array_unique($openStuIds);
  332. if(!empty($openStuIds)){
  333. $data['limitstu']=array();
  334. foreach ($openStuIds as $v){
  335. $data['limitstu'][(string)$v]=$v;
  336. }
  337. }
  338. }
  339. $data['microId'] = $microId;
  340. $data['sname'] = $sname;
  341. $data['printType'] = 'isp_gift_stu';
  342. $this->render('isp_gift_stu',$data);
  343. }
  344. //下载好题本
  345. public function actionGetGiftFile(){
  346. $microId = (string)Req::get("microId");
  347. $studentsIds = (string)Req::get("studentsIds");
  348. $params = array();
  349. if(!$microId){
  350. echo json_encode(array("success" => 0, "message" => "缺少参数"));
  351. exit();
  352. }
  353. if(!$studentsIds){
  354. $studentsIds = array();
  355. $sql = "select student_id from math_micro_student where micro_id = '{$microId}' and is_micro_pdf = 1";
  356. $stuArr = $this->sConn->createCommand($sql)->queryAll();
  357. if($stuArr){
  358. foreach($stuArr as $k=>$v){
  359. $studentsIds[] = $v['student_id'];
  360. }
  361. }
  362. }else{
  363. $studentsIds = explode(',',$studentsIds);
  364. }
  365. if(!$studentsIds || empty($studentsIds)){
  366. echo json_encode(array("success" => 0, "message" => "无生成的学生"));
  367. exit();
  368. }
  369. $params['microId'] = $microId;
  370. $sql = "select class_id,grade,create_time,semester_id,school_group_id from math_micro_setting where micro_id = '{$microId}'";
  371. $msg = $this->sConn->createCommand($sql)->queryRow();
  372. $Sem=new SSemester();
  373. $code= $Sem->conn->createQuery()
  374. ->from('semester')
  375. ->where("semester_id = '".$msg['semester_id']."'")
  376. ->limit(1)
  377. ->query()
  378. ->read();
  379. $intarr=array(
  380. "schoolId"=>$this->schoolId,
  381. "clazzId"=>$msg['class_id'],
  382. "semester"=>$code['refer_code'],
  383. "grade"=>$msg['grade'],
  384. "students"=>$studentsIds,
  385. "examTime"=>$msg['create_time'],
  386. "subject"=>3
  387. );
  388. if(isset($msg['school_group_id']) && $msg['school_group_id']){
  389. $apiUrl = isset(Yii::app()->params["improve_url"][$msg['school_group_id']]) ? Yii::app()->params["improve_url"][$msg['school_group_id']] : null;
  390. }else{
  391. $apiUrl = isset(Yii::app()->params["improve_url"][$this->schoolGroupId]) ? Yii::app()->params["improve_url"][$this->schoolGroupId] : null;
  392. }
  393. if(!$apiUrl){
  394. echo json_encode(array("success" => 0, "message" => "接口配置信息错误"));
  395. exit();
  396. }
  397. $schoolInfo = BusinessSchool::model()->find('school_id=:school_id', array(':school_id' => $this->schoolId));
  398. if(isset($schoolInfo['is_allow_download']) && ($schoolInfo['is_allow_download']==1)){
  399. if($studentsIds){
  400. $params["studentIds"] = $studentsIds;
  401. }
  402. }else{
  403. if(Yii::app()->params["limit_open"]){
  404. $basic = imsBasicAuth($this->schoolId.'_'.Yii::app()->session['coachInfo']['coach_name'],Yii::app()->params["zsy_api_key"]);
  405. $intarr['classify'] = 1;
  406. $openStuIds = array();
  407. while ($intarr['classify'] <= 3) {
  408. $rs = json_decode(Curl::http_post_Basic_json(Yii::app()->params["get_limit_url"], json_encode($intarr), $basic));
  409. if(!$rs){
  410. Yii::app()->jump->error("接口错误");
  411. }
  412. if($rs->errCode!="00"){
  413. Yii::app()->jump->error($rs->errMsg);
  414. }
  415. $openStuIds = array_merge($openStuIds, $rs->data);
  416. $intarr['classify']++;
  417. }
  418. if(!empty($openStuIds)){
  419. $params["studentIds"]=array_unique($openStuIds);
  420. } else{
  421. echo json_encode(array("success" => 0, "message" =>"请先购买商品"));
  422. exit();
  423. }
  424. }else{
  425. if($studentsIds){
  426. $params["studentIds"] = $studentsIds;
  427. }
  428. }
  429. }
  430. $params['schoolId'] = $this->schoolId;
  431. $params['type'] = 6; //微产品
  432. $params['microType'] = 2; //微产品类型 培优版赠品
  433. $rs = Curl::post($apiUrl."/rest/download_week_pdf/index", $params);
  434. if(!($rs = json_decode($rs))){
  435. $rs = array(
  436. "success" => 0,
  437. "message" => "请求接口失败",
  438. );
  439. }else{
  440. //更新下载时间
  441. if($rs->success==1 || $rs->success==2){
  442. $time = time();
  443. if($studentsIds){
  444. $sql = "update math_micro_student set is_micro_download = 1,micro_download_time={$time} where micro_id = '{$microId}' and student_id in (".implode(',',$studentsIds).")";
  445. $this->sConn->createCommand($sql)->execute();
  446. }
  447. }
  448. }
  449. if(isset($msg['school_group_id']) && $msg['school_group_id'] && isset($rs->downloadPath)){
  450. if (YII_ENV == 'pro' || YII_ENV == 'production') {
  451. $rs->downloadPath = preg_replace('/http\:\/\/zstatic\d{1,2}/','http://zstatic'.$msg['school_group_id'],$rs->downloadPath);
  452. }
  453. }
  454. echo json_encode($rs);exit;
  455. }
  456. //附件下载统计
  457. public function actionDownload()
  458. {
  459. $pcdId = (string)Req::get("pcdId");
  460. $url = (string)Req::get("url");
  461. $fileName = (string)Req::get("fileName");
  462. $ch = curl_init($url);
  463. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  464. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  465. curl_setopt($ch, CURLOPT_NOBODY, 1);
  466. curl_exec($ch);
  467. $code = curl_getinfo($ch,CURLINFO_HTTP_CODE);
  468. curl_close($ch);
  469. if($code == 404){
  470. Yii::app()->jump->error('文件不存在!');
  471. }
  472. $data['coachId'] = $this->coachId;
  473. $data['schoolId'] = $this->schoolId;
  474. $data['createTime'] = time();
  475. $data['pcdId'] = $pcdId;
  476. $data['toDataPoint'] = true;
  477. $data['dataPointType'] = 15;
  478. @$this->sendKafka('datapoint-logs',$data);
  479. header('Content-Description: File Transfer');
  480. header('Content-Type: application/vnd.android.package-archive');
  481. header('Content-Disposition: attachment; filename=' . $fileName);
  482. header('Content-Transfer-Encoding: binary');
  483. header('Expires: 0');
  484. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  485. header('Pragma: public');
  486. $ch = curl_init();
  487. curl_setopt($ch, CURLOPT_URL, $url);
  488. curl_setopt($ch, CURLOPT_HEADER, 0);
  489. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  490. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
  491. curl_setopt($ch, CURLOPT_WRITEFUNCTION, function ($ch, $buffer) {
  492. echo $buffer;
  493. return strlen($buffer);
  494. });
  495. curl_exec($ch);
  496. curl_close($ch);
  497. }
  498. /**
  499. * 发送消息队列
  500. * @return mixed
  501. */
  502. private function sendKafka($topic='',$data = array())
  503. {
  504. if ($data) {
  505. $conf = new RdKafka\Conf();
  506. $conf->set('metadata.broker.list', Yii::app()->params['kafka']);
  507. $producer = new RdKafka\Producer($conf);
  508. $topic = $producer->newTopic($topic);
  509. $topic->produce(RD_KAFKA_PARTITION_UA, 0, json_encode($data));
  510. $producer->poll(0);
  511. $result = $producer->flush(10000);
  512. if($result===0){
  513. return true;
  514. }
  515. }
  516. return true;
  517. }
  518. /**
  519. * 发送消息队列
  520. * @return mixed
  521. */
  522. public function actionCheckOrder()
  523. {
  524. $classId = (string)Req::post("classId");
  525. $grade = Req::post('grade');
  526. $Sem=new SSemester();
  527. $code= $Sem->conn->createQuery()
  528. ->from('semester')
  529. ->where("semester_id = '".$this->semesterId."'")
  530. ->limit(1)
  531. ->query()
  532. ->read();
  533. $strModel = new SStudentClassRelation();
  534. $stuData = $strModel->getRelationsByClassId_Status_0($classId);
  535. $studentIds = array();
  536. foreach ($stuData as $student){
  537. $studentIds[]= $student['student_id'];
  538. }
  539. if($studentIds){
  540. $intarr=array(
  541. "schoolId"=>$this->schoolId,
  542. "clazzId"=>$classId,
  543. "semester"=>$code['refer_code'],
  544. "grade"=>$grade,
  545. "students"=>$studentIds,
  546. "examTime"=>time(),
  547. "subject"=>3
  548. );
  549. $basic = imsBasicAuth($this->schoolId.'_'.Yii::app()->session['coachInfo']['coach_name'],Yii::app()->params["zsy_api_key"]);
  550. $intarr['classify'] = 1;
  551. $openStuIds = array();
  552. while ($intarr['classify'] <= 3) {
  553. $rs = json_decode(Curl::http_post_Basic_json(Yii::app()->params["get_limit_url"], json_encode($intarr), $basic));
  554. if(!$rs){
  555. Yii::app()->jump->error("接口错误");
  556. }
  557. if($rs->errCode!="00"){
  558. Yii::app()->jump->error($rs->errMsg);
  559. }
  560. $openStuIds = array_merge($openStuIds, $rs->data);
  561. $intarr['classify']++;
  562. }
  563. $openStuIds = array_unique($openStuIds);
  564. if(!empty($openStuIds)){
  565. echo json_encode(array('status'=>1,'message'=>'ok'));exit;
  566. }else{
  567. echo json_encode(array('status'=>0,'message'=>'该班级不存在个性化学习宝订单','class_id'=>$classId));exit;
  568. }
  569. }else{
  570. echo json_encode(array('status'=>0,'message'=>'未获取该班级学生信息','class_id'=>$classId));exit;
  571. }
  572. }
  573. }