From a7f362b6595aa6d06b05fc79932ff09ef2456265 Mon Sep 17 00:00:00 2001 From: reddrake Date: Fri, 13 Oct 2017 14:29:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=AF=B7=E6=B1=82=E7=B1=BB?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Request/Request.php | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/Request/Request.php b/src/Request/Request.php index 5396ef2..e140e42 100644 --- a/src/Request/Request.php +++ b/src/Request/Request.php @@ -27,8 +27,7 @@ public function setConfig(ConfigInterface $config) public function perform(OperationInterface $operation) { - //$uri = sprintf($this->requestScheme, $operation->getName()). '/' . $this->config->getApiKey(); - $uri=$this->requestScheme; + $uri = $this->requestScheme; $data = $this->authSignature($operation); $return = $this->curlExec($uri, $data); if(@$return['error_code'] == '40' || @$return['message'] == '令牌Access Token过期或不存在'){ @@ -66,28 +65,19 @@ protected function curlExec($uri, $data){ } catch (\GuzzleHttp\Exception\RequestException $e) { return json_decode($e->getResponse()->getBody(),true); } - } protected function authSignature( $operation ){ $code_arr = $operation->getOperationParameter(); $code_arr['client_id'] = $this->config->getApiKey(); + $code_arr['method'] = $operation->getName(); $code_arr['access_token'] = $this->config->getAccessToken(); - /*$code_arr['method'] = 'dh.products.get'; - $code_arr['v'] = '1.0';*/ + list($msec, $sec) = explode(' ', microtime()); $msectime = (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000); - $code_arr['timestamp'] =$msectime; - // $code_arr['_aop_datePattern'] = 'yyyy-MM-dd HH:mm:ss'; - ksort($code_arr); - /* $sign_str = $url = ''; - foreach ($code_arr as $key=>$val){ - if(!$val) continue; - $sign_str .= $key . $val; - } - $sign_str = 'param2/1/aliexpress.open/' . $operation->getName() . '/' . $this->config->getApiKey() . $sign_str; + $code_arr['timestamp'] = $msectime; - $code_arr['_aop_signature'] = strtoupper(bin2hex(hash_hmac("sha1", $sign_str, $this->config->getApiSecret(), true)));*/ + ksort($code_arr); return $code_arr; }