修复签名生成bug

This commit is contained in:
2026-04-07 10:42:50 +08:00
parent b97d33a24f
commit 8b6727dac1
2 changed files with 7 additions and 6 deletions

View File

@@ -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]);

View File

@@ -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";