作者 竞泽

alter:排序

... ... @@ -112,8 +112,11 @@ class Client implements ClientInterface
'timestamp' => date('Y-m-d H:i:s'),
] + $pathQueryArray;
$data['sign'] = SignatureUtil::generate($data, Arr::get($this->config, 'app_secret'));
$response = $this->guzzleClient->request($this->request->getMethod(), $this->request->getPath(), [
$key => $data,
ksort($data);
$response = $this->guzzleClient->request($this->request->getMethod(), $this->request->getPath(), [
$key => array_filter($data, function ($v) {
return !(is_null($v) || $v === '');
}),
RequestOptions::HEADERS => [
'Content-Type' => 'application/json;charset=UTF-8',
]
... ...
... ... @@ -310,10 +310,11 @@ class OrdersB2cAddRequest extends Request
*/
public function appendOrderGoods($goods_id, $good_name, $price, $num, $dec_total, $deliveryItemId)
{
$item = ['index' => count($this->order_goods) + 1] + array_filter(get_defined_vars(), function ($v) {
$index = count($this->order_goods) + 1;
$item = ['index' => (string)$index] + array_filter(get_defined_vars(), function ($v) {
return !(is_null($v) || $v === '');
});
ksort($item);
return parent::append('order_goods', count($this->order_goods), $item);
}
... ...