add clear

This commit is contained in:
as2252258@163.com
2019-07-17 17:43:08 +08:00
parent fe00523740
commit 9d97fa2808
+8 -2
View File
@@ -16,7 +16,8 @@ class Help extends Miniprogarampage
* @param $encryptedData * @param $encryptedData
* @param $iv * @param $iv
* @param $sessionKey * @param $sessionKey
* @return object * @param $asArray
* @return object|array
* @throws * @throws
* *
* * <li>-41001: encodingAesKey 非法</li> * * <li>-41001: encodingAesKey 非法</li>
@@ -25,7 +26,7 @@ class Help extends Miniprogarampage
* <li>-41005: base64加密失败</li> * <li>-41005: base64加密失败</li>
* <li>-41016: base64解密失败</li> * <li>-41016: base64解密失败</li>
*/ */
public static function decode($encryptedData, $iv, $sessionKey) public static function decode($encryptedData, $iv, $sessionKey, $asArray = false)
{ {
$config = Wx::getMiniProGaRamPage()->getConfig(); $config = Wx::getMiniProGaRamPage()->getConfig();
if (strlen($sessionKey) != 24) { if (strlen($sessionKey) != 24) {
@@ -48,6 +49,11 @@ class Help extends Miniprogarampage
if ($dataObj->watermark->appid != $config->getAppid()) { if ($dataObj->watermark->appid != $config->getAppid()) {
throw new \Exception('aes 解密失败', self::$IllegalBuffer); throw new \Exception('aes 解密失败', self::$IllegalBuffer);
} }
if ($asArray) {
return get_object_vars($dataObj);
}
return $dataObj; return $dataObj;
} }