| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?php
- namespace Biz\Pay;
- class SysPayment {
- protected $paymentBank = '';
- protected $paymentQuick = '';
- protected $paymentTypeList = array();
- static function init() {
- return new self();
- }
- public function __construct() {
- $this->pay_type();
- $this->paymentBank = 'HuiPay'; //网银支付名称
- $this->paymentQuick = 'XinHuiScan'; //快捷支付名称
- $this->paymentTypeList = array(
- 'alipay', //支付宝
- 'weixin', // 微信
- 'baidupay', //百付宝
- 'tenpay', //财付通
- 'qqpay', //QQ钱包
- 'jdpay', //京东钱包
- 'union', //银联
- );
- }
- /**
- * 得到当前系统设置的快捷支付名称
- * @return [type] [description]
- */
- public function getCurrentQuickPaymentName() {
- return $this->paymentQuick;
- }
- /**
- * 读取支付类型
- * [pay_type description]
- * @return [type] [description]
- */
- public function pay_type() {
- $data = M('payment')->where('status', '1')->get();
- if ($data['pay_type'] == 1) {
- $this->paymentBank = $data['payment_name'];
- }
- if ($data['pay_type'] == 2) {
- $this->paymentQuick = $data['payment_name'];
- }
- return $data;
- }
- /**
- * 得到当前系统设置的银行直链名称
- * @return [type] [description]
- */
- public function getCurrentBankPaymentName() {
- return $this->paymentBank;
- }
- /**
- * 得到所有快捷支付的可支付类型列表
- **/
- public function getQuickTypeList() {
- $cls = "\\Biz\\Pay\\Payment\\" . $this->paymentQuick . "Payment";
- $payment = new $cls(new \Biz\Pay\PaymentDataAccess());
- $paymentList = $payment->getPaymentType();
- $paymentList = $this->filterPayType($paymentList);
- return $paymentList;
- }
- /**
- * 得到所有网银在线支付类型列表
- * @return [type] [description]
- */
- public function getBankTypeList($changeMobile = 1) {
- $cls = "\\Biz\\Pay\\Payment\\" . $this->paymentBank . "Payment";
- $payment = new $cls(new \Biz\Pay\PaymentDataAccess());
- $payment->isMobile = $changeMobile;
- return $paymentList = $payment->getPaymentType();
- }
- /**
- * 过滤不存在的支付类型
- * @param [type] $payment_list [description]
- * @return [type] [description]
- */
- public function filterPayType($payment_list) {
- $list = $this->paymentTypeList;
- $enabled = array();
- if (is_array($payment_list) && count($payment_list) > 0) {
- foreach ($payment_list as $k => $v) {
- if (in_array($k, $list)) {
- $enabled[] = $k;
- }
- }
- if (is_array($enabled) && count($enabled) > 0) {
- return $enabled;
- }
- return;
- }
- return;
- }
- public function getLang() {
- return include ROOT_PATH . '/Config/payment.conf.php';
- }
- }
|