From 5f121221cfac4e33d7e79d1173f24db589ef523e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Sat, 8 May 2021 15:57:53 +0800 Subject: [PATCH] Update PaymentService.php --- app/data/service/PaymentService.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/data/service/PaymentService.php b/app/data/service/PaymentService.php index 1b28518d8..5d6b4fd2d 100644 --- a/app/data/service/PaymentService.php +++ b/app/data/service/PaymentService.php @@ -10,7 +10,6 @@ use app\data\service\payment\VoucherPaymentService; use app\data\service\payment\WechatPaymentService; use think\admin\Exception; use think\App; -use think\Container; /** * 支付基础服务 @@ -169,22 +168,22 @@ abstract class PaymentService { if ($code === 'empty') { $vars = ['code' => 'empty', 'type' => 'empty', 'params' => []]; - return static::$driver[$code] = Container::getInstance()->make(EmptyPaymentService::class, $vars); + return static::$driver[$code] = app()->make(EmptyPaymentService::class, $vars); } [, $type, $params] = self::config($code); if (isset(static::$driver[$code])) return static::$driver[$code]; $vars = ['code' => $code, 'type' => $type, 'params' => $params]; // 实例化具体支付参数类型 if (stripos($type, 'balance') === 0) { - return static::$driver[$code] = Container::getInstance()->make(BalancePyamentService::class, $vars); + return static::$driver[$code] = app()->make(BalancePyamentService::class, $vars); } elseif (stripos($type, 'voucher') === 0) { - return static::$driver[$code] = Container::getInstance()->make(VoucherPaymentService::class, $vars); + return static::$driver[$code] = app()->make(VoucherPaymentService::class, $vars); } elseif (stripos($type, 'alipay_') === 0) { - return static::$driver[$code] = Container::getInstance()->make(AlipayPaymentService::class, $vars); + return static::$driver[$code] = app()->make(AlipayPaymentService::class, $vars); } elseif (stripos($type, 'wechat_') === 0) { - return static::$driver[$code] = Container::getInstance()->make(WechatPaymentService::class, $vars); + return static::$driver[$code] = app()->make(WechatPaymentService::class, $vars); } elseif (stripos($type, 'joinpay_') === 0) { - return static::$driver[$code] = Container::getInstance()->make(JoinpayPaymentService::class, $vars); + return static::$driver[$code] = app()->make(JoinpayPaymentService::class, $vars); } else { throw new Exception(sprintf('支付驱动[%s]未定义', $type)); }