修正easywechtrequest类
This commit is contained in:
@@ -8,7 +8,10 @@ use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
|
||||
use EasyWeChat\Kernel\Exceptions\InvalidConfigException;
|
||||
use EasyWeChat\OfficialAccount\Message;
|
||||
use EasyWeChat\Pay\Application;
|
||||
use Hyperf\HttpServer\Contract\RequestInterface;
|
||||
use Hyperf\Utils\ApplicationContext;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
|
||||
/**
|
||||
@@ -42,6 +45,8 @@ class WechatPay
|
||||
/**
|
||||
* 创建工厂类
|
||||
* @return Application
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function createApp(): Application
|
||||
{
|
||||
@@ -77,7 +82,10 @@ class WechatPay
|
||||
];
|
||||
|
||||
try {
|
||||
return new Application($config);
|
||||
$app = new Application($config);
|
||||
$request = ApplicationContext::getContainer()->get(RequestInterface::class);
|
||||
$app->setRequest($request);
|
||||
return $app;
|
||||
} catch (InvalidArgumentException $e) {
|
||||
throw new BusinessException('实例化EasyWeChat类失败:' . $e->getMessage(), HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user