This commit is contained in:
2026-03-17 16:48:52 +08:00
parent 895988cf27
commit 2f469d6b60
7 changed files with 436 additions and 1 deletions
+27
View File
@@ -4,8 +4,35 @@
namespace wchat\wx;
use Exception;
use wchat\common\Multiprogramming;
use wchat\wx\V3\Libs\WxMsgCrypt;
use wchat\wx\V3\Libs\XPayGoodsDeliverNotify;
class SmallProgram extends Multiprogramming
{
/**
* @param string $encrypt
* @param string $signature
* @param string $timestamp
* @param string $nonce
* @param string $msg_signature
* @return array|bool
* @throws Exception
*/
public function decode(string $encrypt, string $signature, string $timestamp, string $nonce, string $msg_signature): XPayGoodsDeliverNotify|bool
{
$WxMsgCrypt = new WxMsgCrypt($this->payConfig->notice['token'], $this->payConfig->notice['secret'], $this->payConfig->appId);
if (!$WxMsgCrypt->verifySignature($timestamp, $nonce, $encrypt, $msg_signature)) {
return false;
} else {
return XPayGoodsDeliverNotify::fromJson($WxMsgCrypt->decryptMsg($encrypt));
}
}
}