'支付宝H5', self::WEIXIN_GZH => '微信公众号', self::WEIXIN_XCX => '微信小程序', ]; } /** * 根据环境获取微信交易类型 * @param $platform * @return mixed|string */ public static function getTypeByPlatform($platform) { $arr = [ User::PLATFORM_APP => [self::ALIPAY_H5], // User::PLATFORM_H5 => [self::ALIPAY_H5], User::PLATFORM_H5 => [self::ALIPAY_H5], User::PLATFORM_WECHAT => [self::WEIXIN_GZH, self::ALIPAY_H5], User::PLATFORM_MP_WX => self::WEIXIN_XCX, ]; return $arr[$platform] ?? ''; } /** * 获取当前类所有定义常量 * * @return array */ public static function getConstants() { $class = new ReflectionClass(__CLASS__); return $class->getConstants(); } public static function action($type) { $ations = self::allAction(); return $ations[$type] ?? ''; } public static function getPaymentMap(): array { return [ self::BILL_JOINPAY => '汇聚分账支付', // self::BILL_JOINPAY_FAST_PAY => '银行卡支付', ]; } /** * 所有支付方式 * @return array */ public static function allAction(){ return [ self::BILL_JOINPAY => self::HUIJU_BILL_JOINPAY, // self::BILL_JOINPAY_FAST_PAY => 'bill_joinpay_fast', ]; } /** * 获取所有支付方式描述 * @return array */ public static function allTypeConf() { $protocol = ($_SERVER['SERVER_PORT'] == 443 ? 'https' : 'http') . '://'; $host = $protocol.$_SERVER['HTTP_HOST']; $map = self::getPaymentMap(); $actions = self::allAction(); $return = []; foreach($actions as $key => $val){ $return[$val] = [ 'name' => $map[$key], 'img' => $host . '/resources/img/payment/' . $val . '.png', 'pay_type' => $key ]; } return $return; } }