This commit is contained in:
aozhiwei 2023-08-07 11:00:19 +08:00
parent 215896534a
commit cac2a11948

View File

@ -47,9 +47,9 @@ class InAppPurchase {
public function process() public function process()
{ {
error_log('InappPurchase:' . json_encode($_REQUEST));
error_log('----- inappPurchaseDiamonds -----');
$data = json_decode(file_get_contents('php://input'), true); $data = json_decode(file_get_contents('php://input'), true);
error_log('InappPurchase:' . json_encode($_REQUEST));
error_log('----- inappPurchaseDiamonds -----' . json_encode($data));
if (!$this->verifySign($data)) { if (!$this->verifySign($data)) {
myself()->_rspErr(1, "signature error"); myself()->_rspErr(1, "signature error");
@ -82,9 +82,9 @@ class InAppPurchase {
} }
} }
$signStr = 'channel=' . $channel . '&' . implode("&", $strings); $signStr = 'channel=' . $channel . '&' . implode("&", $strings);
error_log('InAppPurchase verify ' . $signStr);
$signature = hash_hmac('sha256', $sign, BUY_SERVER_PKEY); $signature = hash_hmac('sha256', $signStr, BUY_SERVER_PKEY);
error_log('InAppPurchase verify ' . $signStr . ' sign1=' . $sign . ' sign2=' . $signature);
return $sign == $signature; return $sign == $signature;
} }