初始化项目:添加后端代码、ThinkPHP框架、前端资源
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the overtrue/wechat.
|
||||
*
|
||||
* (c) overtrue <i@overtrue.me>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
|
||||
namespace TuzhiEasyWeChat\Channels\Server;
|
||||
|
||||
use TuzhiEasyWeChat\Kernel\ServerGuard;
|
||||
use TuzhiEasyWeChat\Kernel\Encryptor;
|
||||
/**
|
||||
* Class Guard.
|
||||
*
|
||||
* @author overtrue <i@overtrue.me>
|
||||
*/
|
||||
class Guard extends ServerGuard
|
||||
{
|
||||
protected function shouldReturnRawResponse(): bool
|
||||
{
|
||||
return !is_null($this->app['request']->get('echostr'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \EasyWeChat\Kernel\Exceptions\RuntimeException
|
||||
*/
|
||||
protected function decryptMessage(array $message)
|
||||
{
|
||||
$encryptor = new Encryptor($this->app['config']->get('app_id'), $this->app['config']->get('token'), $this->app['config']->get('aes_key'));
|
||||
|
||||
return $message = $encryptor->decrypt(
|
||||
$message['Encrypt'],
|
||||
$this->app['request']->get('msg_signature'),
|
||||
$this->app['request']->get('nonce'),
|
||||
$this->app['request']->get('timestamp')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user