mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
Update PaymentService.php
This commit is contained in:
parent
2a5d0af7fe
commit
5f121221cf
@ -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));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user