request->get('current_page',1); $page_size=Yii::$app->request->get('page_size',10); $start_area = Yii::$app->request->get('start_area',''); $end_area = Yii::$app->request->get('end_area',''); $line = Yii::$app->request->get('line',''); $start_date = Yii::$app->request->get('start_date',date("Y-m-d", strtotime('+1 day'))); $end_date = Yii::$app->request->get('end_date',date("Y-m-d", strtotime('+1 day'))); $run_status = Yii::$app->request->get('run_status','138'); $bus_type = Yii::$app->request->get('bus_type','0'); $hour = Yii::$app->request->get('hour','-1'); $minute = Yii::$app->request->get('minute','-1'); $order_rule = Yii::$app->request->get('order_rule','1'); $user_id = Yii::$app->request->cookies->getValue('user_id',-1); if ($hour==-1||$minute==-1){ $hour=$minute=-1; }else{ if ($hour!=''&&intval($hour)<10){ $hour = '0'.$hour; } if ($minute!=''&&intval($minute)<10){ $minute = '0'.$minute; } } if($start_date == ''){ $start_date = date("Y-m-d", strtotime('+1 day')); } if($end_date == ''){ $end_date = date("Y-m-d", strtotime('+1 day')); } $run_time = $hour .':'. $minute; $http_data = array( 'current_page' => $current_page, 'page_size' => $page_size, 'start_area' =>trim($start_area) , 'end_area' =>trim($end_area), 'line' =>trim($line), 'start_date' => $start_date, 'end_date' => $end_date, 'run_status' => $run_status, 'bus_type' => $bus_type, 'time' => $run_time, 'user_id'=>$user_id, 'order_rule'=>$order_rule ); $res_data= Utils::httpRequest('http://'.CS1_DOMAIN.'/api/run-info/get-run-list',$http_data); $data = json_decode($res_data,true); return $this->render('run-list',$data); } /** * Function Description:班次审核 启用 停用 * Function Name: actionRunStatusUpdate * * @return mixed|string * * @author 冒炎 */ public function actionRunStatusUpdate(){ $allrunid = Yii::$app->request->post('allrunid',-1); $runstatus = Yii::$app->request->post('status',-1); if($allrunid == -1||$runstatus==-1){ $data = [ 'errcode'=>'1', 'errinfo'=>'缺少必要参数' ]; return json_encode($data); } $yii_url = 'http://'.CS1_DOMAIN.'/api/dynamic-bus/run-status-update'; $send_data = [ 'all_run_id'=>$allrunid, 'run_status'=>$runstatus ]; $res = Utils::httpRequest($yii_url,$send_data); $r = json_decode($res,true); if( $r['errcode'] == 0){ $sql1 = "CALL SP_REFRESH_RUN_BUS_STATUS()"; Yii::$app->db->createCommand($sql1)->query(); } return $res; } /** * Function Description:加载添加班次页面 * Function Name: actionAddRun * * @return string * * @author 冒炎 */ public function actionAddRun(){ return $this->render('run-add'); } /** * Function Description:根据关键词搜索线路 * Function Name: actionSearchLine * * @return string * * @author 冒炎 */ public function actionSearchLine(){ $search = Yii::$app->request->post('line',''); $user_id = Yii::$app->request->cookies->getValue('user_id',-1); $logic = new RunBusManage(); $data = $logic->searchLine($search,$user_id); return json_encode($data); } /** * Function Description:获取该线路相关的票种车辆以及站点信息 * Function Name: actionThroughStation * * @return string * * @author 冒炎 */ public function actionThroughStation(){ $line_id = Yii::$app->request->post('line_id',''); $logic = new RunBusManage(); $data = $logic->getLineInfo($line_id); return json_encode($data); } /** * Function Description:添加班次数据保存 * Function Name: actionRunBusAddSave * * @return mixed * * @author 冒炎 */ public function actionRunBusAddSave(){ $lineid=Yii::$app->request->get('lineid',''); $startime=Yii::$app->request->get('startime',''); $endtime=Yii::$app->request->get('endtime',''); $week=Yii::$app->request->get('week',''); $allstation=Yii::$app->request->get('allstation',''); $allcar=Yii::$app->request->get('allcar',''); $allticket=Yii::$app->request->get('allticket',''); $sellday=Yii::$app->request->get('sellday',''); $current_time=date("Y-m-d H:i:s");//获取当前时间 $userid = Yii::$app->request->cookies->getValue('user_id',-1); $yii_url = 'http://'.CS1_DOMAIN.'/api/dynamic-bus/run-bus-new-save'; $send_data = array( 'line_id'=>$lineid, 'start_time'=>$startime, 'end_time'=>$endtime, 'week'=>$week, 'all_station'=>$allstation, 'all_car'=>$allcar, 'all_ticket'=>$allticket, 'sell_day'=>$sellday, 'current_time'=>$current_time, 'user_id'=>$userid ); $res = Utils::httpRequest($yii_url,$send_data); return $res; } /** * Function Description:加载班次更新界面 * Function Name: actionRunBusUpdate * * @return string * * @author 冒炎 */ public function actionRunBusUpdate(){ $run_id = Yii::$app->request->get('run_id',''); $data = ['run_id'=>$run_id]; return $this->render('run-upt',$data); } /** * Function Description:班次更新页面数据 * Function Name: actionGetRunInfo * * @return mixed * * @author 冒炎 */ public function actionGetRunInfo(){ $user_id = Yii::$app->request->post('user_id',1); $run_id = Yii::$app->request->post('run_id',''); $send_data = [ 'user_id'=>$user_id, 'run_id'=>$run_id ]; $res = Utils::httpRequest('http://'.CS1_DOMAIN.'/api/run-edit/get-run-info',$send_data); return $res; } /** * Function Description:班次更新数据保存 * Function Name: actionRunUpdateSave * * @return mixed|string * * @author 冒炎 */ public function actionRunUpdateSave(){ $runid = Yii::$app->request->get('runid',''); $startime = Yii::$app->request->get('startime',''); $allstation = Yii::$app->request->get('allstation',''); $allcar = Yii::$app->request->get('allcar',''); $allticket = Yii::$app->request->get('allticket',''); $sellday = Yii::$app->request->get('sellday',''); $userid = Yii::$app->request->cookies->getValue('user_id',-1); $logic = new RunBusManage(); $data =$logic->runUpdateSave($runid,$startime,$allstation,$allcar,$allticket,$sellday,$userid); return $data; } /** * Function Description:加载班次详情页面 * Function Name: actionRunDetail * * @return string * * @author 冒炎 */ public function actionRunDetail(){ $run_id = Yii::$app->request->get('run_id',''); $data = ['run_id'=>$run_id]; return $this->render('run-detail',$data); } /** * Function Description:获取班次详情数据 * Function Name: actionGetRunDetail * * @return mixed * * @author 冒炎 */ public function actionGetRunDetail(){ $user_id = Yii::$app->request->post('user_id',1); $run_id = Yii::$app->request->post('run_id',''); $send_data = [ 'user_id'=>$user_id, 'run_id'=>$run_id ]; $res = Utils::httpRequest('http://'.CS1_DOMAIN.'/api/run-info/get-run-info',$send_data); return $res; } /** * Function Description:加载票种详情界面 * Function Name: actionTicketDetail * * @return string * * @author 冒炎 */ public function actionTicketDetail(){ $order_id = Yii::$app->request->get('order_id',''); $data= ['order_id'=>$order_id]; return $this->render('ticket-detail',$data); } /** * Function Description:获取订单票种信息 * Function Name: actionGetTicketDetail * * @return string * * @author 冒炎 */ public function actionGetTicketDetail(){ $order_id = Yii::$app->request->post('order_id',0); $logic = new RunBusManage(); $data = $logic->getTicketDetail($order_id); return json_encode($data); } /** * Function Description:获取已售人数信息 * Function Name: actionGetRunBusPassenger * * @return string * * @author 冒炎 */ public function actionGetRunBusPassenger(){ $run_id = Yii::$app->request->post('run_id',0); $bus_order_id = Yii::$app->request->post('bus_order_id',0); if ( $run_id == 0 || $bus_order_id == 0){ return json_encode(array("code"=>"1","info"=>"参数不正确")); } $logic = new RunBusManage(); $data = $logic->getRunBusPassenger($run_id,$bus_order_id); return json_encode($data); } /** * Des:获取班次站点信息列表 * Name: actionGetRunStationList * @author 倪宗锋 */ public function actionGetRunStationList() { $run_id = Yii::$app->request->post('run_id', 0);//班次ID $bus_order_id = Yii::$app->request->post('bus_order_id', 0);//车型序号 $logic = new RunBusManage(); $getList = $logic->getRunStationList($run_id, $bus_order_id);//获取班次车次站点数据 return json_encode($getList); } /** * Des:设则班次车子站的晚点时间 * Name: actionSetDelayVal * @return string * @author 倪宗锋 */ public function actionSetDelayVal() { $params = [ 'run_id' => Yii::$app->request->post('run_id', 0),//班次ID 'bus_order_id' => Yii::$app->request->post('bus_order_id', 0),//车型序号 'seq_id' => Yii::$app->request->post('seq_id', 0),//站点序号 'val' => Yii::$app->request->post('val', 0),//晚点时间 'res_id' => Yii::$app->request->post('res_id', 0),//站点ID 'res_name' => Yii::$app->request->post('res_name', 0),//站点名称 ]; $logic = new RunBusManage(); $setDelayVal = $logic->setDelayVal($params); return json_encode($setDelayVal); } /** * Des:发送晚点短信通知 * Name: actionSendDelayMsg * @author 倪宗锋 */ public function actionSendDelayMsg() { $params = [ 'run_id' => Yii::$app->request->post('run_id', 0),//班次ID 'bus_order_id' => Yii::$app->request->post('bus_order_id', 0),//车型序号 'reason' => Yii::$app->request->post('reason', '路上拥堵'),//原因 'seq_id' => Yii::$app->request->post('seq_id', 0),//站点序号 ]; $logic = new RunBusManage(); $setDelayVal = $logic->sendDelayMsg($params); return json_encode($setDelayVal); } }