|
@@ -44,7 +44,7 @@ class DingCallbackCrypto
|
|
|
if ($ret != 0) {
|
|
|
//return $ret;
|
|
|
// return ['ErrorCode'=>$ret, 'data' => ''];
|
|
|
- throw new Exception('AES加密错误',ErrorCode::$EncryptAESError);
|
|
|
+ throw new \Exception('AES加密错误',ErrorCode::$EncryptAESError);
|
|
|
}
|
|
|
|
|
|
if ($timeStamp == null) {
|
|
@@ -57,7 +57,7 @@ class DingCallbackCrypto
|
|
|
$ret = $array[0];
|
|
|
if ($ret != 0) {
|
|
|
//return $ret;
|
|
|
- throw new Exception('ComputeSignatureError',ErrorCode::$ComputeSignatureError);
|
|
|
+ throw new \Exception('ComputeSignatureError',ErrorCode::$ComputeSignatureError);
|
|
|
}
|
|
|
$signature = $array[1];
|
|
|
|
|
@@ -79,7 +79,7 @@ class DingCallbackCrypto
|
|
|
if (strlen($this->m_encodingAesKey) != 43) {
|
|
|
//return ErrorCode::$IllegalAesKey;
|
|
|
// return ['ErrorCode'=>ErrorCode::$IllegalAesKey, 'data' => ''];
|
|
|
- throw new Exception('IllegalAesKey',ErrorCode::$IllegalAesKey);
|
|
|
+ throw new \Exception('IllegalAesKey',ErrorCode::$IllegalAesKey);
|
|
|
}
|
|
|
|
|
|
$pc = new Prpcrypt($this->m_encodingAesKey);
|
|
@@ -95,14 +95,14 @@ class DingCallbackCrypto
|
|
|
if ($ret != 0) {
|
|
|
//return $ret;
|
|
|
// return ['ErrorCode'=>$ret, 'data' => ''];
|
|
|
- throw new Exception('ComputeSignatureError',ErrorCode::$ComputeSignatureError);
|
|
|
+ throw new \Exception('ComputeSignatureError',ErrorCode::$ComputeSignatureError);
|
|
|
}
|
|
|
|
|
|
$verifySignature = $array[1];
|
|
|
if ($verifySignature != $signature) {
|
|
|
//return ErrorCode::$ValidateSignatureError;
|
|
|
//return ['ErrorCode'=>ErrorCode::$ValidateSignatureError, 'data' => ''];
|
|
|
- throw new Exception('ValidateSignatureError',ErrorCode::$ValidateSignatureError);
|
|
|
+ throw new \Exception('ValidateSignatureError',ErrorCode::$ValidateSignatureError);
|
|
|
}
|
|
|
|
|
|
$result = $pc->decrypt($encrypt, $this->m_corpId);
|
|
@@ -110,7 +110,7 @@ class DingCallbackCrypto
|
|
|
if ($result[0] != 0) {
|
|
|
//return $result[0];
|
|
|
// return ['ErrorCode'=>$result[0], 'data' => ''];
|
|
|
- throw new Exception('DecryptAESError',ErrorCode::$DecryptAESError);
|
|
|
+ throw new \Exception('DecryptAESError',ErrorCode::$DecryptAESError);
|
|
|
}
|
|
|
$decryptMsg = $result[1];
|
|
|
//return ErrorCode::$OK;
|
|
@@ -128,7 +128,7 @@ class SHA1
|
|
|
sort($array, SORT_STRING);
|
|
|
$str = implode($array);
|
|
|
return array(ErrorCode::$OK, sha1($str));
|
|
|
- } catch (Exception $e) {
|
|
|
+ } catch (\Exception $e) {
|
|
|
print $e . "\n";
|
|
|
return array(ErrorCode::$ComputeSignatureError, null);
|
|
|
}
|
|
@@ -229,7 +229,7 @@ class Prpcrypt
|
|
|
//print(base64_encode($encrypted));
|
|
|
//使用BASE64对加密后的字符串进行编码
|
|
|
return array(ErrorCode::$OK, base64_encode($encrypted));
|
|
|
- } catch (Exception $e) {
|
|
|
+ } catch (\Exception $e) {
|
|
|
print $e;
|
|
|
return array(ErrorCode::$EncryptAESError, null);
|
|
|
}
|
|
@@ -252,7 +252,7 @@ class Prpcrypt
|
|
|
|
|
|
|
|
|
// return $decrypted;
|
|
|
- } catch (Exception $e) {
|
|
|
+ } catch (\Exception $e) {
|
|
|
return array(ErrorCode::$DecryptAESError, null);
|
|
|
}
|
|
|
|
|
@@ -269,7 +269,7 @@ class Prpcrypt
|
|
|
$xml_len = $len_list[1];
|
|
|
$xml_content = substr($content, 4, $xml_len);
|
|
|
$from_corpid = substr($content, $xml_len + 4);
|
|
|
- } catch (Exception $e) {
|
|
|
+ } catch (\Exception $e) {
|
|
|
print $e;
|
|
|
return array(ErrorCode::$DecryptAESError, null);
|
|
|
}
|