| 12345678910111213141516171819202122 |
- <?php
- namespace app\common\service;
- class PaymentFactory
- {
- /**
- * 创建支付服务实例
- */
- public static function create($payMethod, $payConfigId = 0)
- {
- switch ($payMethod) {
- case 'wechat':
- return new WechatPaymentService($payMethod, $payConfigId);
- case 'alipay':
- return new AlipayPaymentService($payMethod, $payConfigId);
- default:
- throw new \Exception('不支持的支付方式');
- }
- }
- }
|