修复签名生成bug
This commit is contained in:
@@ -173,7 +173,7 @@ class Playx extends Api
|
||||
if ($sig === '' || $ts === '' || $rid === '') {
|
||||
return $this->error(__('Daily push signature missing or incomplete'), null, 0, ['statusCode' => 401]);
|
||||
}
|
||||
$canonical = $ts . "\n" . $rid . "\nPOST\n/api/v1/playx/daily-push\n" . hash('sha256', json_encode($body));
|
||||
$canonical = $ts . "\n" . $rid . "\nPOST\n/api/v1/mall/dailyPush\n" . hash('sha256', json_encode($body));
|
||||
$expected = hash_hmac('sha256', $canonical, $secret);
|
||||
if (!hash_equals($expected, $sig)) {
|
||||
return $this->error(__('Daily push signature verification failed'), null, 0, ['statusCode' => 401]);
|
||||
|
||||
11
tmp_sig.php
11
tmp_sig.php
@@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
//脚本执行指令 php tmp_sig.php
|
||||
$secret = '5590a339502b133f4d0c545c3cdad159a4827dfccb3f51bb110c56f9b96568ca';
|
||||
$ts = '1700000123';
|
||||
$rid = 'req_1700000000_234567';
|
||||
$ts = '1775525663';
|
||||
$rid = 'req_1775525663_123';
|
||||
$body = [
|
||||
'report_date' => '1700000123',
|
||||
'report_date' => '1775525663',
|
||||
'member' => [
|
||||
[
|
||||
'member_id' => '234567',
|
||||
'member_id' => '123',
|
||||
'login' => 'zhenhui',
|
||||
'ltv_deposit' => 1500,
|
||||
'ltv_withdrawal' => 1800,
|
||||
@@ -18,7 +19,7 @@ $body = [
|
||||
];
|
||||
|
||||
$json = json_encode($body);
|
||||
$canonical = $ts . "\n" . $rid . "\nPOST\n/api/v1/playx/daily-push\n" . hash('sha256', $json);
|
||||
$canonical = $ts . "\n" . $rid . "\nPOST\n/api/v1/mall/dailyPush\n" . hash('sha256', $json);
|
||||
|
||||
echo "json={$json}\n";
|
||||
echo "sha256=" . hash('sha256', $json) . "\n";
|
||||
|
||||
Reference in New Issue
Block a user