protected function attemptEncrypt($message)
{
//请求未加密时,回复明文内容
if ($this->encryptType == static::ENCRYPT_TYPE_RAW) {
return $message;
}
//加密
if ($this->encryptType == static::ENCRYPT_TYPE_AES) {
$timestamp = time();
$nonce = uniqid();
return $this->encryptMsg($message, $timestamp, $nonce);
}
throw new WechatException('unknown encrypt type: ' . $this->encryptType);
}