Commit 4bd23451 authored by 杨培's avatar 杨培

更新部分参数名

parent 24d4dd7a
......@@ -81,7 +81,7 @@ abstract class Client
$url = $instance->apiUrl.(strpos($instance->apiUrl, '?') !== false ? '&' : '?').'api='.urlencode($api);
list($sign, $timestamp, $nonce) = $instance->signature($api, $params);
$url .= "&id={$instance->clientId}&sign={$sign}&timestamp={$timestamp}&nonce={$nonce}";
$url .= "&client_id={$instance->clientId}&sign={$sign}&timestamp={$timestamp}&nonce={$nonce}";
list($httpCode, $response) = $instance->request($url, $params);
......@@ -119,7 +119,7 @@ abstract class Client
return [$sign, $timestamp, $nonce];
}
protected function request($url, $post = '', $headers = array()) {
protected function request($url, $post='', $headers=array()) {
$ci = curl_init();
/* Curl settings */
curl_setopt($ci, CURLOPT_USERAGENT, 'PHP/'.PHP_VERSION.' Client/'.$this->clientId);
......@@ -130,10 +130,11 @@ abstract class Client
//curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader'));
curl_setopt($ci, CURLOPT_HEADER, FALSE);
curl_setopt($ci, CURLOPT_POST, TRUE);
$post = is_array($post) ? http_build_query($post) : $post;
$post && curl_setopt($ci, CURLOPT_POSTFIELDS, $post);
if ($post) {
curl_setopt($ci, CURLOPT_POST, TRUE);
$post = is_array($post) ? http_build_query($post) : $post;
$post && curl_setopt($ci, CURLOPT_POSTFIELDS, $post);
}
curl_setopt($ci, CURLOPT_URL, $url);
curl_setopt($ci, CURLOPT_HTTPHEADER, $headers);
......
......@@ -109,7 +109,7 @@ class Server
protected function checkSign()
{
$api = isset($_GET['api']) ? $_GET['api'] : '';
$clientId = isset($_GET['id']) ? $_GET['id'] : null;
$clientId = isset($_GET['client_id']) ? $_GET['client_id'] : null;
$sign = isset($_GET['sign']) ? $_GET['sign'] : '';
$timestamp = isset($_GET['timestamp']) ? $_GET['timestamp'] : 0;
$nonce = isset($_GET['nonce']) ? $_GET['nonce'] : '';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment