merchantIdsList
根据商户ID列表获取商户列表
请求地址 :
| 环境 | 提交方式 | HTTPS请求地址 |
|---|---|---|
| 正式环境 | POST | https://open.hexinpass.com:8501/api/merchantIdsList |
公共参数 :
| 参数 | 类型 | 是否必填 | 描述 | 示例值 |
|---|---|---|---|---|
| merchantId | []number | 是 | 商户ID列表 | array(232,256,287) |
| page | number | 是 | 页码 | 1 |
| pageSize | number | 是 | 页面大小 | 10 |
| lat | float | 是 | 纬度 | 31.0939034930 |
| lng | float | 是 | 经度 | 104.0939034930 |
| orders | number | 是 | 排序条件 | 2 |
PHP示例代码 :
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
class Demo {
public $pid = 'hxiaoming'; //第三方用户唯一凭证
public $secret = '850a554f3072867d52d56169201a9737';
//第三方用户唯一凭证密钥
public $tKweb = 'https://open.hexinpass.com:8501/';
//第三方接口地址
/** * 获取Token */
public function getToken()
{
$url =
$this->tKweb."/access/gettoken?pid=".$this->pid.'&secret='.$this->secret;
$res =
$this->requestPost($url);
return json_decode($res ,
true);
}
/** * 获取广告位列表 */
public function merchantIdsList()
{
$result = $this->getToken(); //获取token值
if( $result['errcode'] !== 0 && $result['msg']
!= 'success' )
{
die($result);
}
$token = $result['token'];
$params = array(
'merchantId' =>
array(234,236,238),
'page' =>
1,
'pageSize' =>
10,
'lng' =>
104.09349332,
'lat' =>
30.09349332,
'orders' =>
1,
);
$url =
$this->tKweb.'/api/merchantIdsList?token='.$token;
$res = $this->requestPost($url
,json_encode($params));
$result = json_decode($res , true);
$return $result;
}
/** * * 请求方式 * curl post */
public function requestPost($url , $params =
'')
{
$cn = curl_init();
curl_setopt($cn, CURLOPT_URL, $url);
curl_setopt($cn, CURLOPT_RETURNTRANSFER,
1);
curl_setopt($cn, CURLOPT_POST, true);
curl_setopt($cn, CURLOPT_POSTFIELDS,
$params);
curl_setopt($cn, CURLOPT_TIMEOUT, 30 );
$res = curl_exec($cn);
$httpCode =
curl_getinfo($cn,CURLINFO_HTTP_CODE);
curl_close($cn);
return $res;
}
}
//创建对象
$demo = new Demo();
//执行对象方法
$result = $demo->merchantIdsList();
//输出信息
print_r($result);
//返回成功信息
Array
(
[data] =>
[errcode] => 0
[msg] => success
)
|