123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724 |
- <?php
- /**
- * 纠错本控制器类
- * @author jiangfei
- * @date 2015-07-22 17:50:00
- * @company .
- */
- class CorrectController extends Controller{
- //纠错本列表
- public function actionIndex(){
- $data = array();
- $printName = Req::get("name");
- $classId = Req::get("classId");
- $grade = (int)Req::get("grade");
- $newCondition = array();
- if($grade){
- $newCondition[] = 'gps.grade='.$grade;
- }
- if($printName){
- $newCondition[] = 'gp.name like "%'.$printName.'%"';
- }
- $newCondition[] = 'gps.product_type=66';
- $newCondition[] = "gps.subject_id='{$this->subjectId}'";
- $resultList = $this->schoolManager->getCorrect($newCondition,array('gps.create_time desc'));
- $printList = array();
- if($resultList["rs"]){
- foreach ($resultList['rs'] as $k=>$v) {
- $printList[$k]=$v;
- }
- }
- if (empty($grade)) {
- $grade = 'ALL';
- }
- $data['pages'] = $resultList['pager'];
- $data['page_total'] = $resultList['pager']->rowsCount;
- $data['printList'] = $printList;
- $data["printName"] = $printName;
- $data["grade"] = $grade;
- $this->render('index',$data);
- }
- //纠错本班级列表
- public function actionClassList(){
- $gpGroupId=Req::get('gpGroupId');
- if(!$gpGroupId){
- Yii::app()->jump->error('参数错误!');
- }
- $correctModel= new SGeneralProductSetting();
- $classList=$correctModel->getCorrectClassList($gpGroupId);
- $Sem=new SSemester();
- $code= $Sem->conn->createQuery()
- ->from('semester')
- ->where("semester_id = '".$this->semesterId."'")
- ->limit(1)
- ->query()
- ->read();
- if($classList){
- foreach ($classList as $key => $item){
- $students=$correctModel->getCorrectStudent($item['gp_id']);
- $studentIds=array();
- $createCount=0;
- $isDownload=0;
- $downloadTime=0;
- foreach ($students as $student){
- $studentIds[]=$student['student_id'];
- if($student['is_create_pdf']==1){
- $createCount++;
- }
- if(!$isDownload && $student['is_download']==1){
- $isDownload=1;
- $downloadTime=$student['download_time'];
- }
- }
- $classList[$key]['create_count']=$createCount;
- $classList[$key]['is_download']=$isDownload;
- $classList[$key]['download_time']=$downloadTime;
- $classList[$key]['order_student_count']=0;
- //订单学生数量
- $intarr=array(
- "schoolId"=>$this->schoolId,
- "clazzId"=>$item['class_id'],
- "semester"=>$code['refer_code'],
- "grade"=>$item['grade'],
- "students"=>$studentIds,
- "examTime"=>$item['create_time'],
- "classify"=>66,
- "subject"=>$this->subjectId
- );
- $basic = imsBasicAuth($this->schoolId.'_'.Yii::app()->session['coachInfo']['coach_name'],Yii::app()->params["zsy_api_key"]);
- $rs = json_decode(Curl::http_post_Basic_json(Yii::app()->params["get_limit_url"], json_encode($intarr),$basic));
- if(!$rs){
- Yii::app()->jump->error("接口错误");
- }
- if($rs->errCode!="00"){
- Yii::app()->jump->error($rs->errMsg);
- }
- if(!empty($rs->data)){
- $classList[$key]['order_student_count']=count($rs->data);
- }
- }
- }
- $data['printList']=$classList;
- $data['type']=66;
- $this->render('class_list',$data);
- }
- /**
- * 学生列表
- */
- public function actionStu()
- {
- $data = array();
- $sname = (string)Req::get("sname"); //学生名字
- $gpId = (string)Req::get("gp_id");
- if (!$gpId) {
- Yii::app()->jump->error('参数错误!');
- }
- //获取班级名称以及产品名称
- $sql = "select g.name,c.class_name,g.class_id,g.create_time,g.semester_id,c.grade from general_product g join class c on g.class_id = c.class_id where g.gp_id = '{$gpId}'";
- $names = $this->sConn->createCommand($sql)->queryRow();
- if (empty($names)) {
- Yii::app()->jump->error('数据错误!');
- }
- $sql = "select student_id,is_create_pdf from general_product_student where gp_id = '{$gpId}'";
- $relateStudent = $this->sConn->createCommand($sql)->queryAll();
- $studentIds = array();
- $stuIsPdf = array();
- if ($relateStudent) {
- foreach ($relateStudent as $studentInfo) {
- $studentIds[] = (string)$studentInfo['student_id'];
- $stuIsPdf[(string)$studentInfo['student_id']] = $studentInfo['is_create_pdf'];
- }
- }
- if ($studentIds) {
- $studentNames = SStudentInfo::model()->getStudentNames($studentIds); //求学生名字
- if ($studentNames) {
- if ($sname) {
- $i = 1;
- foreach ($studentNames as $k => $v) {
- if (strpos($v, $sname) !== false) {
- $data['list'][$i]['stu_id'] = (string)$k;
- $data['list'][$i]['stu_name'] = $v;
- $data['list'][$i]['name'] = $names['class_name'] . $v . $names['name'];
- $data['list'][$i]['is_pdf'] = isset($stuIsPdf[(string)$k]) ? $stuIsPdf[(string)$k] : 0;
- $i++;
- }
- }
- } else {
- $i = 1;
- foreach ($studentNames as $k => $v) {
- $data['list'][$i]['stu_id'] = (string)$k;
- $data['list'][$i]['stu_name'] = $v;
- $data['list'][$i]['name'] = $names['class_name'] . $v . $names['name'];
- $data['list'][$i]['is_pdf'] = isset($stuIsPdf[(string)$k]) ? $stuIsPdf[(string)$k] : 0;
- $i++;
- }
- }
- }
- }
- $Sem = new SSemester();
- $code = $Sem->conn->createQuery()
- ->from('semester')
- ->where("semester_id = '" . $names['semester_id'] . "'")
- ->limit(1)
- ->query()
- ->read();
- $intarr = array(
- "schoolId" => $this->schoolId,
- "clazzId" => $names['class_id'],
- "semester" => $code['refer_code'],
- "grade" => $names['grade'],
- "students" => $studentIds,
- "examTime" => $names['create_time'],
- "classify" => 66,
- "subject" => 3
- );
- $basic = imsBasicAuth($this->schoolId . '_' . Yii::app()->session['coachInfo']['coach_name'], Yii::app()->params["zsy_api_key"]);
- $rs = json_decode(Curl::http_post_Basic_json(Yii::app()->params["get_limit_url"], json_encode($intarr), $basic));
- if (!$rs) {
- Yii::app()->jump->error("接口错误");
- }
- if ($rs->errCode != "00") {
- Yii::app()->jump->error($rs->errMsg);
- }
- if (!empty($rs->data)) {
- $data['limitstu'] = $rs->data;
- }
- $data['gp_id'] = $gpId;
- $data['class_id'] = $names['class_id'];
- $data['sname'] = $sname;
- $data['type'] = ProductDownload::PRODUCT_TYPE_CORRECT;
- $data['printType'] = 'general_product';
- $this->render('stu', $data);
- }
- //加载考试根据时间年级
- public function actionLoadExam(){
- $grade=(int)Req::post('grade');
- $startDate=Req::post('startDate');
- $endDate=Req::post('endDate');
- $condition=array();
- $subject=$this->subjectId;
- // $grade=1;
- // $startDate='2023-01';
- // $endDate='2024-05';
- $condition[]='e.status=1';
- $condition[]="e.semester_id='{$this->semesterId}'";
- $condition[]='e.is_display=0';
- $condition[]='(tw.status=2 or eg.is_third=0)';
- if($subject==3){
- $condition[] = "e.subject_id in (".implode(',',$this->mathSubjectId).")";
- }else{
- $condition[]="e.subject_id ='".$subject."'";
- }
- if($grade){
- $condition[]="c.grade='".$grade."'";
- }
- $result['status']=0;
- if($startDate){
- $startDate=strtotime($startDate);
- $condition[]="e.complete_time>='".$startDate."'";
- }else{
- $result['msg']='请选择开始时间';
- exit(json_encode($result));
- }
- if($endDate){
- $endDate=strtotime($endDate);
- $condition[]="e.complete_time<='".$endDate."'";
- }else{
- $result['msg']='请选择结束时间';
- exit(json_encode($result));
- }
- $sql="SELECT distinct eg.exam_group_id,e.name,c.grade FROM `exam` e ";
- $sql.="join exam_group eg on eg.exam_group_id=e.exam_group_id ";
- $sql.=" left join topic_word tw on tw.exam_group_id=e.exam_group_id ";
- $sql.="join class c on c.class_id=e.class_id ";
- if($condition){
- $sql.=" where ".implode(' and ',$condition);
- }
- $list = $this->sConn->createCommand($sql)->queryAll();
- //
- // if($list){
- // foreach ($list as $key => $val){
- //
- // }
- // }
- $result['status']=1;
- $result['list']=$list;
- exit(json_encode($result));
- }
- public function actionGetclass()
- {
- $grade = Req::post("grade");
- $class_array = array();
- $class_data=array();
- $class_data = ClassModel::model()->findAll('grade=:grade and semester_id=:semester_id and class_type=1',array(':grade' => $grade,':semester_id'=>$this->semesterId));
- if($class_data){
- foreach($class_data as $v )
- {
- $class_array[] = $v->attributes;
- }
- echo json_encode(array('status'=>1,'result'=>$class_array,'subject_name'=>Yii::app()->params['subjectId'][$this->subjectId]));exit;
- }
- echo json_encode(array('status'=>0,'result'=>array()));exit;
- }
- public function actionSaveSetting(){
- $grade=Req::post('grade');
- $classIds=Req::post('classIds');
- $examGroupIds=Req::post('examGroupIds');
- $answerParse=Req::post('answerParse');
- $name=Req::post('name');
- $startDate=Req::post('startDate');
- $endDate=Req::post('endDate');
- $gpGroupId=Req::post('gpGroupId');
- $result['status']=0;
- $result['msg']='';
- $error=array();
- if(!$classIds ){
- $error[]='班级参数异常';
- }
- if(!$examGroupIds ){
- $error[]='考试参数异常';
- }
- if(!$name){
- $error[]='名称参数异常';
- }
- if(!$answerParse){
- $error[]='答案解析参数异常';
- }
- if($error){
- $result['msg']=implode(',',$error);
- exit(json_encode($result));
- }
- $classIds=explode(',',$classIds);
- $examGroupIds=explode(',',$examGroupIds);
- $setting=array(
- 'class_ids'=>$classIds,
- 'exam_group_ids'=>$examGroupIds,
- 'answer_parse'=>$answerParse,
- 'name'=>$name,
- 'grade'=>$grade,
- 'start_date'=>$startDate,
- 'end_date'=>$endDate
- );
- $examRelationStudent=$this->getAllStudentByExamId($examGroupIds);
- if(!$examRelationStudent){
- $result['msg']='考试数据异常';
- exit(json_encode($result));
- }
- $time = time();
- $transaction = $this->sConn->beginTransaction();
- try {
- if($gpGroupId){
- //修改
- $gpList= $this->sConn->createCommand("select gp_id from general_product where gp_group_id='{$gpGroupId}'")->queryAll();
- $gpIds=array();
- if($gpList){
- foreach ($gpList as $item){
- $gpIds[]=$item['gp_id'];
- }
- }
- $this->sConn->createCommand("delete from general_product where gp_group_id='{$gpGroupId}'")->execute();
- $this->sConn->createCommand("delete from general_product_student where gp_id in(".implode(',',$gpIds).")")->execute();
- $groupId=$gpGroupId;
- }else{
- $groupId = getUniqueId($this->schoolId);
- }
- $gpIds = array();
- $noExamClass=array(); //未参加任何考试的班级
- foreach ($classIds as $classId) {
- $classJoinExam=array();
- //获取班级学生
- $classStudent = $this->getStudentIdsByClassId($classId);
- //查询学生参与的考试id
- foreach ($examRelationStudent as $examId => $studentIds){
- if(array_intersect($classStudent,$studentIds)){
- $classJoinExam[]=$examId;
- }
- }
- $extra=array();
- if(!$classJoinExam){
- $noExamClass[]=$classId;
- }else{
- $extra['exam_ids']=$classJoinExam;
- }
- $gpId = getUniqueId($this->schoolId);
- $this->sConn->createCommand()->insert('general_product', array(
- 'gp_id' => $gpId,
- 'gp_group_id' => $groupId,
- 'class_id' => $classId,
- 'grade' => $grade,
- 'name' =>$name,
- 'subject_id' => $this->subjectId,
- 'semester_id' => $this->semesterId,
- 'create_time' => $time,
- 'update_time' => $time,
- 'extra'=>!empty($extra)?jsonEncode($extra):''
- ));
- foreach ($classStudent as $kk => $vv) {
- $this->sConn->createCommand()->insert('general_product_student', array(
- 'gp_id' => $gpId,
- 'student_id' => $vv,
- ));
- }
- array_push($gpIds, $gpId);
- }
- $status=1;
- if($noExamClass){
- $setting['no_exam_class']=$noExamClass;
- $status=5;
- }
- if($gpGroupId){
- $this->sConn->createCommand("update general_product_setting set setting='".jsonEncode($setting)."',update_time='{$time}',status='{$status}' where gp_group_id='{$gpGroupId}'")->execute();
- }else{
- $this->sConn->createCommand()->insert('general_product_setting', array(
- 'gp_group_id' => $groupId,
- 'grade' => $grade,
- 'product_type' => 66,
- 'subject_id' => $this->subjectId,
- 'semester_id' => $this->semesterId,
- 'setting' => jsonEncode($setting),
- 'create_time' => $time,
- 'update_time' => $time,
- 'status'=>$status,
- ));
- }
- //写入数据预处理表
- // $this->conn->createCommand()->insert('xb_data_handle', array(
- // 'gp_group_id' => $groupId,
- // 'school_id' => $this->schoolId,
- // 'class_ids' => explode(',',$classIds),
- // 'exam_group_ids' => explode(',',$examGroupIds),
- // 'create_time' => $time,
- // 'update_time' => $time,
- // ));
- $transaction->commit();
- if(!$noExamClass){
- $kafkaData = array(
- 'school_id' => $this->schoolId,
- 'msg_type' => 1,//90:重置 1:新设置
- 'subject_id' => $this->subjectId,
- 'send_type' => 'error_correct',
- 'product_type' => 66,
- 'gp_group_id' => $groupId,
- 'gp_ids' => $gpIds,
- 'student_ids'=>array(),
- );
- sendDataToKafka("xbkc-php-product-html", $kafkaData);
- }
- $result['status']=1;
- $result['msg']='设置成功';
- } catch (Exception $e) {
- $transaction->rollBack();
- if (YII_ENV == 'production') {
- $result['msg'] = '系统错误[SQL]';
- } else {
- $result['msg'] = $e->getMessage();
- }
- }
- exit(json_encode($result));
- }
- //编辑设置
- public function actionGetDetail(){
- $gpGroupId=Req::post('gpGroupId');
- $result['status']=0;
- $result['msg']='';
- $error=array();
- if(!$gpGroupId){
- $error[]='参数异常';
- }
- $model = new SGeneralProductSetting();
- $setting=$model->getGeneralSetting($gpGroupId);
- if($setting){
- $result['status']=1;
- $jsonData=json_decode($setting,true);
- $data=array(
- 'classIds'=>$jsonData['class_ids'],
- 'examGroupIds'=>$jsonData['exam_group_ids'],
- 'answerParse'=>$jsonData['answer_parse'],
- 'name'=>$jsonData['name'],
- 'grade'=>$jsonData['grade'],
- 'startDate'=>$jsonData['start_date'],
- 'endDate'=>$jsonData['end_date'],
- );
- $result['data']=$data;
- }else{
- $result['msg']='读取设置信息失败';
- }
- exit(json_encode($result));
- }
- //查询所有参加学生
- private function getAllStudentByExamId($examGroupIds){
- $studentRelationExamId=array();
- foreach ($examGroupIds as $examGroupId){
- $examIds=$this->getExamIds($examGroupId);
- if(!$examIds){
- return null;
- }
- $sql="select student_id,exam_id from student_paper_relation where exam_id in(".implode(',',$examIds).") and is_del=0 and is_feedback=1";
- $result = $this->sConn->createCommand($sql)->queryAll();
- if($result){
- foreach ($result as $item){
- $studentRelationExamId[(string)$item['exam_id']][]=$item['student_id'];
- }
- }
- }
- return $studentRelationExamId;
- }
- //读取考试id
- private function getExamIds($examGroupId){
- $sql="select exam_id from exam where exam_group_id='{$examGroupId}'";
- $result = $this->sConn->createCommand($sql)->queryAll();
- $examIds=array();
- if($result){
- foreach ($result as $item){
- $examIds[]=$item['exam_id'];
- }
- }
- return $examIds;
- }
- //读取班级学生
- private function getStudentIdsByClassId($classId){
- $sql="select student_id from student_class_relation where class_id='{$classId}' and status=0";
- $result = $this->sConn->createCommand($sql)->queryAll();
- $studentIds=array();
- if($result){
- foreach ($result as $item){
- $studentIds[]=$item['student_id'];
- }
- }
- return $studentIds;
- }
- //继续生成,删除未参加考试班级
- public function actionProceed(){
- $gpGroupId=Req::post('gpGroupId');
- $result['status']=0;
- $result['msg']='';
- $error=array();
- if(!$gpGroupId){
- $result['msg']='参数异常';
- exit(json_encode($result));
- }
- $sql="select setting from general_product_setting where gp_group_id='{$gpGroupId}' ";
- $setting = $this->sConn->createCommand($sql)->queryRow();
- if(!$setting){
- $result['msg']='参数异常';
- exit(json_encode($result));
- }
- $settingJson=json_decode($setting['setting'],true);
- if(isset($settingJson['no_exam_class']) && $settingJson['no_exam_class']){
- if(count($settingJson['no_exam_class'])==count($settingJson['class_ids'])){
- $result['msg']='没有符合生成条件的班级不能继续生成';
- exit(json_encode($result));
- }
- $transaction = $this->sConn->beginTransaction();
- try {
- $gpIds=array();
- $allGp=$this->sConn->createCommand("select gp_id from general_product where gp_group_id='{$gpGroupId}' and class_id in(".implode(',',$settingJson['no_exam_class']).")")->queryAll();
- if($allGp){
- foreach ($allGp as $item){
- $gpIds[]=$item['gp_id'];
- }
- }else{
- $result['msg']='没有符合生成条件的班级不能继续生成';
- exit(json_encode($result));
- }
- $deleteClassSql="delete from general_product where gp_id in(".implode(',',$gpIds).")";
- $deleteStudentSql="delete from general_product_student where gp_id in(".implode(',',$gpIds).")";
- $this->sConn->createCommand($deleteClassSql)->execute();
- $this->sConn->createCommand($deleteStudentSql)->execute();
- $this->sConn->createCommand("update general_product_setting set status=1 where gp_group_id='{$gpGroupId}' ")->execute();
- $restGpIds=array();
- $allGp=$this->sConn->createCommand("select gp_id from general_product where gp_group_id='{$gpGroupId}' and class_id not in(".implode(',',$settingJson['no_exam_class']).")")->queryAll();
- foreach ($allGp as $item){
- $restGpIds[]=$item['gp_id'];
- }
- $transaction->commit();
- $result['status']=1;
- $kafkaData = array(
- 'school_id' => $this->schoolId,
- 'msg_type' => 1,//90:重置 1:新设置
- 'subject_id' => $this->subjectId,
- 'send_type' => 'error_correct',
- 'product_type' => 66,
- 'gp_group_id' => $gpGroupId,
- 'gp_ids' => $restGpIds,
- 'student_ids'=>array(),
- );
- sendDataToKafka("xbkc-php-product-html", $kafkaData);
- } catch (Exception $e) {
- $transaction->rollBack();
- if (YII_ENV == 'production') {
- $error[] = '系统错误[SQL]';
- } else {
- $error[] = $e->getMessage();
- }
- $result['msg']=implode(',',$error);
- }
- }else{
- $result['msg']='班级设置数据异常,未参与考试班级数据为空';
- }
- exit(json_encode($result));
- }
- //班级重置页面
- public function actionResetClass()
- {
- $groupId = Req::get('gp_group_id');
- $name = Req::get('name');
- if (empty($groupId) || empty($name)) {
- Yii::app()->jump->error('参数异常');
- }
- $newCondition[] = 'g.gp_group_id=' . $groupId;
- $model = new SGeneralProductSetting();
- $rs = $model->getList($newCondition, array('g.create_time desc'), 100);
- if (!isset($rs['rs'])) {
- Yii::app()->jump->error('获取班级数据失败');
- }
- $resetTotal=3;//学管重置总次数
- foreach($rs['rs'] as $key=>$item){
- //学管剩余重置次数
- $item['learn_tube_reset_residue_count']=$resetTotal>$item['learn_tube_reset_count']?$resetTotal-$item['learn_tube_reset_count']:0;
- //学管30分钟内只能重置一次
- $item['is_cool_down']=time()-$item['learn_tube_reset_time']<=1800?0:1;
- //冷却文字提示 30分钟内并且剩余次数大于0
- $item['is_cool_down_prompt']=!$item['is_cool_down'] && $item['learn_tube_reset_residue_count']?true:false;
- $rs['rs'][$key]=$item;
- }
- //是不是技术支持
- $isTechnicalSupport=1;
- if(!isset(Yii::app()->session['testFlag']) || Yii::app()->session['testFlag']!=1 ){
- $isTechnicalSupport=0;
- }
- $data['resultList'] = $rs['rs'];
- $data['productName'] = $name;
- $data['currentWeek'] = date('W');
- $data['is_technical_support']=$isTechnicalSupport;
- $this->render('reset', $data);
- }
- //重置操作
- public function actionReset()
- {
- $gpIds = Req::post('classExam');
- if (!$gpIds || !is_array($gpIds)) {
- echo json_encode(array("status" => 0, "message" => "参数错误!"));
- exit;
- }
- $transaction = $this->sConn->beginTransaction();
- try {
- $gpIdsStr=implode(',',$gpIds);
- $sql="select gp_id,reset_times,learn_tube_reset_count from general_product where gp_id in ({$gpIdsStr})";
- $generalProducts=$this->sConn->createCommand($sql)->queryAll();
- $learnTubeResetCounts=_array_column($generalProducts,'learn_tube_reset_count','gp_id');
- foreach ($gpIds as $gpId) {
- $this->sConn->createCommand()->update("general_product_student", array(
- 'is_create_html' => 90,
- 'is_create_pdf' => 90,
- 'is_download' => 0,
- 'pdf_page_num' => 0,
- 'pdf_sheet_num' => 0,), "gp_id = '{$gpId}'");
- if(!isset(Yii::app()->session['testFlag']) || Yii::app()->session['testFlag']!=1 ) {
- if(!isset($learnTubeResetCounts[$gpId])){
- continue;
- }
- $learnTubeResetCount=$learnTubeResetCounts[$gpId]+1;
- $this->sConn->createCommand()->update("general_product", array('reset_times' => new CDbExpression('reset_times+1'),'learn_tube_reset_count'=>$learnTubeResetCount,'learn_tube_reset_time'=>time()), "gp_id = '{$gpId}'");
- }else{
- $this->sConn->createCommand()->update("general_product", array('reset_times' => new CDbExpression('reset_times+1')), "gp_id = '{$gpId}'");
- }
- }
- //发送消息
- $groupModel = SGeneralProduct::model()->find('gp_id=:gp_id',array('gp_id'=>$gpIds[0]));
- if(!$groupModel){
- echo json_encode(array("status" => 0, "message" => "数据异常!"));
- exit;
- }
- // setting更新补提信息
- $this->sConn->createCommand()->update("general_product_setting", array('status' =>1), "gp_group_id = '{$groupModel['gp_group_id']}'");
- $sendMsg=array(
- 'school_id'=>$this->schoolId,
- 'msg_type'=>90,
- 'subject_id'=>$this->subjectId,
- 'send_type'=>'error_correct',
- 'product_type'=>66,
- 'gp_group_id'=>$groupModel['gp_group_id'],
- 'gp_ids'=>$gpIds
- );
- $transaction->commit();
- sendDataToKafka('xbkc-php-product-html',$sendMsg);
- } catch (\Exception $e) {
- $transaction->rollBack();
- echo json_encode(array('status' => 0, 'message' => $e->getMessage()));
- exit;
- }
- echo json_encode(array('status' => 1));
- exit;
- }
- }
|