From ff8bc949bd518abe3e2f0cea24a583dd3e27ca16 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 14 Jul 2023 20:38:49 +0800 Subject: [PATCH] 1 --- webapp/services/callback/GameItemMarketBuyOk.php | 2 ++ webapp/services/callback/common/SignatureService.php | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/webapp/services/callback/GameItemMarketBuyOk.php b/webapp/services/callback/GameItemMarketBuyOk.php index ed5424bd..0732112e 100644 --- a/webapp/services/callback/GameItemMarketBuyOk.php +++ b/webapp/services/callback/GameItemMarketBuyOk.php @@ -5,6 +5,7 @@ namespace services; require_once('phpcommon/bchelper.php'); require_once('services/callback/BuyPassCbService.php'); require_once('services/callback/BuyShopGoodsCbService.php'); +require_once ('services/callback/common/SignatureService.php'); require_once('ShopAddItemService.php'); use phpcommon\SqlHelper; @@ -15,6 +16,7 @@ class GameItemMarketBuyOk public function process() { + SignatureService::web3ServiceCheck(); $itemService = new ShopAddItemService(); $address = getReqVal('address', ''); $orderId = getReqVal('order_id', ''); diff --git a/webapp/services/callback/common/SignatureService.php b/webapp/services/callback/common/SignatureService.php index 607f71e5..4b5e44f9 100644 --- a/webapp/services/callback/common/SignatureService.php +++ b/webapp/services/callback/common/SignatureService.php @@ -2,6 +2,8 @@ namespace services; +use phpcommon\SqlHelper; + class SignatureService { const ERRCODE_SIGN_ERROR = 2001; @@ -24,7 +26,7 @@ class SignatureService { $sign = self::normalMd5Sign($_REQUEST, $row['secret_key'], array('_sign')); if ($sign != $row['signature']) { error_log('error sign2:' . json_encode($_REQUEST)); - myself()-_rspErr(self::ERRCODE_SIGN_ERROR, 'sign error'); + myself()->_rspErr(self::ERRCODE_SIGN_ERROR, 'sign error'); die(); } } @@ -32,12 +34,13 @@ class SignatureService { public static function normalMd5Sign($params, $secretKey, $excludeKeys){ ksort($params); $paramsStr = ''; + $connStr = '&'; foreach($params as $key => $val){ if (!in_array($key, $excludeKeys)) { $paramsStr = $paramsStr . $key . '=' . $val . $connStr; } } - return md5($paramsStr . $$secretKey); + return md5($paramsStr . $secretKey); } }