|
- <?php
- /*
- Author:ZSQ
- Compeny:Spiders Travel
- */
- require_once '../Common/Mysql.php';
-
- header("Access-Control-Allow-Origin:*");
-
- $method=isset($_GET['method'])?$_GET['method']:"";
- if($method==""){
- echo json_encode(array("code"=>"-1","info"=>"没有method"));
- exit();
- }
- //$user_id=getUserId();
- //if ($user_id ===false){
- // echo json_encode(array("errcode"=>1,"errinfo"=>"用户未登录"));
- // exit;
- //}
-
-
-
- if($method=="get_run_back_station"){
- $pdo=conn();
- $cur_run_id=isset($_GET['cur_run_id'])?$_GET['cur_run_id']:'';
- $date_f= isset($_GET['date_f'])?$_GET['date_f']:'';
- $sql="CALL SP_GET_RUN_BACK_STATION('".$date_f."',".$cur_run_id.")";
- writeLog('get_run_back_station sql='.$sql);
- if($pdo){
- $result=$pdo->query($sql);
-
- if($result){
- $re_da=array();
- $data['code']='0';
- $data['info']='';
- do{
- $rowset=$result->fetchAll(PDO::FETCH_ASSOC);
- $re_da[]=isset($rowset)?$rowset:array();
- }while($result->nextRowset());
- $data['start_station_list']=$re_da[0];
- $data['end_station_list']=$re_da[1];
- }else{
- $data['code']="400";
- $data['info']="mysql sql error fail";
- }
- }else{
- $data['code']="500";
- $data['info']="mysql conn error fail";
- }
-
- echo json_encode($data);
- exit();
- }else if($method=="get_run_back_info"){
- $pdo=conn();
- $f_run_id=isset($_GET['f_run_id'])?$_GET['f_run_id']:"";
- $f_st_res_id=isset($_GET['f_st_res_id'])?$_GET['f_st_res_id']:"";
- $f_end_res_id=isset($_GET['f_end_res_id'])?$_GET['f_end_res_id']:"";
- if($f_run_id=="" || $f_st_res_id=="" || $f_end_res_id==""){
- echo json_encode(array("code"=>"-1","info"=>"缺少参数"));
- exit();
- }
- $sql="CALL SP_GET_BACK_INFO('".$f_run_id."','".$f_st_res_id."','".$f_end_res_id."')";
- writeLog('get_run_back_info sql='.$sql);
- $result=$pdo->query($sql);
- $data=array();
- $rowset=$result->fetchAll(PDO::FETCH_ASSOC);
- $data['code']='0';
- $data['info']='';
- $data['run_id']=isset($rowset[0]) ? $rowset[0]['run_id'] : "";
- $data['prod_id']=isset($rowset[0]) ?$rowset[0]['prod_id'] : "";
- echo json_encode($data);
- exit();
- }
|