Skip to content

Commit

Permalink
spot post delete data
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouaini528 committed Apr 2, 2022
1 parent 32fa345 commit 5b454ae
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,31 +82,28 @@ protected function signature(){
foreach ($temp as $k=>$v) if(is_bool($v)) $temp[$k]=$v?'true':'false';

$this->signature = hash_hmac('sha256', urldecode(http_build_query($temp)), $this->secret);

/*switch ($this->platform) {
case 'spot':{
$this->signature = hash_hmac('sha256', urldecode(http_build_query($temp)), $this->secret,false);
echo $this->signature.PHP_EOL;
//$this->signature=base64_encode($this->signature);
//$this->signature=bin2hex($this->signature);
break;
}
case 'linear':
case 'inverse':{
$this->signature = hash_hmac('sha256', urldecode(http_build_query($temp)), $this->secret);
break;
}
}*/
}
}

/*
*
* */
protected function headers(){
$this->headers=[
'Content-Type' => 'application/json',
];
switch ($this->platform) {
case 'spot':{
if($this->type=='POST') {
$this->headers=[
'Content-Type' => 'application/x-www-form-urlencoded',
];
}
break;
}
default:{
$this->headers=[
'Content-Type' => 'application/json',
];
}
}
}

/*
Expand Down Expand Up @@ -137,6 +134,10 @@ protected function send(){

switch ($this->platform) {
case 'spot':{
if($this->type=='DELETE') {
$url.= '?'.http_build_query($this->data).($this->signature!=''?'&sign='.$this->signature:'');
break;
}
$this->options['form_params']=array_merge($temp,['sign'=>$this->signature]);
break;
}
Expand Down

0 comments on commit 5b454ae

Please sign in to comment.