|
- <?php
- /**
- * Created by PhpStorm.
- * User: Steven
- * Date: 2016/8/12
- * Time: 14:36
- * 获取景点产品列表
- */
- header('Content_Type: application/xml;charset=utf-8');
- date_default_timezone_set('Asia/Shanghai');
- require_once 'commonUtil.class.php';
- /**
- * @param $sceneryName 景区关键字,支持模糊查询
- * @param string $page 当前页索引
- * @param string $pageSize 每页显示数
- * @return array|bool
- */
-
- function getProductInfo($sceneryName, $page="1", $pageSize="10")
- {
- $zzUtils = new zzUtils();
- //组装header
- $array_info['header'] = array();
- $base_array = $array_info['header'];
- $request_time = date("Y-m-d H:i:s", time()); //请求时间
- $array_header = array(
- "accountID" => app::$accountID,
- "serviceName" => 'GetProductList',
- "digitalSign" => $zzUtils->sign_md5(app::$accountID, app::$accountPassword, $request_time),
- "reqTime" => $request_time);
- $result_array = $zzUtils->addXml($base_array, $array_header);
- $array_info['header'] = $result_array;
-
- //组装body
- $array_info['body'] = array();
- $base_array = $array_info['body'];
- $array_body = array(
- "sceneryName" => $sceneryName,
- "page" => $page,
- "pageSize" => $pageSize
- );
- $result_array = $zzUtils->addXml($base_array, $array_body);
- $array_info['body'] = $result_array;
- $arr_result['request'] = $array_info;
- $res_xml = $zzUtils->array_to_xml($arr_result);
- $res = $zzUtils->xml_post_request(app::$url, $res_xml);
- $arr_res = $zzUtils->xml_to_array($res);
- $arrProductList = array();
- if ($arr_res['header']['rspCode'] == '0000') {
- foreach ($arr_res['body'] as $productInfo) {
- $arrProductList = $productInfo;
- }
- // var_dump($arrProductList);
- return $arrProductList;
- } else {
- return false;
- }
-
-
- }
|