@@ -27,8 +27,7 @@ public function setConfig(ConfigInterface $config)
2727
2828 public function perform (OperationInterface $ operation )
2929 {
30- //$uri = sprintf($this->requestScheme, $operation->getName()). '/' . $this->config->getApiKey();
31- $ uri =$ this ->requestScheme ;
30+ $ uri = $ this ->requestScheme ;
3231 $ data = $ this ->authSignature ($ operation );
3332 $ return = $ this ->curlExec ($ uri , $ data );
3433 if (@$ return ['error_code ' ] == '40 ' || @$ return ['message ' ] == '令牌Access Token过期或不存在 ' ){
@@ -66,28 +65,19 @@ protected function curlExec($uri, $data){
6665 } catch (\GuzzleHttp \Exception \RequestException $ e ) {
6766 return json_decode ($ e ->getResponse ()->getBody (),true );
6867 }
69-
7068 }
7169
7270 protected function authSignature ( $ operation ){
7371 $ code_arr = $ operation ->getOperationParameter ();
7472 $ code_arr ['client_id ' ] = $ this ->config ->getApiKey ();
73+ $ code_arr ['method ' ] = $ operation ->getName ();
7574 $ code_arr ['access_token ' ] = $ this ->config ->getAccessToken ();
76- /*$code_arr['method'] = 'dh.products.get';
77- $code_arr['v'] = '1.0';*/
75+
7876 list ($ msec , $ sec ) = explode (' ' , microtime ());
7977 $ msectime = (float )sprintf ('%.0f ' , (floatval ($ msec ) + floatval ($ sec )) * 1000 );
80- $ code_arr ['timestamp ' ] =$ msectime ;
81- // $code_arr['_aop_datePattern'] = 'yyyy-MM-dd HH:mm:ss';
82- ksort ($ code_arr );
83- /* $sign_str = $url = '';
84- foreach ($code_arr as $key=>$val){
85- if(!$val) continue;
86- $sign_str .= $key . $val;
87- }
88- $sign_str = 'param2/1/aliexpress.open/' . $operation->getName() . '/' . $this->config->getApiKey() . $sign_str;
78+ $ code_arr ['timestamp ' ] = $ msectime ;
8979
90- $code_arr['_aop_signature'] = strtoupper(bin2hex(hash_hmac("sha1", $sign_str, $this->config->getApiSecret(), true)));*/
80+ ksort ( $ code_arr );
9181
9282 return $ code_arr ;
9383 }
0 commit comments