diff --git a/application/third_party/trainsystem/controllers/pages.php b/application/third_party/trainsystem/controllers/pages.php index 7fd3259b..be166a2c 100644 --- a/application/third_party/trainsystem/controllers/pages.php +++ b/application/third_party/trainsystem/controllers/pages.php @@ -63,7 +63,8 @@ class pages extends CI_Controller{ // }else{ // $list->balance = "NULL"; // } - $list->balance = "NULL"; + //查询澜海余额 + $list->balance = $this->lanhai_accountBalance(); // print_r(json_encode($list)); $this->load->view('common/header'); $this->load->view('homepage',$list); @@ -391,6 +392,39 @@ class pages extends CI_Controller{ } } + //查询澜海余额 + public function lanhai_accountBalance(){ + + $microtime = get_microtime(); //时间戳 + //生成接口请求头参数 + $timestamp = $microtime; + $appId = LANHAI_appId; + + //拼接发送的报文 + $PostData = new stdClass(); + $PostData->authentication = new stdClass(); + $PostData->authentication->dataId = null; + $PostData->authentication->timestamp = $timestamp; + $PostData->authentication->appId = $appId; + $url = LANHAI_URL."api/open/query/accountBalance"; + // echo json_encode($PostData); + // die(); + + $ResponseJson = GetPost_http($url,json_encode($PostData),'json'); + $ResponseData = json_decode($ResponseJson); + if (isset($ResponseData->data)){ + // //需要解密 + $this->load->library("aesLanhai"); + $aesUnit = new Security(); + $data = json_decode($aesUnit->decryptData($ResponseData->data)); + return $data; + }else{ + + return "无结果"; + } + + } + //循环展示JSON private function handle_array($arr,$type,&$array_to_fill){ foreach($arr as $key => $value){ diff --git a/application/third_party/trainsystem/views/homepage.php b/application/third_party/trainsystem/views/homepage.php index 718ab26a..dbc736fa 100644 --- a/application/third_party/trainsystem/views/homepage.php +++ b/application/third_party/trainsystem/views/homepage.php @@ -77,7 +77,7 @@ function selseat(seat){