Example #1
0
 public function query($data = array())
 {
     $return = array();
     if (!$data) {
         return false;
     }
     $busClient = new SoapClient(BUS_API_YC);
     $param = array('fields1' => $data['date'], 'fields2' => '', 'fields3' => $data['sst'], 'fields4' => $data['tst']);
     $key = md5($param['fields1'] . $param['fields2'] . $param['fields3'] . $param['fields4'] . BUS_CRYPT_KEY_YC);
     $param['fields5'] = $key;
     $obj = $busClient->queryBusData($param);
     if (!$obj || !$obj->return) {
         return false;
     }
     $ret = json_decode($obj->return, 1);
     if (!$ret['msg']) {
         $return['success'] = $ret['success'];
         $return['msg'] = $ret['msg'];
         return $return;
     }
     foreach ($ret['msg'] as $val) {
         $return['data'][] = array('departDate' => date('Y-m-d', strtotime($val['FIELDS1'])), 'busCode' => $val['FIELDS2'], 'departTime' => date('H:i', strtotime($val['FIELDS3'])), 'departStation' => $val['FIELDS4'], 'arriveStation' => $val['FIELDS5'], 'terminalStation' => $val['FIELDS6'], 'takeTime' => $val['FIELDS7'], 'seats' => $val['FIELDS8'], 'busLevel' => $val['FIELDS9'], 'remainTickets' => $val['FIELDS10'], 'startStation' => $val['FIELDS17'], 'fullPrice' => $val['FIELDS14'], 'halfPrice' => $val['FIELDS14'] / 2, 'verifyMessage' => '', 'mileages' => $val['FIELDS16'], 'arriveTime' => date('H:i', strtotime($val['FIELDS3']) + $val['FIELDS7'] * 3600), 'terminalStationCode' => $val['FIELDS11'], 'childsPrice' => $val['FIELDS15'], 'takePersonName' => $val['FIELDS18'], 'childsNumber' => $val['FIELDS19']);
     }
     return $return;
 }
Example #2
0
 public function query($data = array())
 {
     $return = array();
     if (!$data) {
         return false;
     }
     $busClient = new SoapClient(BUS_API);
     $key = md5(base64_encode($data['drive_date'] . $data['rst_name'] . $data['dst_name'] . BUS_CRYPT_KEY));
     $param = array('drive_date' => $data['drive_date'], 'rst_name' => $data['rst_name'], 'dst_name' => $data['dst_name'], 'verify_code' => $key);
     $obj = $busClient->queryBusData($param);
     if (!$obj || !$obj->return) {
         return false;
     }
     $ret = json_decode($obj->return, 1);
     if (!$ret['data']) {
         $return['success'] = $ret['success'];
         $return['msg'] = $ret['msg'];
         return $return;
     }
     foreach ($ret['data'] as $val) {
         $return['data'][] = array('departDate' => date('Y-m-d', strtotime($val['FIELDS1'])), 'busCode' => $val['FIELDS2'], 'departTime' => date('H:i', strtotime($val['FIELDS3'])), 'departStation' => $val['FIELDS4'], 'arriveStation' => $val['FIELDS5'], 'terminalStation' => $val['FIELDS6'], 'takeTime' => $val['FIELDS7'], 'seats' => $val['FIELDS8'], 'busLevel' => $val['FIELDS9'], 'remainTickets' => $val['FIELDS10'], 'startStation' => $val['FIELDS11'], 'fullPrice' => $val['FIELDS12'], 'halfPrice' => $val['FIELDS13'], 'verifyMessage' => $val['FIELDS14'], 'mileages' => $val['FIELDS15'], 'arriveTime' => date('H:i', strtotime($val['FIELDS3']) + $val['FIELDS7'] * 3600));
     }
     return $return;
 }