|
以下是具体实现:
$client = new YZSignClient($appId, $appSecret);
$method = 'youzan.trade.get';//要调用的api名称
$methodVersion = '3.0.0';//要调用的api版本号
$params = [
'tid' => 'E20170424214154021889440',
//'fields' => 'buyer_message,trade_memo,status_str,payment,receiver_name,receiver_mobile,receiver_address',
];
$obj = $client->post($method, $methodVersion, $params, $files);
指定fields少数域,工作正常,返回如下数据:
string(274) "{"response":{"trade":{"status_str":"\u5df2\u5b8c\u6210","payment":"90.00","buyer_message":"","trade_memo":"","receiver_name":"\u90ed\u654f\u4e3d","receiver_address":"\u8bf8\u66a8\u5e02\u516b\u4e00\u65b0\u6751\u516d\u5e62\u4e00\u5355\u5143","receiver_mobile":"13567579055"}}}"
不指定fields,即返回对应trade的全部数据,返回出错,跟踪一下的话就是定位在json解码出错,也就是请求得到的原始数据有问题 |
|
|
|
|
|
|