12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- namespace App\libs\wechat\wxpay;
- use App\libs\helpers\Helper;
- use Illuminate\Support\Facades\Config;
- /**
- * @desc 配置账号信息类
- */
- class WxPayConfig
- {
- /**
- * 微信公众号信息配置.
- *
- * APPID:绑定支付的APPID(必须配置,开户邮件中可查看)
- *
- * MCHID:商户号(必须配置,开户邮件中可查看)
- *
- * KEY:商户支付密钥,参考开户邮件设置(必须配置,登录商户平台自行设置)
- * 设置地址:https://pay.weixin.qq.com/index.php/account/api_cert
- *
- * APPSECRET:公众帐号secert(仅JSAPI支付的时候需要配置, 登录公众平台,进入开发者中心可设置),
- * 获取地址:https://mp.weixin.qq.com/advanced/advanced?action=dev&t=advanced/dev&token=2005451881&lang=zh_CN
- *
- * @var string
- */
- public static $appId = '';
- public static $mchId = '';
- public static $key = '';
- /**
- * 证书路径,注意应该填写绝对路径(仅退款、撤销订单时需要,可登录商户平台下载,
- * API证书下载地址:https://pay.weixin.qq.com/index.php/account/api_cert,下载之前需要安装商户操作证书).
- *
- * @var path
- */
- public static $sslCertPath = '';
- public static $sslKeyPath = '';
- /**
- * 本例程通过curl使用HTTP POST方法,此处可修改代理服务器,
- * 默认CURL_PROXY_HOST=0.0.0.0和CURL_PROXY_PORT=0,此时不开启代理(如有需要才设置).
- *
- * @var unknown_type
- */
- public static $curlProxyHost = '0.0.0.0';
- public static $curlProxyPort = 0;
- /**
- * 不会影响接口调用流程),开启上报之后,方便微信监控请求调用的质量,建议至少
- * 开启错误上报。
- * 上报等级,0.关闭上报; 1.仅错误出错上报; 2.全量上报.
- *
- * @var int
- */
- public static $reportLevel = 1;
- public static $idPre = '8491547801';
- public function __construct()
- {
- $id = Config::get('lc.wxpay.id'); // 公众号:dmia|cdlchd|yjyx
- $payment = include Helper::frameRootPath() . '/configs/wxPayment.php';
- if (isset($payment[$id])) {
- $conf = $payment[$id];
- self::$appId = $conf['appid'];
- self::$mchId = $conf['mch_id'];
- self::$key = $conf['key'];
- self::$sslCertPath = $conf['path'] . 'apiclient_cert.pem';
- self::$sslKeyPath = $conf['path'] . 'apiclient_key.pem';
- self::$curlProxyHost = $conf['ip'];
- if (isset($conf['port'])) {
- self::$curlProxyPort = $conf['port'];
- }
- if (isset($conf['report_level'])) {
- self::$reportLevel = $conf['report_level'];
- }
- if (isset($conf['id_pre'])) {
- self::$idPre = $conf['id_pre'];
- }
- }
- }
- }
|