authUsername); $response = formatResponse($http); if ($response['status']) { $coachStatus = $response['data']['status']; }else{ Yii::app()->jump->error($response['data']); } $this->render('index',array('coachStatus'=>$coachStatus)); } /** * 产品试用规则 */ public function actionTrial() { $result = array(); //当前赛季 $http = http('sys/school/year/current', 'GET', $this->authUsername); $response = formatResponse($http); //debug($response); $data = $response['data']; if ($response['status']) { if ($data) { $result['seasonName'] = $data['periodName'].$data['semesterName']; $result['startDate'] = date('Y年m月d日', strtotime($data['semesterBeginTime'])); $result['endDate'] = date('Y年m月d日', strtotime($data['semesterEndTime'])); $result['examNum'] = $data['examNum']; $result['trialNum'] = $data['trialNum']; $result['seasonId'] = $data['seasonId']; } } else { Yii::app()->jump->error($data); } $this->render('trial', $result); } /** * @return array * 获取当前赛季信息 */ public function getCurrentSeason() { $result = array(); $http = http('sys/school/year/current', 'GET', $this->authUsername); $response = formatResponse($http); $data = $response['data']; if ($response['status']) { if ($data) { // $result['seasonName'] = $data['seasonName']; // $result['startDate'] = date('Y年m月', strtotime($data['beginTime'])); // $result['endDate'] = date('Y年m月', strtotime($data['endTime'])); // $result['examNum'] = $data['examNum']; $result['schoolYearId'] = $data['schoolYearId']; $result['semesterId'] = $data['semesterId']; } } return $result; } /** * 产品试用列表 */ public function actionTrialTable() { $params = array(); $result = array(); $seasonId = Req::get('seasonId'); $result['seasonName'] = Req::get('seasonName'); $result['seasonId'] = $seasonId; $page = Req::get('page') ? Req::get('page') : 1; if(Req::get('seasonId')){ $arr=explode('_',Req::get('seasonId')); $params['schoolYearId'] = $arr[0]; $params['semesterId'] = $arr[1]; } if (Req::get('goodsTypeId')) { $params['goodsTypeId'] = Req::get('goodsTypeId'); } if (Req::get('grade')) { $params['grade'] = Req::get('grade'); } if (Req::get('clazzId')) { $params['clazzId'] = Req::get('clazzId'); } if (Req::get('subject')) { $params['subject'] = Req::get('subject'); } //获取产品 $goodArr = $this->getGoodType(); $result['goodList'] = $goodArr; //获取赛季列表 $seasonList = $this->getEnableImsSemester(); $result['seasonList'] = $seasonList; $http = http('order/coach/trials/' . $page, 'POST', $this->authUsername, $params); $response = formatResponse($http); $data = $response['data']; if ($response['status']) { $result['page'] = $data; $result['list'] = isset($data['list'])?$data['list']:array(); } else { $result['page'] = array(); $result['list'] = array(); } if(isset(Yii::app()->params['subjectId']) && Yii::app()->params['subjectId']){ $result['subject']=Yii::app()->params['subjectId']; unset($result['subject'][6]); if(isset($result['subject'][20])) unset($result['subject'][20]); } // debug($result); return $this->render('trialTable', $result); } /* * 读取试用订单日志 * */ public function actionGetOrderLog(){ $orderId = Req::post('orderId'); $result['status']=0; if(!$orderId){ exit(json_encode($result)); } //请求日志 $log = http('order/coach/trial/detail/'.$orderId, 'get', $this->authUsername, array()); $logList=formatResponse($log); if(isset($logList['data']['orderLogs'])){ $result['data']=$logList['data']['orderLogs']; }else{ $result['data']=array(); } $result['status']=1; exit(json_encode($result)); } /** * 申请延长订单 */ public function actionRelayTrial() { $orderId = Req::post('orderId'); $http = http('order/coach/trial/delay/'.$orderId,'put', $this->authUsername); $response = formatResponse($http); $this->imsLog("试用订单-申请延长",'order/coach/trial/delay/'.$orderId,array(),$response); if ($response['status']){ $data = $response['data']; $needApply = isset($data['needApply'])?$data['needApply']:0; $delayDay = isset($data['delayDay'])?$data['delayDay']:0; if($needApply){ $msg = "将延长试用".$delayDay."天,已通知后台审批"; }else{ $msg = "将延长试用".$delayDay."天,本次申请无需审批"; } returnMsg(1,$msg); }else{ returnMsg(0,$response['data']); } } /** * 开通产品试用列表 */ public function actionDoTrial() { //读取科目 //$http = http('dictionary/coach/list/active-type/subject', 'get', $this->authUsername); $params=array(); $params['onlyTrial']=1; $params['learningStage']=Yii::app()->params['section']; $http = http('goods-type/coach', 'get', $this->authUsername,$params); $response = formatResponse($http); $subjects=array(); $goodArr=array(); $schoolYear=0; if(isset($response['data']) && $response['status']==1){ foreach ($response['data'] as $datum){ $subjects[$datum['goodsTypeId']]=$datum['subjects']; $goodArr[]=array( 'goodsTypeId'=> $datum['goodsTypeId'], 'goodsTypeName'=> $datum['goodsTypeName'], ); if(!$schoolYear){ $schoolYear=$datum['schoolYear']; } } } if(!$schoolYear){ Yii::app()->jump->error("获取学年异常"); } //年级对应实际年级 $semester=$this->schoolManager->getSemester($this->semesterId); $nowSemesterSchoolYear=$semester['school_year']; if(Yii::app()->params['section']!=0){ if(strpos($semester['semester_name'],'上学期')!==false){ $grade[1]=intval($schoolYear-($nowSemesterSchoolYear-1+1)); $grade[2]=intval($schoolYear-($nowSemesterSchoolYear-2+1)); $grade[3]=intval($schoolYear-($nowSemesterSchoolYear-3+1)); }elseif(strpos($semester['semester_name'],'下学期')!==false || strpos($semester['semester_name'],'暑假')!==false || strpos($semester['semester_name'],'寒假')!==false){ $grade[1]=intval($schoolYear-($nowSemesterSchoolYear-1)); $grade[2]=intval($schoolYear-($nowSemesterSchoolYear-2)); $grade[3]=intval($schoolYear-($nowSemesterSchoolYear-3)); } }else{ if(strpos($semester['semester_name'],'上学期')!==false){ $grade[7]=intval($schoolYear-($nowSemesterSchoolYear-7+1)); $grade[8]=intval($schoolYear-($nowSemesterSchoolYear-8+1)); $grade[9]=intval($schoolYear-($nowSemesterSchoolYear-9+1)); }elseif(strpos($semester['semester_name'],'下学期')!==false || strpos($semester['semester_name'],'暑假')!==false || strpos($semester['semester_name'],'寒假')!==false){ $grade[7]=intval($schoolYear-($nowSemesterSchoolYear-7)); $grade[8]=intval($schoolYear-($nowSemesterSchoolYear-8)); $grade[9]=intval($schoolYear-($nowSemesterSchoolYear-9)); } } if(Yii::app()->params['grade_list']){ foreach (Yii::app()->params['grade_list'] as $id =>$param){ $gradeName[$id]=$param['grade_name']; } } $result = array(); //获取产品 $result['goodList'] = $goodArr; $result['selectedStudent'] = array(); $result['subjects']=$subjects; $result['grade']=$grade; $result['gradeName']=$gradeName; $this->render('doTrial', $result); } /** * 编辑产品试用列表 */ public function actionEditTrial() { $result = array(); //获取产品 $goodArr = $this->getGoodType(); $result['goodList'] = $goodArr; //获取已经提交的数据 $orderId = Req::get('orderId'); $orderDetail = $this->getTrialOrderDetail($orderId); if(empty($orderDetail)){ Yii::app()->jump->error("获取订单详情异常"); } $result['grade'] = $orderDetail['grade']; $result['goodsTypeId'] = $orderDetail['goodsTypeId']; $result['startDate'] = $orderDetail['startDate']; //已经试用人数 $http = http('order/coach/trial/students/'.$orderId, 'get', $this->authUsername); $response = formatResponse($http); $result['selectedStudent'] = $response['data']; $this->render('editTrial', $result); } /** * 提交试用订单(重新提交) */ public function actionSaveTrial() { $studentIdArr = Req::post('studentList'); $params['beginTime'] = Req::post('startTime'); $params['grade'] = Req::post('grade'); $params['goodsTypeId'] = Req::post('goodsTypeId'); $params['subject'] = Req::post('subjectId'); $params['trialType'] = Req::post('trialType'); $params['yearSemester'] = Req::post('yearSemester'); //$params['firstMarkTime'] = Req::post('endTime'); $studentIdArr=str_replace('"','"',$studentIdArr); @$studentIdArr=json_decode($studentIdArr,true); $students = array(); if(!$studentIdArr){ returnMsg(0,'学生数据解析失败'); } foreach ($studentIdArr as $k=>$v){ if(!$v['class'] || !$v['classId'] || !$v['value'] || !$v['name']){ continue; } $students[$k]['studentName'] = $v['name']; $students[$k]['studentId'] = $v['value']; $students[$k]['clazzName'] = $v['class']; $students[$k]['clazzId'] = $v['classId']; } $params['students'] = $students; if (Req::post('orderId')){ $params['orderId'] = Req::post('orderId'); $http = http('order/coach/trial','put', $this->authUsername, $params); }else{ $http = http('order/coach/trial','post', $this->authUsername, $params); } $response = formatResponse($http); $this->imsLog("试用订单-提交",'order/coach/trial',$params,$response); if($response['status']){ returnMsg(1,$response['data']); }else{ if(Yii::app()->params['handle_log_on_off']) { writeFileLog(jsonEncode(array( "exam_group_id" => 0, "operate_project" => 'zsyas2', "school_id" => $this->schoolId, "title" => '创建试用订单失败', "operate_account" => Yii::app()->session['coachInfo']['coach_name'], "operate_method" => $this->action, "operate_url" => $this->getRoute(), "operate_sql" =>'', "operate_param" =>json_encode(array('post'=>$_POST,'get'=>$_GET,'param'=>$params)), "date"=>date('Y-m-d H:i:s') ))); } returnMsg(0,$response['data']); } } /** * @return null|string|string[] * 试用人数列表 */ public function actionTrialStudent() { $result = array(); if (Req::get('orderId')){ $orderId = Req::get('orderId'); $page = Req::get('page')?Req::get('page'):1; $http = http('order/coach/trial/students/'.$orderId.'/'.$page, 'get', $this->authUsername); $responseArr = formatResponse($http); if($responseArr['status']){ $result['page'] = $responseArr['data']; $result['list'] = $responseArr['data']['list']; } //订单详情 $goodsDetail = $this->getTrialOrderDetail($orderId); if(empty($goodsDetail)){ Yii::app()->jump->error("获取订单详情异常"); } //判断是否可以开启试用 $http=http('order-trial-enable/coach/can-apply/'.$orderId, 'get', $this->authUsername); $responseArr = formatResponse($http); $result['canOpen']=0; $result['errMsg']=''; if($responseArr['status']){ $result['canOpen']=$responseArr['data']; }else{ $result['errMsg']=$responseArr['data']; } $result['goodDetail'] = $goodsDetail; $result['orderId']=$orderId; }else{ Yii::app()->jump->error("订单id必须;"); } $this->render('trialStudent', $result); } //请求暂停、开启班级列表 public function actionGetClassesByOrderId(){ $orderId=Req::post('orderId'); $type=Req::post('type'); $result['status']=0; //读取班级列表 $http = http('order/coach/all/clazz/by/'.$orderId.'/'.$type, 'get', $this->authUsername); $responseArr = formatResponse($http); if($responseArr['status']==1){ $result=$responseArr; $result['students']=array(); //读取学生列表 if($result['data']){ $classId=$result['data'][0]['clazzId']; $studentHttp= http('order/coach/all/student/by/'.$orderId.'/'.$classId.'/'.$type, 'get', $this->authUsername); $students=formatResponse($studentHttp); if($students['status']==1){ $result['students']=$students['data']; } } } exit(json_encode($result)); } //读取开启、暂停学生列表 public function actionGetStudentByClassIdOrderId(){ $orderId=Req::post('orderId'); $type=Req::post('type'); $classId=Req::post('classId'); $result['status']=0; $studentHttp= http('order/coach/all/student/by/'.$orderId.'/'.$classId.'/'.$type, 'get', $this->authUsername); $students=formatResponse($studentHttp); if($students['status']==1){ $result['status']=1; $result['data']=$students['data']; } exit(json_encode($result)); } //开启、暂停学生订单 public function actionDoStudentOrder(){ $orderId=Req::post('orderId'); $type=Req::post('type'); $reason=Req::post('reason'); $students=Req::post('selectedDataValue'); $result['status']=0; $params=$students; if($type==0){ $http= http('order/coach/suspend/'.$orderId, 'post', $this->authUsername,$params); }else{ $params=array( 'otId'=>$orderId, 'osIds'=>$students, 'reason'=>$reason ); $http= http('order-trial-enable/coach', 'post', $this->authUsername,$params); // $http= http('order/coach/enable/'.$orderId, 'post', $this->authUsername,$params); } $students=formatResponse($http); if($students['status']==1){ $result['status']=1; } exit(json_encode($result)); } public function getTrialOrderDetail($orderId) { $result = array(); $http = http('order/coach/trial/detail/'.$orderId,'get', $this->authUsername); $response = formatResponse($http); if ($response['status']){ $data = $response['data']; $result['goodsTypeName'] = $data['orderGoods']['goodsTypeName']; $result['gradeName'] = $data['gradeName']; $result['date'] = $data['beginTime'].' ~ '.$data['endTime']; $result['status'] = $data['trialStatusName']; $result['grade'] = $data['grade']; $result['goodsTypeId'] = $data['orderGoods']['goodsTypeId']; $result['startDate'] = $data['beginTime']; $result['enableNum'] = $data['enableNum']; } return $result; } /** * 正式订单列表 */ public function actionOfficialTable() { $page = Req::get('page')?Req::get('page'):1; $result = array(); $params = array(); if(Req::get('goodsId')){ $params['goodsId'] = Req::get('goodsId'); } if(Req::get('packageId')){ $params['packageId'] = Req::get('packageId'); } if(Req::get('status')){ $params['status'] = Req::get('status')-1; } if(Req::get('orderType')){ $params['orderType'] = Req::get('orderType')-1; } //获取产品 $goodArr = $this->getGood(); $result['goodList'] = $goodArr; //获取审核字典 $dict = $this->getDict('process_apply_status'); $result['applyStatus'] = $dict; $http = http('order/coach/officials/'.$page, 'POST', $this->authUsername, $params); $response = formatResponse($http); $data = $response['data']; if($response['status']){ $result['page'] = $data; $result['list'] = isset($data['list'])?$data['list']:array(); }else{ $result['page'] = array(); $result['list'] = array(); } // debug($result); $this->render('officialTable', $result); } /** * @return string * 订购页面 */ public function actionOrderOfficial() { $orderId = Req::get('orderId'); $goodDetail = $this->getOfficialOrderDetail($orderId); $this->render('orderOfficial', array('orderId'=>$orderId,'goodDetail'=>$goodDetail)); } /** * 提交订购 */ public function actionSaveOfficial() { $studentIdArr = Req::post('studentList'); $params['orderId'] = Req::post('orderId'); $students = array(); foreach ($studentIdArr as $k=>$v){ $value = explode('#',$v); if(count($value)==4){ $students[$k]['studentName'] = trim($value[0]); $students[$k]['studentId'] = trim($value[1]); $students[$k]['clazzName'] = trim($value[2]); $students[$k]['clazzId'] = trim($value[3]); } } $params['students'] = $students; $http = http('order/coach/official/students','post', $this->authUsername, $params); $response = formatResponse($http); $this->imsLog("正式订单-订购",'order/coach/trial',$params,$response); if($response['status']){ returnMsg(1,'提交成功'); }else{ returnMsg(0,$response['data']); } } /** * 正式订单 催办 */ public function actionUrge() { $params = array( 'userId'=> $this->coachId, 'businessKey'=> Req::post('businessKey'), 'smeDesc'=> Req::post('smeDesc'), ); $http = http('message/coach/urge', 'post', $this->authUsername, $params); $response = formatResponse($http); $this->imsLog("正式订单-催办",'message/coach/urge',$params,$response); if ($response['status']){ returnMsg(1, '提交成功!'); }else{ returnMsg(0, $response['data']); } } /** * 正式订单取消 */ public function actionStop() { $businessKey = Req::post('businessKey'); $title = Req::post('title'); $http = http('activiti/coach/process-instances/'.$businessKey.'/suspended', 'put', $this->authUsername); $response = formatResponse($http); $this->imsLog($title,'activiti/coach/process-instances/'.$businessKey.'/suspended',array(),$response); if ($response['status']){ returnMsg(1, '提交成功!'); }else{ returnMsg(0, $response['data']); } } /** * 正式订单删除 */ public function actionDelete() { $businessKey = Req::post('businessKey'); $title = Req::post('title'); $http = http('activiti/coach/process-instances/'.$businessKey, 'delete', $this->authUsername); $response = formatResponse($http); $this->imsLog($title,'activiti/coach/process-instances/'.$businessKey,array(),$response); if ($response['status']){ returnMsg(1, '提交成功!'); }else{ returnMsg(0, $response['data']); } } /** * @return string * 明细订单 */ public function actionDetailOrder() { $params = array(); $page = Req::get('page')?Req::get('page'):1; if (Req::get('orderNo')){ $params['orderOfficialNo'] = Req::get('orderNo'); } if (Req::get('orderOfficialNo')){ $params['orderOfficialNo'] = Req::get('orderOfficialNo'); } if(Req::get('goodsId')){ $params['goodsId'] = Req::get('goodsId'); } if(Req::get('packageId')){ $params['packageId'] = Req::get('packageId'); } if(Req::get('useStatus')){ $params['useStatus'] = Req::get('useStatus')-1; } if(Req::get('payStatus')){ $params['payStatus'] = Req::get('payStatus')-1; } if(Req::get('takeStatus')){ $params['takeStatus'] = Req::get('takeStatus')-1; } if(Req::get('studentName') && Req::get('studentName')!=''){ $params['studentName'] = Req::get('studentName'); } if(Req::get('orderTypes')){ $params['orderType'] = Req::get('orderTypes')-1; } if(Req::get('semesterTypes')){ $params['semester'] = Req::get('semesterTypes')-1; } if(Req::get('schoolYearName') && Req::get('schoolYearName')!=''){ $params['schoolYearId'] = Req::get('schoolYearName'); } if(Req::get('className') && Req::get('className')!=''){ $params['clazzName'] = Req::get('className'); } if(Req::get('beginTime') && Req::get('beginTime')!=''){ $params['beginTime'] = date('Y-m-d H:i:s',strtotime(Req::get('beginTime'))); } if(Req::get('endTime') && Req::get('endTime')!=''){ $params['endTime'] = date('Y-m-d 23:59:59',strtotime(Req::get('endTime'))); } //获取产品 $goodArr = $this->getGood(); $result['goodList'] = $goodArr; //获取学年 $http = http('sys/school/year/period/list', 'get', $this->authUsername); $response = formatResponse($http); $result['schoolYear'] = $response['data']; // debug($params); $http = http('order/coach/official/details/'.$page,'post', $this->authUsername, $params); $response = formatResponse($http); $data = $response['data']; if($response['status']){ $result['page'] = $data; $result['list'] = $data['list']; }else{ $result['page'] = array(); $result['list'] = array(); } $this->render('detailOrder', $result); } /** * @return string * 意向订单 */ public function actionPurposeTable() { $result = array(); $params = array(); $page = Req::get('page')?Req::get('page'):1; if(Req::get('schoolYearId')){ $params['schoolYearId'] = Req::get('schoolYearId'); } if(Req::get('goodsId')){ $params['goodsId'] = Req::get('goodsId'); } if(Req::get('beginTime')){ $params['beginTime'] = Req::get('beginTime'); } if(Req::get('endTime')){ $params['endTime'] = Req::get('endTime'); } if(Req::get('purposeOrderNo')){ $params['orderNo'] = Req::get('purposeOrderNo'); } //获取学年 $http = http('sys/school/year/period/list', 'get', $this->authUsername, $params); $response = formatResponse($http); $result['schoolYear'] = $response['data']; //获取产品 $goodArr = $this->getGood(); $result['goodList'] = $goodArr; $http = http('order/coach/purposes/'.$page, 'post', $this->authUsername, $params); $response = formatResponse($http); $data = $response['data']; if($response['status']){ $result['page'] = $data; $result['list'] = $data['list']; }else{ $result['page'] = array(); $result['list'] = array(); } //debug($result); $this->render('purposeTable', $result); } /** * 意向订单转正式订单 */ public function actionToOfficial() { $params = array(); if(Req::post('orderId')){ $params['orderId'] = Req::post('orderId'); }else{ returnMsg(0,'orderId必须'); } if(Req::post('officialNum')){ $params['officialNum'] = Req::post('officialNum'); }else{ returnMsg(0,'officialNum必须'); } $http = http('order/coach/purpose/to/official', 'post', $this->authUsername, $params); $response = formatResponse($http); $this->imsLog("意向订单-转正式订单",'order/coach/purpose/to/official',$params,$response); if ($response['status']){ returnMsg(1,'操作成功'); }else{ returnMsg(0,$response['data']); } } /** * 意向订单转正式订单(重新提交) */ public function actionReToOfficial() { $params = array(); if(Req::post('orderId')){ $params['orderOfficialId'] = Req::post('orderId'); }else{ returnMsg(0,'orderId必须'); } if(Req::post('officialNum')){ $params['officialNum'] = Req::post('officialNum'); }else{ returnMsg(0,'officialNum必须'); } $http = http('order/coach/purpose/re-to/official', 'post', $this->authUsername, $params); $response = formatResponse($http); $this->imsLog("意向订单-重新提交",'order/coach/purpose/re-to/official',$params,$response); if ($response['status']){ returnMsg(1,'操作成功'); }else{ returnMsg(0,$response['data']); } } /** * @return array * 获取订单详情-正式订单 */ public function getOfficialOrderDetail($orderId) { $result = array(); $useDates = array(); $http = http('order/coach/official/detail/'.$orderId,'get', $this->authUsername); $response = formatResponse($http); if ($response['status']){ $data = $response['data']; $useDateArr = $data['orderGoods']['goodsPackageTimes']; foreach ($useDateArr as $k=>$v){ $useDates[] = $v['timeName']; } $result['goodName'] = $data['orderGoods']['goodsName']; $result['packageName'] = $data['orderGoods']['goodsPackageName']; $result['useDate'] = implode(',',$useDates); $result['grade'] = $data['grade']; } return $result; } /** * 获取班级列表 */ public function actionGetClassList() { if (Req::post('grade')) { $grade = Req::post('grade'); } else { $grade = 1; } $subjectId=Req::post('subjectId'); $coachId = $this->coachId; $semesterId = $this->semesterId; $condition = "semester_id={$semesterId} AND grade={$grade} "; //判断是否开通走班 if($subjectId){ $classified=$this->schoolManager->getClassifiedBySubject($grade,$subjectId,$semesterId); if(!$classified || $classified['status']==0){ $condition = "semester_id={$semesterId} AND grade={$grade} and class_type=1 "; }else{ $condition = "semester_id={$semesterId} AND grade={$grade} and class_type=2 "; } }else{ $condition = "semester_id={$semesterId} AND grade={$grade} "; } $select = 'class_id,class_name'; $classList = SClass::model()->getClassList($select, $condition); if ($classList) { returnMsg(1, 'success', $classList); } else { returnMsg(0, '暂无数据'); } } /** * 获取班级列表 */ public function actionGetClassListForClassifed() { if (Req::post('grade')) { $grade = Req::post('grade'); } else { $grade = 1; } $subject=Req::post('subject'); $coachId = $this->coachId; $semesterId = $this->semesterId; if(!$subject){ //读取走班设置 $result=array(); $subjects=array(); $classified=$this->sConn->createCommand("select subject_id from classified where grade='{$grade}' and semester_id='{$semesterId}' and status=1")->queryAll(); if($classified){ foreach ($classified as $val){ $subjects[]=array( 'id'=>$val['subject_id'], 'name'=>Yii::app()->params['subjectId'][$val['subject_id']] ); } } $result['subjects']=$subjects; $condition = "semester_id={$semesterId} AND grade={$grade} and class_type=1"; $select = 'class_id,class_name'; $classList = SClass::model()->getClassList($select, $condition); $result['classList']=$classList; if ($result) { returnMsg(1, 'success', $result); } else { returnMsg(0, '暂无数据'); } }else{ //读取走班学科班级 $classData=$this->sConn->createCommand("select c.class_id,class_name from class c join class_subject_relation csr on c.class_id=csr.class_id where csr.subject_id='{$subject}' and c.class_type=2 and grade='{$grade}'")->queryAll(); if($classData){ returnMsg(1, 'success', $classData); }else{ returnMsg(0, '暂无数据'); } } } /** * 获取学生信息 */ public function actionGetStudent() { $result = array(); $students = array(); if (Req::post('classId')) { $classId = Req::post('classId'); } else { returnMsg(0, 'classId必须'); } $subjectId = Req::post('subjectId'); if(!$subjectId){ returnMsg(0, 'subjectId必须'); } $studentName=Req::post('studentName'); $trialType=Req::post('trialType'); $semesterId=Req::post('semesterId'); $grade=Req::post('grade'); $startTime=Req::post('startTime'); if($trialType==-1){ returnMsg(0, '试用订单类型必须'); } $studentIds=array(); $list = SStudentClassRelation::model()->getStudentInfoByClassId($classId,$studentName); if($list){ foreach ($list as $val){ $studentIds[]=$val['student_id']; } } //获取本赛季已经开通的学生(页面需要 disabled) $currSeason = $this->getCurrentSeason(); $studentArr = $this->getTrialStudentByStudentList($semesterId,$currSeason['schoolYearId'], Req::post('goodsTypeId'),$classId,$subjectId,$studentIds,$trialType,$grade,$startTime,$currSeason['semesterId']); if ($studentArr){ foreach ($studentArr as $k=>$v) { $students[] = $v['studentId']; } } arrayMsort($list,'realname'); if ($list) { $result['list'] = $list; $result['student'] = $students; returnMsg(1, 'success', $result); } else { returnMsg(0, '暂无数据'); } } /** * 获取学生信息(正式订单) */ public function actionGetOfficialStudent() { $result = array(); $students = array(); if (Req::post('classId')) { $classId = Req::post('classId'); } else { returnMsg(0, 'classId必须'); } $list = SStudentClassRelation::model()->getStudentInfoByClassId($classId); //获取本赛季已经开通的学生 $studentArr = $this->getOfficialStudent(Req::post('orderId'), $classId); if ($studentArr){ foreach ($studentArr as $k=>$v) { $students[] = $v['studentId']; } } if ($list) { $result['list'] = $list; $result['student'] = $students; returnMsg(1, 'success', $result); } else { returnMsg(0, '暂无数据'); } } /** * @return array * 获取商品 */ public function getGood() { $result = array(); $http = http('goods/up/list?schoolId='.$this->schoolId, 'get', $this->authUsername); $response = formatResponse($http); if($response['status']){ $result = $response['data']; } return $result; } /** * @param $seasonId * @param $goodsTypeId * @param $classId * @return array * 获取已经订购的学生(意向订单) */ public function getTrialStudent($semesterId,$schoolYearId, $goodsTypeId, $classId,$subjectId) { $http = http('order/coach/trial/'.$schoolYearId.'/'.$semesterId.'/'.$goodsTypeId.'/'.$classId.'/'.$subjectId.'/students', 'get', $this->authUsername); $response = formatResponse($http); if($response['status']){ return $response['data']; }else{ return array(); } } /** * @param $seasonId * @param $goodsTypeId * @param $classId * @return array * 获取已经订购的学生(正式订单) */ public function getOfficialStudent($orderId, $classId) { $http = http('order/coach/official/'.$orderId.'/'.$classId.'/students', 'get', $this->authUsername); $response = formatResponse($http); if($response['status']){ return $response['data']; }else{ return array(); } } /** * 获取字典 */ public function getDict($codeType) { $result = array(); $http = http('dictionary/list/type-code/'.$codeType, 'get', $this->authUsername); $response = formatResponse($http); if ($response['status']){ $result = $response['data']; } return $result; } /** * 获取所有启用的销售赛季 */ public function getEnableSeason() { $result = array(); $http = http('sales-season/enables', 'get', $this->authUsername); $response = formatResponse($http); if ($response['status']){ $result = $response['data']; } return $result; } /** * 获取所有启用的销售学期 */ public function getEnableImsSemester() { $result = array(); $http = http('sys/school/year/semester/list', 'get', $this->authUsername); $response = formatResponse($http); if ($response['status']){ $result = $response['data']; } return $result; } /** * @return array * 获取商品类别 */ public function getGoodType() { $result = array( array( 'goodsTypeId'=> 1, 'goodsTypeName'=> '错题本' ), array( 'goodsTypeId'=> 2, 'goodsTypeName'=> '个性化学习方案' ), array( 'goodsTypeId'=> 3, 'goodsTypeName'=> '个性化学习宝' ), ); return $result; } /** * @return array * 获取套餐 */ public function actionGetPackages() { $goodsId = Req::post('goodsId'); $http = http('goods/packages/'.$goodsId, 'GET', $this->authUsername); $response = formatResponse($http); if ($response['status']){ returnMsg(1,'success', $response['data']); }else{ returnMsg(0, $response['data']); } } /** * 确认收货提示 */ public function actionConfirmWaning(){ $msg = ''; $hasMessage=0; //收货提醒 $http = http('storage-allocate/coach/warning', 'GET', $this->authUsername); $response = formatResponse($http); if($response['status'] && $response['data']){ $hasMessage=1; $url = Yii::app()->createUrl('imsStore/allocation'); $msg .= ''; } //清洁提醒 $http = http('equip/plan/coach/cleanCommitWarning', 'GET', $this->authUsername); $response1 = formatResponse($http); if($response1['status'] && $response1['data']){ $hasMessage=1; $url = Yii::app()->createUrl('imsDevice/taskClean'); $msg .= ''; } //发货提醒 $http = http('storage-allocate/coach/deliverWarning', 'GET', $this->authUsername); $response2 = formatResponse($http); if($response2['status'] && $response2['data']){ $hasMessage=1; $url = Yii::app()->createUrl('imsStore/allocation'); $msg .= ''; } //问调表 $http = http('storage-allocate/coach/experience-remind', 'GET', $this->authUsername); $response2 = formatResponse($http); if($response2['status'] && $response2['data']){ $hasMessage=1; foreach ($response2['data'] as $datum){ $id = $datum['id']; $fixedCode= $datum['fixedCode']; $msg .= ''; } } $msg .= '

确认收货提醒

已经有发货5天尚未确认收货的调拨单,请在到货后确认收货,如对物流有疑问,请联系总部
立即处理

清洁任务提醒

你有待提交的清洁任务,请及时处理,否则会判定为不合格
立即处理

调拨单提醒

您有待发货的调拨单,请及时处理
立即处理

问调表提醒

您有设备问调表待填写,请及时处理
立即处理
'; returnMsg(1,$msg, $hasMessage); // if ($response['status']){ // returnMsg(1,'success', $response['data']); // }else{ // returnMsg(0, $response['data']); // } } /** * 清洁消息提示 */ public function actionCleanConfirmWaning(){ $http = http('storage-allocate/coach/deliverWarning', 'GET', $this->authUsername); $response = formatResponse($http); if ($response['status']){ returnMsg(1,'success', $response['data']); }else{ returnMsg(0, $response['data']); } } /** * 发货提示 */ public function actionSendConfirmWaning(){ $http = http('equip/plan/coach/cleanCommitWarning', 'GET', $this->authUsername); $response = formatResponse($http); if ($response['status']){ returnMsg(1,'success', $response['data']); }else{ returnMsg(0, $response['data']); } } /** *意向订单转正式订单 */ public function actionFormalOrder(){ $orderNo = Req::get('orderNo'); //订单号 $goodsName = Req::get('goodsName'); //商品名 // $grade = Req::get('grade'); //年级 $surplus = Req::get('surplus'); //剩余 $goodsTypeId=Req::get('goodsTypeId'); $orderId=Req::get('orderId'); $schoolYear=Req::get('schoolYear'); $useGrade=Req::get('useGrade'); $result['orderNo']=$orderNo; $result['goodsName']=$goodsName; $result['surplus']=$surplus; $result['goodsTypeId']=$goodsTypeId; $result['orderId']=$orderId; $result['schoolYear']=$schoolYear; $result['useGrade']=$useGrade; //根据级别,计算当前所在年级 $grade=1; $semester=$this->schoolManager->getSemester($this->semesterId); $nowSemesterSchoolYear=$semester['school_year']; if(Yii::app()->params['grade_list']){ foreach (Yii::app()->params['grade_list'] as $id =>$param){ $gradeText[$id]=$param['grade_name']; } } if(Yii::app()->params['section']==0){ $addValue=7; // if(Yii::app()->params['grade_group_fixed_year']==4){ // $addValue=6; // }else{ // $addValue=7; // } if(strpos($semester['semester_name'],'上学期')!==false){ $grade=intval($nowSemesterSchoolYear-$schoolYear+$addValue); }elseif(strpos($semester['semester_name'],'下学期')!==false || strpos($semester['semester_name'],'暑假')!==false || strpos($semester['semester_name'],'寒假')!==false){ $grade=intval($nowSemesterSchoolYear-$schoolYear+$addValue-1); } }else{ if(strpos($semester['semester_name'],'上学期')!==false){ $grade=intval($nowSemesterSchoolYear-$schoolYear+1); }elseif(strpos($semester['semester_name'],'下学期')!==false || strpos($semester['semester_name'],'暑假')!==false || strpos($semester['semester_name'],'寒假')!==false){ $grade=intval($nowSemesterSchoolYear-$schoolYear); } } if(!isset($gradeText[$grade])){ Yii::app()->jump->error("获取订单数据异常,学年不正确"); } $result['grade']=$grade; $result['gradeText']=$gradeText[$grade]; $this->render('formalOrder', $result); } //申请转正 public function actionTurnOrder(){ $orderId=Req::post('orderId'); $officialNum=Req::post('officialNum'); $students=Req::post('studentInfo'); $suplus=Req::post('suplus'); $students=str_replace('"','"',$students); @$studentIdArr=json_decode($students,true); if(!$studentIdArr){ returnMsg(0,'学生数据解析失败'); } if(count($studentIdArr) > $suplus) { returnMsg(0,'学生人数不能大于剩余名额'); } $studentInfo=array(); $rex = "/\([\s\S]*\)/i"; //过滤括号 foreach ($studentIdArr as $val){ if(!$val['class'] || !$val['classId'] || !$val['value'] || !$val['name']){ continue; } $studentName=preg_replace($rex,"",$val['name']); $temp=array( 'clazzId'=>$val['classId'], 'clazzName'=>$val['class'], 'studentId'=>$val['value'], 'studentName'=>$studentName ); $studentInfo[]=$temp; } $params['orderId']=$orderId; $params['officialNum']=$officialNum; $params['students']=$studentInfo; $http = http('order/coach/purpose/to/official/v2', 'post', $this->authUsername, $params); $response = formatResponse($http); if ($response['status']){ returnMsg(1,'success', $response['data']); }else{ returnMsg(0, $response['data']); } } //查看正式订单申请 public function actionViewTurnOrder(){ $goodsName=Req::get('goodsName'); $gradeText=Req::get('gradeText'); $surplus=Req::get('surplus'); $orderNo=Req::get('orderNo'); $orderId=Req::get('orderId'); $page=Req::get('page'); $quantity=Req::get('quantity'); if(!$page) $page=1; $params['orderOfficialNo']=$orderNo; $http = http('order/coach/official/details/'.$page, 'post', $this->authUsername, $params); $response = formatResponse($http); //请求日志 $log = http('order/coach/official/detail/'.$orderId, 'get', $this->authUsername, array()); $logList=formatResponse($log); if(isset($logList['data']['orderLogs'])){ $result['logList']=$logList['data']['orderLogs']; }else{ $result['logList']=array(); } //debug($result['logList']['data']['orderLogs']); $result['quantity']=$quantity; $result['orderNo']=$orderNo; $result['goodsName']=$goodsName; $result['surplus']=$surplus; $result['gradeText']=$gradeText; $result['pages']=$response['data']['pages']; $result['list']=$response['data']['list']; $result['page']=$page; $result['total']=$response['data']['total']; $pageArr=array( 'goodsName'=>$goodsName, 'gradeText'=>$gradeText, 'surplus'=>$surplus, 'orderNo'=>$orderNo, 'quantity'=>$quantity ); $result['query']=http_build_query($pageArr); $this->render('viewFormalOrder', $result); } /** * 获取学生信息 */ public function actionGetFilterStudent() { $result = array(); $students = array(); if (Req::post('classId')) { $classId = Req::post('classId'); } else { returnMsg(0, 'classId必须'); } $studentName=Req::post('studentName'); $orderId=Req::post('orderId'); $list = SStudentClassRelation::model()->getStudentInfoByClassId($classId,$studentName); arrayMsort($list,'realname'); //获取本赛季已经开通的学生(页面需要 disabled) $http = http('order/coach/official/students/'.$orderId, 'get', $this->authUsername); $response = formatResponse($http); if($response['status']){ $studentArr= $response['data']; }else{ $studentArr=array(); } if ($studentArr){ foreach ($studentArr as $k=>$v) { $students[] = $v; } } if ($list) { $result['list'] = $list; $result['student'] = $students; returnMsg(1, 'success', $result); } else { returnMsg(0, '暂无数据'); } } public function actionCloudPrintTask() { $centerId = Req::get('centerId') ? Req::get('centerId') : 0 ; $status = Req::get('status') > -1 ? Req::get('status') : -1 ; $goodsTypeId = Req::get('goodsTypeId') ? Req::get('goodsTypeId') : 0 ; $subjectId = Req::get('subjectId') ? Req::get('subjectId') : 0 ; $clazzName = Req::get('clazzName'); $taskName = Req::get('taskName'); $page = Req::get('page'); if(!$page) $page=1; $http = http('cloud-print/task/coach/cloud-product/all', 'get', $this->authUsername, array()); $response = formatResponse($http); $productList = array(); if(isset($response['data']) && $response['data']){ foreach ($response['data'] as $val){ if(!$val['isShow']){ $productList[$val['productId']] = $val['productName']; } } } $params = array(); $params['centerId'] = $centerId; $params['status'] = $status; $params['goodsTypeId'] = $goodsTypeId; $params['subjectId'] = $subjectId; $params['clazzName'] = $clazzName; $params['taskName'] = $taskName; $params['pageNum'] = $page; $params['pageSize'] = 20; $http = http('cloud-print/task/coach/page', 'post', $this->authUsername, $params); $response = formatResponse($http); $result['centerId'] =$centerId; $result['status'] =$status; $result['goodsTypeId']=$goodsTypeId; $result['productList']=$productList; $result['subjectId'] =$subjectId; $result['clazzName']=$clazzName; $result['taskName'] =$taskName; $result['pages'] =$response['data']; $result['list'] =$response['data']['list']; $result['page'] =$page; $result['total'] =$response['data']['total']; $pageArr=array( 'centerId '=> $centerId, 'status' => $status, 'goodsTypeId'=> $goodsTypeId, 'subjectId' => $subjectId, 'clazzName' => $clazzName, 'taskName' => $taskName ); $result['query']=http_build_query($pageArr); $print_centers = array(); $print_centers_query = http('cloud-print/task/coach/center/list', 'get', $this->authUsername); $print_centers_query = formatResponse($print_centers_query); if(!empty($print_centers_query['data'])) { foreach($print_centers_query['data'] as $print_center) { $print_centers[$print_center['centerId']] = $print_center['centerName']; } } $result['print_centers'] = $print_centers; $this->render('cloudPrintTask', $result); } public function actionTaskDetail() { $task_id = Req::get('task_id'); $http = http('cloud-print/task/coach/detail/'.$task_id, 'get', $this->authUsername); $response = formatResponse($http); $this->render('taskDetail', $response); } public function actionTaskCancel() { $task_id = Req::post('task_id'); $res = http('cloud-print/task/coach/return/'.$task_id, 'put', $this->authUsername); $res = formatResponse($res); if($res['status'] == 1) { $cptp_info = \BusinessCloudPrintTask::model()->find('cloud_print_id=:cloud_print_id',array(':cloud_print_id' => $task_id)); if(!empty($cptp_info)) Yii::app()->cache->deleteValue($cptp_info['redis_key']); } returnMsg($res['status'], $res['data']); } public function actionTaskReceive() { $task_id = Req::post('task_id'); $res = http('cloud-print/task/coach/receive/'.$task_id, 'put', $this->authUsername); $res = formatResponse($res); returnMsg($res['status'], $res['data']); } public function actionTaskDelete() { $task_id = Req::post('task_id'); $res = http('cloud-print/task/coach/delete/'.$task_id, 'delete', $this->authUsername); $res = formatResponse($res); returnMsg($res['status'], $res['data']); } public function actionTaskPReceive() { $task_ids = Req::post('task_ids'); $param['taskIds'] = $task_ids; $res = http('cloud-print/task/coach/receive/batch', 'put', $this->authUsername, $param); $res = formatResponse($res); returnMsg($res['status'], $res['data']); } public function actionContingencyPrint() { $this->render('contingencyPrint'); } //保存应急打印任务 public function actionSaveContingencyPrint() { ini_set ('memory_limit', '300M'); if(!$_FILES) { echo json_encode(array('status' => 0, 'message' => '文件大小超过范围'));exit; }else{ if(!isset($_FILES['file1']) || !isset($_FILES['file1']['size']) || $_FILES['file1']['size'] > 10485760) { echo json_encode(array('status' => 0, 'message' => '文件大小超过范围'));exit; } $info = $_FILES['file1']['name']; $temp = explode('.', $info); $type = end($temp); $fileType = array('rar', 'zip'); if (!in_array($type, $fileType)) { echo json_encode(array('status' => 0, 'message' => '请上传指定类型文件'));exit; } } if (Yii::app()->request->getIsPostRequest()) { // 保存上传文件至服务器 $pathName = dirname(dirname(dirname(__FILE__))).'/upload/tmpDir/ims/cloudTask/'. $this->schoolId.date('Y') .'/'. date('m') . '/'.date('d'). '/'; $pathName1 = 'upload/tmpDir/ims/cloudTask/'. $this->schoolId.date('Y') .'/'. date('m') . '/'.date('d'). '/'; if (!file_exists($pathName)) { mkdir($pathName, 0777, true); } $ucloud = new HuaweiCloud(); $fileName = iconv("UTF-8", "gb2312",$_FILES['file1']['name']); $extName = substr($_FILES['file1']['name'],strrpos($_FILES['file1']['name'],'.')); if (!move_uploaded_file($_FILES['file1']['tmp_name'], $pathName.$fileName)) { echo json_encode(array('status' => 0, 'message' => '文件上传失败')); @unlink($pathName1.$fileName);exit; }else{ $meg = $ucloud->putFile('zsyas2/ims/cloudTask/'.$this->schoolId.'/'.time().mt_rand().$extName,$pathName1.$fileName); if($meg['status'] == 0){ echo json_encode(array('status' => 0, 'message' => $meg['msg']));exit(); }else{ $url = $meg['url']; $url = str_replace("%2F","/",$url); } } @unlink($pathName1.$fileName); //任务发送ims端 $params = array( "taskName" => Req::post('taskName'), "centerId" => $this->getPrintCenter(), 'subjectId' => Req::post('subject'), 'grade' => Req::post('grade'), 'printPieces' => Req::post('copies'), 'singlePiecePages' => Req::post('eachCopies'), 'sheetType' => Req::post('sheetType'), 'url' => $url, 'sendTime' => date('Y-m-d H:i:s') ); $http = http('cloud-print/task/coach/add/emergency', 'POST', $this->authUsername, $params); $response = formatResponse($http); if ($response['status']) { echo json_encode(array('status' => 1, 'message' => 'ok'));exit; }else{ echo json_encode(array('status' => 0, 'message' => $response['data']));exit; } } } //获取云印点 protected function getPrintCenter(){ //获取云印点 if(Yii::app()->cache->getValue("cloud_print_coach_".$this->schoolId."_centerId")) { $centerId = Yii::app()->cache->getValue("cloud_print_coach_".$this->schoolId."_centerId"); }else{ $http1 = http('cloud-print/task/coach/center','GET', $this->authUsername, array()); $response1 = formatResponse($http1); if(isset($response1['data']['centerId']) && is_numeric($response1['data']['centerId'])){ $centerId = $response1['data']['centerId']; Yii::app()->cache->setValue("cloud_print_coach_".$this->schoolId."_centerId", $centerId, 86400); }else{ echo json_encode(array('status' => 0, 'message' => '获取云印点失败'));exit; } } return $centerId; } public function actionProductSign(){ $type = Req::get('type'); $begin = Req::get('begin'); $end = Req::get('end'); $name = Req::get('name'); $page=Req::get('page'); if(!$page) $page=1; $result=array(); $result['list']=array(); $result['page']=array(); $param=array(); $param['page']=$page; if($type){ $param['type']=$type; } if($begin){ if(strtotime($begin)>time()){ Yii::app()->jump->error('开始时间不能大于当前时间'); } $param['begin']=date('Y-m-d H:i:s',strtotime($begin)); } if($end){ if(strtotime($end)>time()){ Yii::app()->jump->error('结束时间不能大于当前时间'); } $param['end']=date('Y-m-d H:i:s',(strtotime($end)+86400)); } if($name){ $param['name']=$name; } $res = http('order/deliver/coach/query', 'post', $this->authUsername, $param); $res = formatResponse($res); if($res['status']==1){ $result['list']=$res['data']['list']; $result['page']=$res['data']; //读取AndroidApp下载链接 $softwareUrlAndroid=$this->schoolManager->getNewVersionBySoftwareId(12); $result['softwareUrlAndroid']=$softwareUrlAndroid; $result['softwareUrlIos']='https://testflight.apple.com/join/o0NJOqbz'; $this->render('productSign', $result); }else{ Yii::app()->jump->error($res['data']); } } public function actionViewProductSign(){ $id = Req::get('id'); $res = http('order/deliver/coach/detail/'.$id, 'get', $this->authUsername); $res = formatResponse($res); if($res['status']==1){ $this->render('viewProductSign',$res['data']); }else{ Yii::app()->jump->error("接口错误"); } } /** * @param $seasonId * @param $goodsTypeId * @param $classId * @return array * 获取已经订购的学生(意向订单) */ public function getTrialStudentByStudentList($yearSemester,$schoolYearId, $goodsTypeId, $classId,$subjectId,$studentList,$trialType,$grade,$startTime,$semesterId) { $param=array(); $param['schoolYearId']=$schoolYearId; $param['semesterId']=$semesterId; $param['yearSemester']=$yearSemester; $param['clazzId']=$classId; $param['goodsTypeId']=$goodsTypeId; $param['subjectId']=$subjectId; $param['studentIds']=$studentList; $param['trialType']=$trialType; $param['grade']=$grade; $param['beginTime']=$startTime; $http = http('order/coach/trial/students', 'post', $this->authUsername,$param); $response = formatResponse($http); if($response['status']){ return $response['data']; }else{ return array(); } } /** * 明细订单导出 */ public function actionDetailOrderExcel(){ $params = array(); // if (Req::post('orderNo')){ // $params['orderOfficialNo'] = Req::post('orderNo'); // } if (Req::post('orderOfficialNo')){ $params['orderOfficialNo'] = Req::post('orderOfficialNo'); } if(Req::post('goodsId')){ $params['goodsId'] = Req::post('goodsId'); } if(Req::post('packageId')){ $params['packageId'] = Req::get('packageId'); } if(Req::post('useStatus')){ $params['useStatus'] = Req::post('useStatus')-1; } if(Req::post('payStatus')){ $params['payStatus'] = Req::post('payStatus')-1; } if(Req::post('takeStatus')){ $params['takeStatus'] = Req::post('takeStatus')-1; } if(Req::post('studentName') && Req::post('studentName')!=''){ $params['studentName'] = Req::post('studentName'); } if(Req::post('orderTypes')){ $params['orderType'] = Req::post('orderTypes')-1; } if(Req::post('semesterTypes')){ $params['semester'] = Req::post('semesterTypes')-1; } if(Req::post('schoolYearName') && Req::post('schoolYearName')!=''){ $params['schoolYearId'] = Req::post('schoolYearName'); } if(Req::post('className') && Req::post('className')!=''){ $params['clazzName'] = Req::post('className'); } if(Req::post('beginTime') && Req::post('beginTime')!=''){ $params['beginTime'] = date('Y-m-d H:i:s',strtotime(Req::post('beginTime'))); } if(Req::post('endTime') && Req::post('endTime')!=''){ $params['endTime'] = date('Y-m-d 23:59:59',strtotime(Req::post('endTime'))); } $http = http('order/coach/official/details/export','post', $this->authUsername, $params); $response = formatResponse($http); if($response){ echo json_encode($response);exit; }else{ echo json_encode(array("status"=>0,"error"=>"导出失败"));exit; } } public function actionGetStudentInfo(){ $params = array(); if (Req::post('studentName')){ $params['studentName'] = Req::post('studentName'); } if(Req::post('orderNo')){ $params['orderNo'] = Req::post('orderNo'); } $http = http('order/coach/trial/students/list', 'post', $this->authUsername, $params); $response = formatResponse($http); // debug($response); if($response){ echo json_encode($response);exit; }else{ echo json_encode(array("status"=>0,"error"=>"导出失败"));exit; } } /* *未签收产品列表7天内 * 根据产品/考试id ,获取已下载的班级信息 * type:1 考试,2数学阶段个性化学习宝,3二轮提分手册,4考后指导,5晨读词汇 6阶段复习,7错题本,8二步个性化学习宝,9三步个性化学习宝,10 英语外刊阅读 * 1,2,4,6,7,8,9 考试类型 */ public function actionUnSign(){ $postArr=array(); $list=array(); //查询7天内考试 $examModel=new SExam(); $examParam=$examModel->getExamIdByTime(); //二轮提分指导手册 $mathReviewModel=new SMathReviewSetting(); $mathParam=$mathReviewModel->getMathReview(); //晨读词汇 $weekParam=$mathReviewModel->getEnglishWeek(); //外刊阅读 $readingParam=$mathReviewModel->getEnglishReading(); $postArr=array_merge($examParam,$mathParam,$weekParam,$readingParam); // $postArr=array_merge($postArr,$mathParam); // $postArr=array_merge($postArr,$weekParam); // $postArr=array_merge($postArr,$readingParam); // debug(json_encode($postArr)); //接口过滤已签名数据 $http = http('order/deliver/coach/no-deliver/query', 'post', $this->authUsername, $postArr); $response = formatResponse($http); if($response['status']){ $list= $response['data']; } $this->render('productUnSign',array('list'=>$list)); } //回款反馈 public function actionPayment(){ $params = array(); if(Req::get('grade')){ $params['grade']=Req::get('grade'); } if(Req::get('schoolYearId')){ $params['schoolYearId']=Req::get('schoolYearId'); } if(Req::get('goodsId')){ $params['goodsId']=Req::get('goodsId'); } if(Req::get('semester')){ $params['semester']=Req::get('semester')-1; } if(Req::get('startTime')){ $params['startTime']=Req::get('startTime').' 0:0:0'; } if(Req::get('endTime')){ $params['endTime']=Req::get('endTime').' 0:0:0'; } if(Req::get('page')){ $params['pageNum']=Req::get('page'); }else{ $params['pageNum']=1; } //列表 $http = http('finance/back/coach/client/list', 'post', $this->authUsername, $params); $response = formatResponse($http); if($response['status']==1){ $result['list']=$response['data']['list']; $result['page'] = $response['data']; }else{ if(isset($response['data']) && $response['data']){ Yii::app()->jump->error($response['data']); }else{ Yii::app()->jump->error("保存失败"); } } //获取学年 $http = http('sys/school/year/period/list', 'get', $this->authUsername); $response = formatResponse($http); $result['schoolYear'] = $response['data']; $goodArr = $this->getGood(); $result['goodList'] = $goodArr; $result['params']=$params; $this->render('paymentList',$result); } //新增回款反馈 public function actionNewPayment(){ if (Yii::app()->request->getIsPostRequest()){ //保存 $param['orderId']=Req::post('orderId'); $param['useNum']=Req::post('use_person'); $param['schoolYearId']=Req::post('schoolYearId'); if(Req::post('semester')){ $param['semester']=Req::post('semester')-1; } $param['grade']=Req::post('grade'); $param['goodsId']=Req::post('goodsId'); $param['downloadNum']=Req::post('down_person'); $param['price']=Req::post('price'); $param['feeNumUp']=Req::post('feeNumUp'); $param['priceSumUp']=Req::post('priceSumUp'); $param['feeNumDown']=Req::post('feeNumDown'); $param['priceSumDown']=Req::post('priceSumDown'); $param['feeTime']=date('Y-m-d H:i:s',strtotime(Req::post('charge_time'))); if(Req::post('pay_time')){ $param['remitDate']=date('Y-m-d H:i:s',strtotime(Req::post('pay_time'))); } $param['remark']=Req::post('mark'); if(Req::post('id')){ $param['bcId']=Req::post('id'); $http = http('finance/back/coach/edit', 'post', $this->authUsername,$param); }else{ $http = http('finance/back/coach/add', 'post', $this->authUsername,$param); } $response = formatResponse($http); if($response['status']==1){ $this->redirect('/imsSale/payment'); }else{ if(isset($response['data']) && $response['data']){ Yii::app()->jump->error($response['data']); }else{ Yii::app()->jump->error("保存失败"); } } } $params = array(); //销售订单列表 $http = http('order/coach/purpose/list', 'get', $this->authUsername); $response = formatResponse($http); //debug($response); if($response['status']==1){ $result['orderList']=$response['data']; } //获取学年 $http = http('sys/school/year/period/list', 'get', $this->authUsername, $params); $response = formatResponse($http); $result['schoolYear'] = $response['data']; //debug($http); $goodArr = $this->getGood(); $result['goodList'] = $goodArr; $this->render('newPayment',$result); } //编辑回款反馈 public function actionEditPayment(){ $id=Req::get('id'); $http = http('finance/back/coach/'.$id, 'get', $this->authUsername); $response = formatResponse($http); //debug($response); if($response['status']==1){ $result['data']=$response['data']; } //销售订单列表 $http = http('order/coach/purpose/list', 'get', $this->authUsername); $response = formatResponse($http); if($response['status']==1){ $result['orderList']=$response['data']; } //获取学年 $http = http('sys/school/year/period/list', 'get', $this->authUsername); $response = formatResponse($http); $result['schoolYear'] = $response['data']; //debug($http); $goodArr = $this->getGood(); $result['goodList'] = $goodArr; $this->render('editPayment',$result); } //服务费查询 public function actionServiceCharge(){ $data=array(); $page=Req::get('page'); $param=array(); if(Req::get('semesterId')){ $param['semesterId']=Req::get('semesterId')-1; } if(Req::get('schoolYearId')){ $param['schoolYearId']=Req::get('schoolYearId'); } if(Req::get('end')){ $param['end']=Req::get('end')." 23:59:59"; } if(Req::get('begin')){ $param['begin']=Req::get('begin')." 00:00:00"; } if(!$page) $page=1; $http = http('coach-service-charge/coach/batch/query?pageNum='.$page, 'post', $this->authUsername,$param); $response = formatResponse($http); if($response['status']=1){ $data['list']=$response['data']['list']; $data['page']=$response['data']; }else{ $data['list']=array(); $data['page']=array(); } //获取学年 $http = http('sys/school/year/period/list', 'get', $this->authUsername); $response = formatResponse($http); $data['schoolYear'] = $response['data']; $this->render('serviceCharge',$data); } //商品变更 public function actionGoodsChange(){ $result=array(); $seasonId=Req::get('seasonId'); $begin=Req::get('begin'); $end=Req::get('end'); $status=Req::get('status'); $page = Req::get('page') ? Req::get('page') : 1; $params=array(); if($seasonId){ $params['seasonId']=$seasonId; } if($begin){ $params['begin']=$begin.' 00:00:00'; } if($end){ $params['end']=$end.' 23:59:59'; } if($status){ $params['status']=$status-1; } if($page){ $params['pageNum']=$page; } //销售订单列表 $http = http('order/goods/change/coach/page', 'post', $this->authUsername,$params); $response = formatResponse($http); if($response['status']==1){ $result['list']=$response['data']['list']; $result['page']=$response['data']; }else{ $result['list']=array(); $result['page']=array(); } $result['seasonId'] = $seasonId; $result['begin'] = $begin; $result['end'] = $end; $result['status'] = $status; //读取赛季 $seasonList=$this->getEnableSeason(); $result['seasonList']=$seasonList; $this->render('goodsChange',$result); } //查看服务费详情 public function actionViewServiceCharge(){ $batchId=Req::get('batchId'); $data=array(); //查询服务费核算结果 $http = http('coach-service-charge/coach/batch/'.$batchId.'/query', 'get', $this->authUsername); $response = formatResponse($http); $data['batches']=$response['data']; //查询订单维度核算过程 $http = http('coach-service-charge/coach/batch/'.$batchId.'/order/query?pageNum=1', 'get', $this->authUsername); $response = formatResponse($http); $data['order']=$response['data']; //查询本学期扣款记录 $http = http('coach-service-charge/coach/deduction/query/'.$batchId.'?pageNum=1', 'get', $this->authUsername); $response = formatResponse($http); $data['recorder']=$response['data']; $this->render('viewServiceCharge',$data); } //查询订单维度核算过程 public function actionAjaxSearchServiceCharge(){ $batchId=Req::post('batchId'); $page=Req::post('page'); $type=Req::post('type'); if(!$page) $page=1; if($type==1){ //查询本学期扣款记录 $http = http('coach-service-charge/coach/deduction/query/'.$batchId.'?pageNum='.$page, 'get', $this->authUsername); }else{ //查询订单维度核算过程 $http = http('coach-service-charge/coach/batch/'.$batchId.'/order/query?pageNum='.$page, 'get', $this->authUsername); } $response = formatResponse($http); returnMsg(1,'success',$response['data']); } //查询未订购学生 public function actionSearchNoBuy(){ $param['schoolYearId']=Req::post('schoolYearId'); $param['gradeId']=Req::post('grade'); $param['pageNum']=Req::post('page'); if(Req::post('semesterId')){ $param['semesterId']=Req::post('semesterId')-1; } if(!$param['pageNum']) $param['pageNum']=1; $http = http('order/coach/student/not-buy/page', 'post', $this->authUsername,$param); $response = formatResponse($http); $result['status']=0; if($response['status']==1){ $result['status']=1; $result['data']['list']=$response['data']['list']; $result['data']['total_page']=$response['data']['pages']; $result['data']['now_page']=$param['pageNum']; } exit(json_encode($result)); } //导出未订购学生 public function actionExportNoBuyStudent(){ $param['schoolYearId']=Req::post('schoolYearId'); $param['gradeId']=Req::post('grade'); if(Req::post('semesterId')){ $param['semesterId']=Req::post('semesterId')-1; } $http = http('order/coach/student/not-buy/export', 'post', $this->authUsername,$param); $response = formatResponse($http); $result['status']=0; if($response['status']==1){ $result['status']=1; $result['data']=$response['data']; }else{ $result['data']=$response['data']; } exit(json_encode($result)); } //新建商品变更 public function actionNewGoodsChange(){ //获取学年 $http = http('sys/school/year/period/list', 'get', $this->authUsername); $response = formatResponse($http); $result['schoolYear'] = $response['data']; $this->render('newGoodsChange',$result); } //根据学年查询可用于变更的销售订单 public function actionCanChangeOrder(){ $result=array(); $result['status']=0; $schoolYearId=Req::post('schoolYearId'); if(!$schoolYearId){ $result['msg']='参数异常'; exit(json_encode($result)); } $http = http('order/goods/change/coach/purpose-can-change-list', 'post', $this->authUsername,array('schoolYearId'=>$schoolYearId)); $response = formatResponse($http); if($response['status']==1){ $result['status']=1; $result['data']=$response['data']; } exit(json_encode($result)); } //根据销售订单查询需要变更的财务订单 public function actionNeedChangeOrder(){ $result=array(); $result['status']=0; $orderId=Req::post('orderId'); if(!$orderId){ $result['msg']='参数异常'; exit(json_encode($result)); } $http = http('order/goods/change/coach/official-list/'.$orderId, 'get', $this->authUsername); $response = formatResponse($http); if($response['status']==1){ $result['status']=1; $result['data']=$response['data']; }else{ $result['msg']=$response['data']; } exit(json_encode($result)); } //查询财务订单的学生列表 public function actionOrderStudentList(){ $result=array(); $result['status']=0; $orderId=Req::post('orderId'); if(!$orderId){ $result['msg']='参数异常'; exit(json_encode($result)); } $http = http('order/goods/change/coach/order-students/'.$orderId, 'get', $this->authUsername); $response = formatResponse($http); if($response['status']==1){ $result['status']=1; $result['data']=$response['data']; } exit(json_encode($result)); } //查看变更订单详情 public function actionViewGoodsChange(){ $ogcId=Req::get('id'); $page=Req::get('page') ? Req::get('page') : 1; if(!$ogcId){ Yii::app()->jump->error("参数异常"); } $http = http('order/goods/change/coach/'.$ogcId, 'get', $this->authUsername); $response = formatResponse($http); if($response['status']==1){ $result=$response['data']; }else{ Yii::app()->jump->error($response['data']); } //读取订单学生 $http = http('order/goods/change/coach/'.$ogcId.'/students?pageNum='.$page, 'get', $this->authUsername); $response = formatResponse($http); $result['page']=$response['data']; $result['id']=$ogcId; $result['students']=$response['data']['list']; $this->render('viewGoodsChange',$result); } //保存商品变更 public function actionSaveGoodsChange(){ $ogcId=Req::post('ogcId'); $oldOrderId=Req::post('oldOrderId'); $purposeOrderId=Req::post('purposeOrderId'); $studentIdArr=Req::post('studentList'); $goodsChange=Req::post('goodsChange'); $studentIdArr=str_replace('"','"',$studentIdArr); @$studentIdArr=json_decode($studentIdArr,true); $students = array(); if(!$studentIdArr){ returnMsg(0,'学生数据解析失败'); } foreach ($studentIdArr as $k=>$v){ if(!$v['value']){ continue; } $students[]=$v['value']; } $params['studentIds'] = $students; $params['oldOrderId'] = $oldOrderId; $params['purposeOrderId'] = $purposeOrderId; $params['goodsChange'] = $goodsChange; if($ogcId){ $http = http('order/goods/change/coach/'.$ogcId, 'PUT', $this->authUsername,$params); }else{ $http = http('order/goods/change/coach', 'post', $this->authUsername,$params); } $response = formatResponse($http); if($response['status']==1){ returnMsg(1,'提交成功'); }else{ returnMsg(0,$response['data']); } } //查询用于商品变更的订单 public function actionSearchGoodsChange(){ if(Req::get('schoolYearId')){ $param['schoolYearId']=Req::get('schoolYearId'); } if(Req::get('grade')){ $param['grade']=Req::get('grade'); } $param['pageNum']= Req::get('page') ? Req::get('page') : 1; //获取学年 $http = http('sys/school/year/period/list', 'get', $this->authUsername); $response = formatResponse($http); $result['schoolYear'] = $response['data']; $http = http('order/goods/change/coach/purpose-page', 'post', $this->authUsername,$param); $response = formatResponse($http); if($response['status']==1){ $result['list']=$response['data']['list']; $result['page']=$response['data']; }else{ $result['list']=array(); $result['page']=array(); } //debug($result); $this->render('searchGoodsChange',$result); } //重新提交变更订单(编辑) public function actionEditGoodsChange(){ $ogcId=Req::get('id'); if(!$ogcId){ Yii::app()->jump->error("参数异常"); } $http = http('order/goods/change/coach/'.$ogcId, 'get', $this->authUsername); $response = formatResponse($http); if($response['status']==1){ $result=$response['data']; }else{ Yii::app()->jump->error($response['data']); } //获取学年 $http = http('sys/school/year/period/list', 'get', $this->authUsername); $response = formatResponse($http); $result['schoolYear'] = $response['data']; $result['ogcId']=$ogcId; $result['studentIds']=array(); $this->render('editGoodsChange',$result); } //商品变更查询可变更人数 public function actionSearchChangeNum(){ $orderId=Req::post('orderId'); $financeOrderId=Req::post('financeOrderId'); $result['status']=0; $http = http('order/goods/change/coach/can-change-num/'.$financeOrderId.'/'.$orderId, 'get', $this->authUsername); $response = formatResponse($http); if($response['status']==1){ $result['status']=1; $result['data']=$response['data']; }else{ Yii::app()->jump->error($response['data']); } exit(json_encode($result)); } //服务费查询密码 public function actionValidationPwd(){ $password=Req::post('password'); $result['status']=0; $http = http('coach-service-charge/coach/validation/'.$password, 'get', $this->authUsername); $response = formatResponse($http); if($response['status']==1){ $result['status']=1; }else{ $result['msg']=$response['data']; } exit(json_encode($result)); } //服务费修改查询密码 public function actionUpdateServicePwd(){ $password=Req::post('password'); $newPassword=Req::post('newPassword'); $checkPassword=Req::post('checkPassword'); $result['status']=0; if(!$password || !$newPassword || !$checkPassword){ $result['msg']='密码不能为空'; exit(json_encode($result)); } if($newPassword!=$checkPassword){ $result['msg']='两次密码输入不一致'; exit(json_encode($result)); } $params=array( 'oldPassword'=>$password, 'newPassword'=>$newPassword, 'confirmPassword'=>$checkPassword, ); $http = http('coach-service-charge/coach/update/service-password', 'post', $this->authUsername,$params); $response = formatResponse($http); if($response['status']==1){ $result['status']=1; }else{ $result['msg']=$response['data']; } exit(json_encode($result)); } //销售订单推送名单 public function actionPushList(){ $orderId= Req::get('orderId'); $clazzId= Req::get('clazzId'); $isPay= Req::get('isPay'); $page = Req::get('page') ? Req::get('page') : 1; $params=array( 'orderId'=>$orderId, 'pageNum'=>$page ); if($clazzId){ $params['clazzId']=$clazzId; } if($isPay){ $params['isPay']=intval($isPay-1); } $res = http('order/coach/push-student/page', 'post', $this->authUsername,$params); $response = formatResponse($res); if($response['status']==1){ $result['list']=$response['data']['list']; $result['page']=$response['data']; }else{ $result['list']=array(); $result['page']=array(); } //读取班级 $res = http('order/coach/push-student/clazz/'.$orderId, 'get', $this->authUsername); $response = formatResponse($res); if($response['status']==1){ $result['classList']=$response['data']; } $this->render('pushList',$result); } //销售订单推送名单导出 public function actionPushListExport(){ $orderId= Req::post('orderId'); $clazzId= Req::post('clazzId'); $isPay= Req::post('isPay'); $params=array( 'orderId'=>$orderId, ); if($clazzId){ $params['clazzId']=$clazzId; } if($isPay){ $params['isPay']=intval($isPay-1); } $res = http('order/coach/push-student/export', 'post', $this->authUsername,$params); $response = formatResponse($res); if($response){ echo json_encode($response);exit; }else{ echo json_encode(array("status"=>0,"error"=>"导出失败"));exit; } } //回款反馈申请 public function actionPaymentApply(){ $params = array(); if(Req::get('grade')){ $params['grade']=Req::get('grade'); } if(Req::get('schoolYearId')){ $params['schoolYearId']=Req::get('schoolYearId'); } if(Req::get('semester')){ $params['semester']=Req::get('semester')-1; } if(Req::get('recordNo')){ $params['recordNo']=Req::get('recordNo'); } if(Req::get('bcNo')){ $params['bcNo']=Req::get('bcNo'); } if(Req::get('page')){ $params['pageNum']=Req::get('page'); }else{ $params['pageNum']=1; } //列表 $http = http('finance/back/coach/client/record/page', 'post', $this->authUsername, $params); $response = formatResponse($http); if($response['status']==1){ $result['list']=$response['data']['list']; $result['page'] = $response['data']; }else{ if(isset($response['data']) && $response['data']){ Yii::app()->jump->error($response['data']); }else{ Yii::app()->jump->error("保存失败"); } } //获取学年 $http = http('sys/school/year/period/list', 'get', $this->authUsername); $response = formatResponse($http); $result['schoolYear'] = $response['data']; $goodArr = $this->getGood(); $result['goodList'] = $goodArr; $result['params']=$params; $this->render('paymentApplyList',$result); } //查看回款反馈申请 public function actionViewPaymentApply(){ $id=Req::get('id'); $http = http('finance/back/coach/record/detail/'.$id, 'get', $this->authUsername); $response = formatResponse($http); if($response['status']==1){ $result['data']=$response['data']; } $this->render('viewPaymentApply',$result); } //编辑回款反馈申请 public function actionEditPaymentApply(){ $id=Req::get('id'); if (Yii::app()->request->getIsPostRequest()){ $bdId=Req::post('bcId'); //保存 $param['orderId']=Req::post('orderId'); $param['useNum']=Req::post('use_person'); $param['schoolYearId']=Req::post('schoolYearId'); if(Req::post('semester')){ $param['semester']=Req::post('semester')-1; } $param['grade']=Req::post('grade'); $param['goodsId']=Req::post('goodsId'); $param['downloadNum']=Req::post('down_person'); $param['price']=Req::post('price'); $param['feeNumUp']=Req::post('feeNumUp'); $param['priceSumUp']=Req::post('priceSumUp'); $param['feeNumDown']=Req::post('feeNumDown'); $param['priceSumDown']=Req::post('priceSumDown'); $param['feeTime']=date('Y-m-d H:i:s',strtotime(Req::post('charge_time'))); if(Req::post('pay_time')){ $param['remitDate']=date('Y-m-d H:i:s',strtotime(Req::post('pay_time'))); } $param['remark']=Req::post('mark'); $param['bcId']=$bdId; $param['recordId']=$id; $http = http('finance/back/coach/edit', 'post', $this->authUsername,$param); $response = formatResponse($http); if($response['status']==1){ $this->redirect('/imsSale/paymentApply'); }else{ if(isset($response['data']) && $response['data']){ Yii::app()->jump->error($response['data']); }else{ Yii::app()->jump->error("保存失败"); } } } $http = http('finance/back/coach/client/record/'.$id, 'get', $this->authUsername); $response = formatResponse($http); if($response['status']==1){ $result['data']=$response['data']; } //销售订单列表 $http = http('order/coach/purpose/list', 'get', $this->authUsername); $response = formatResponse($http); if($response['status']==1){ $result['orderList']=$response['data']; } //获取学年 $http = http('sys/school/year/period/list', 'get', $this->authUsername); $response = formatResponse($http); $result['schoolYear'] = $response['data']; //debug($http); $goodArr = $this->getGood(); $result['goodList'] = $goodArr; $this->render('editPaymentApply',$result); } //取消回款反馈申请 public function actionCancelPaymentApply(){ $id=Req::get('id'); $http = http('activiti/coach/process-instances/'.$id.'/suspended', 'put', $this->authUsername); $response = formatResponse($http); if($response['status']==1){ $this->redirect('/imsSale/paymentApply'); }else{ if(isset($response['data']) && $response['data']){ Yii::app()->jump->error($response['data']); }else{ Yii::app()->jump->error("取消失败"); } } } //删除回款反馈申请 public function actionDeletePaymentApply(){ $id=Req::get('id'); $http = http('activiti/coach/process-instances/'.$id, 'delete', $this->authUsername); $response = formatResponse($http); if($response['status']==1){ $this->redirect('/imsSale/paymentApply'); }else{ if(isset($response['data']) && $response['data']){ Yii::app()->jump->error($response['data']); }else{ Yii::app()->jump->error("删除失败"); } } } //普通试用时间表 public function actionTimeTable(){ $http = http('order/coach/trial-date', 'get', $this->authUsername); $response = formatResponse($http); $result['status']=0; if($response['status']==1){ $result['status']=1; $result['data']=$response['data']; }else{ $result['msg']=$response['data']; } exit(json_encode($result)); } //试用订单,根据时间查可用学期 public function actionGetSemesterByBeginTime(){ $beginTime=Req::post('beginTime'); $param['beginTime']=date('Y-m-d 00:00:00',strtotime($beginTime)); $http = http('order/coach/trial/useful-semester', 'post', $this->authUsername,$param); $response = formatResponse($http); $result['status']=0; if($response['status']==1){ $result['status']=1; $result['data']=$response['data']; }else{ $result['msg']=$response['data']; } exit(json_encode($result)); } //试用订单,获取试用类型 public function actionGetUsefulType(){ $beginTime=Req::post('beginTime'); $goodsTypeId=Req::post('goodsTypeId'); $grade=Req::post('grade'); $subject=Req::post('subject'); $yearSemester=Req::post('yearSemester'); $param=array(); $param['beginTime']=date('Y-m-d 00:00:00',strtotime($beginTime)); $param['goodsTypeId']=$goodsTypeId; $param['grade']=$grade; $param['subject']=$subject; $param['yearSemester']=$yearSemester; $http = http('order/coach/trial/useful-type', 'post', $this->authUsername,$param); $response = formatResponse($http); $result['status']=0; if($response['status']==1){ $result['status']=1; $result['data']=$response['data']; }else{ $result['msg']=$response['data']; } exit(json_encode($result)); } //新增、编辑问调表 public function actionEditExperience(){ $param['appearanceFineness']=Req::post('appearanceFineness'); $param['printingEffect']=Req::post('printingEffect'); $param['scanPaperJam']=Req::post('scanPaperJam'); $param['printPaperJam']=Req::post('printPaperJam'); $param['id']=Req::post('id'); $http = http('storage-allocate/coach/edit-experience', 'post', $this->authUsername,$param); $response = formatResponse($http); $result['status']=0; if($response['status']==1){ $result['status']=1; $result['data']=$response['data']; }else{ $result['msg']=$response['data']; } exit(json_encode($result)); } /** * 产品试用重启列表 */ public function actionTrialRestart() { $params = array(); $result = array(); $page = Req::get('page') ? Req::get('page') : 1; if (Req::get('goodsTypeId')) { $params['goodsTypeId'] = Req::get('goodsTypeId'); } if (Req::get('grade')) { $params['grade'] = Req::get('grade'); } if (Req::get('orderNo')) { $params['orderNo'] = Req::get('orderNo'); } $params['pageNum']=$page; //获取产品 $goodArr = $this->getGoodType(); $result['goodList'] = $goodArr; $http = http('order-trial-enable/coach/page' , 'POST', $this->authUsername, $params); $response = formatResponse($http); $data = $response['data']; if ($response['status']) { $result['page'] = $data; $result['list'] = isset($data['list'])?$data['list']:array(); } else { $result['page'] = array(); $result['list'] = array(); } return $this->render('trialTableRestart', $result); } //查看重启详情 public function actionViewRestart(){ $oteId = Req::get('oteId') ? Req::get('oteId') : 0; if(!$oteId){ Yii::app()->jump->error('ID不正确'); } $http = http('order-trial-enable/coach/detail/'.$oteId , 'GET', $this->authUsername); $response = formatResponse($http); $result=$response['data']; //; debug($result); return $this->render('trialTableRestartView', $result); } //试用订单删除学生申请列表 public function actionTrialDeleteList(){ $params = array(); $result = array(); $page = Req::get('page') ? Req::get('page') : 1; if (Req::get('goodsTypeId')) { $params['goodsTypeId'] = Req::get('goodsTypeId'); } if (Req::get('grade')) { $params['grade'] = Req::get('grade'); } if (Req::get('orderNo')) { $params['orderNo'] = Req::get('orderNo'); } $params['pageNum']=$page; //获取产品 $goodArr = $this->getGoodType(); $result['goodList'] = $goodArr; $http = http('order-trial-delete/coach/page' , 'POST', $this->authUsername, $params); $response = formatResponse($http); $data = $response['data']; if ($response['status']) { $result['page'] = $data; $result['list'] = isset($data['list'])?$data['list']:array(); } else { $result['page'] = array(); $result['list'] = array(); } return $this->render('trialTableDelete', $result); } //试用订单删除学生申请详情查看 public function actionTrialDeleteDetail(){ $otdId = Req::get('otdId') ? Req::get('otdId') : 0; if(!$otdId){ Yii::app()->jump->error('ID不正确'); } $http = http('order-trial-delete/coach/detail/'.$otdId , 'GET', $this->authUsername); $response = formatResponse($http); $result=$response['data']; //; debug($result); return $this->render('trialTableDeleteView', $result); } //试用订单删除学生选择学生页面 public function actionTrialDeleteApply(){ $orderId = Req::get('orderId') ? Req::get('orderId') : 0; $result=array(); //判断是否能发起申请 $http = http('order-trial-delete/coach/can-apply/'.$orderId , 'GET', $this->authUsername); $response = formatResponse($http); if(!$response['status']){ Yii::app()->jump->error($response['data']); } $result['orderId']=$orderId; return $this->render('trialTableDeleteApply', $result); } //新增试用订单删除学生申请 public function actionOrderTrialDelete(){ $orderId = Req::post('orderId') ? Req::post('orderId') : 0; $reason = Req::post('reason') ? Req::post('reason') :''; $osIds = Req::post('osIds') ? Req::post('osIds') : array(); $result=array(); $result['status']=0; if(!$orderId){ $result['msg']="订单id不能为空"; exit(json_encode($result)); } if(!$reason){ $result['msg']="删除原因不能为空"; exit(json_encode($result)); } if(!$osIds){ $result['msg']="学生不能为空"; exit(json_encode($result)); } $params=array(); $params['osIds']=$osIds; $params['reason']=$reason; $params['otId']=$orderId; //判断是否能发起申请 $http = http('order-trial-delete/coach' , 'POST', $this->authUsername,$params); $response = formatResponse($http); if($response['status']==1){ $result['status']=1; $result['data']=$response['data']; }else{ $result['msg']=$response['data']; } exit(json_encode($result)); } //请求暂停、开启班级列表 public function actionGetDeleteClassesByOrderId(){ $orderId=Req::post('orderId'); $result['status']=0; //读取班级列表 $http = http('order-trial-delete/coach/clazz-list/'.$orderId, 'get', $this->authUsername); $responseArr = formatResponse($http); if($responseArr['status']==1){ $result=$responseArr; $result['students']=array(); //读取学生列表 if($result['data']){ $classId=$result['data'][0]['clazzId']; $studentHttp= http('order-trial-delete/coach/student-list/'.$orderId.'/'.$classId, 'get', $this->authUsername); $students=formatResponse($studentHttp); if($students['status']==1){ $result['students']=$students['data']; } } } exit(json_encode($result)); } //读取删除学生列表 public function actionGetDeleteStudentByClassIdOrderId(){ $orderId=Req::post('orderId'); $classId=Req::post('classId'); $result['status']=0; $studentHttp= http('order-trial-delete/coach/student-list/'.$orderId.'/'.$classId, 'get', $this->authUsername); $students=formatResponse($studentHttp); if($students['status']==1){ $result['status']=1; $result['data']=$students['data']; } exit(json_encode($result)); } //服务费确认/提交异议 public function actionConfirmServiceCharge(){ $batchId=Req::post('batchId'); $verify=Req::post('verify'); $problem=Req::post('problem'); $result['status']=0; if(!$batchId){ $result['data']='参数异常'; exit(json_encode($result)); } if(!$verify) $verify=1; $params=array(); $params['batchId']=$batchId; $params['verify']=$verify; if($problem){ $params['problem']=$problem; } $http = http('coach-service-charge/coach/archive/update-status', 'PUT', $this->authUsername,$params); $response = formatResponse($http); if($response['status']==1){ $result['status']=1; }else{ $result['data']=$response['data']; } exit(json_encode($result)); } }