<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\PayCenter\Util; use ModStart\Core\Util\AgentUtil; use ModStart\Module\ModuleManager; use Module\PayCenter\Provider\PayCenterProvider; use Module\PayCenter\Type\PayType; class PayUtil { public static function hasPay() { goto zS3oZ; YZJv_: if (self::isMemberMoneyEnable()) { return true; } goto cc81x; Q5_Ev: return false; goto eWnMM; cc81x: foreach (PayCenterProvider::all() as $tDnAb) { if ($tDnAb->enable()) { return true; } } goto Q5_Ev; zS3oZ: if (self::isWechatEnable()) { return true; } goto qNYRl; wQmPj: if (self::isAlipayWebEnable()) { return true; } goto YZJv_; qNYRl: if (self::isAlipayEnable()) { return true; } goto wQmPj; eWnMM: } public static function isPayEnable($gDyzf) { switch ($gDyzf) { case PayType::ALIPAY: return self::isAlipayEnable(); case PayType::ALIPAY_WEB: case PayType::ALIPAY_MOBILE: return self::isAlipayWebEnable(); case PayType::WECHAT: case PayType::WECHAT_MOBILE: case PayType::WECHAT_MINI_PROGRAM: case PayType::WECHAT_H5: return self::isWechatEnable(); case PayType::MEMBER_MONEY: return self::isMemberMoneyEnable(); case PayType::WECHAT_APP: return true; default: goto p_uN_; XDtXM: if ($tDnAb) { return $tDnAb->enable(); } goto t8jtE; p_uN_: $tDnAb = PayCenterProvider::get($gDyzf); goto XDtXM; t8jtE: break; goto hFYFj; hFYFj: } return false; } public static function isMemberMoneyEnable() { goto yKC1c; SSr36: return boolval(modstart_config('payMemberMoneyOn', false)); goto cHAKj; yKC1c: if (!modstart_module_enabled('Member')) { return false; } goto qDZmm; qDZmm: if (!ModuleManager::getModuleConfig('Member', 'moneyEnable', false)) { return false; } goto SSr36; cHAKj: } public static function isWechatEnable() { return boolval(modstart_config('payWechatOn', false)); } public static function isAlipayEnable() { return boolval(modstart_config('payAlipayOn', false)); } public static function isAlipayWebEnable() { return boolval(modstart_config('payAlipayWebOn', false)); } public static function preferShowQuick() { if (modstart_config('payQuickPreferEnable', false) && (self::isWechatEnable() || self::isAlipayEnable() || self::isAlipayWebEnable()) && !AgentUtil::isMobile()) { return true; } return false; } }