|
|
@@ -248,7 +248,6 @@ class WxpayV2{
|
|
|
public function notifyCheckSign($inBody){
|
|
|
$apiv2Key = $this->config["ApiV2Key"];// 在商户平台上设置的APIv2密钥
|
|
|
$inBodyArray = Transformer::toArray($inBody);
|
|
|
- var_dump($inBodyArray);
|
|
|
$signType = empty($inBodyArray["sign_type"]) ? Hash::ALGO_MD5 : $inBodyArray["sign_type"];
|
|
|
$sign = $inBodyArray["sign"];
|
|
|
$calculated = Hash::sign(
|
|
|
@@ -259,10 +258,16 @@ class WxpayV2{
|
|
|
$signatureStatus = Hash::equals($calculated, $sign);
|
|
|
if ($signatureStatus) {
|
|
|
// 如需要解密的
|
|
|
- ['req_info' => $reqInfo] = $inBodyArray;
|
|
|
- $inBodyReqInfoXml = AesEcb::decrypt($reqInfo, Hash::md5($apiv2Key));
|
|
|
- $inBodyReqInfoArray = Transformer::toArray($inBodyReqInfoXml);
|
|
|
- return $inBodyReqInfoArray;
|
|
|
+ $inBodyReqInfoArray = null;
|
|
|
+ if(!empty($inBodyArray['req_info'])){
|
|
|
+ $reqInfo = $inBodyArray['req_info'];
|
|
|
+ $inBodyReqInfoXml = AesEcb::decrypt($reqInfo, Hash::md5($apiv2Key));
|
|
|
+ $inBodyReqInfoArray = Transformer::toArray($inBodyReqInfoXml);
|
|
|
+ }
|
|
|
+ return [
|
|
|
+ "data"=>$inBodyArray,//消息体
|
|
|
+ "info"=>$inBodyReqInfoArray//解密数据
|
|
|
+ ];
|
|
|
}
|
|
|
return $signatureStatus;
|
|
|
}
|