You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

61 lines
1.8 KiB

  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Steven
  5. * Date: 2016/8/12
  6. * Time: 14:36
  7. * 获取景点产品列表
  8. */
  9. header('Content_Type: application/xml;charset=utf-8');
  10. date_default_timezone_set('Asia/Shanghai');
  11. require_once 'commonUtil.class.php';
  12. /**
  13. * @param $sceneryName 景区关键字,支持模糊查询
  14. * @param string $page 当前页索引
  15. * @param string $pageSize 每页显示数
  16. * @return array|bool
  17. */
  18. function getProductInfo($sceneryName, $page="1", $pageSize="10")
  19. {
  20. $zzUtils = new zzUtils();
  21. //组装header
  22. $array_info['header'] = array();
  23. $base_array = $array_info['header'];
  24. $request_time = date("Y-m-d H:i:s", time()); //请求时间
  25. $array_header = array(
  26. "accountID" => app::$accountID,
  27. "serviceName" => 'GetProductList',
  28. "digitalSign" => $zzUtils->sign_md5(app::$accountID, app::$accountPassword, $request_time),
  29. "reqTime" => $request_time);
  30. $result_array = $zzUtils->addXml($base_array, $array_header);
  31. $array_info['header'] = $result_array;
  32. //组装body
  33. $array_info['body'] = array();
  34. $base_array = $array_info['body'];
  35. $array_body = array(
  36. "sceneryName" => $sceneryName,
  37. "page" => $page,
  38. "pageSize" => $pageSize
  39. );
  40. $result_array = $zzUtils->addXml($base_array, $array_body);
  41. $array_info['body'] = $result_array;
  42. $arr_result['request'] = $array_info;
  43. $res_xml = $zzUtils->array_to_xml($arr_result);
  44. $res = $zzUtils->xml_post_request(app::$url, $res_xml);
  45. $arr_res = $zzUtils->xml_to_array($res);
  46. $arrProductList = array();
  47. if ($arr_res['header']['rspCode'] == '0000') {
  48. foreach ($arr_res['body'] as $productInfo) {
  49. $arrProductList = $productInfo;
  50. }
  51. // var_dump($arrProductList);
  52. return $arrProductList;
  53. } else {
  54. return false;
  55. }
  56. }