123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace app\common\util\wechat;
- use app\common\util\SingleObjectClass;
- use EasyWeChat\Factory;
- use think\Log;
- /**
- * 微信小程序实例化对象
- * Class MiniProgramSDK
- * @package app\common\util
- */
- class WechatPaySDK extends SingleObjectClass
- {
- protected $app;
- /**
- * 构造函数
- * MiniProgramSDK constructor.
- */
- public function __construct()
- {
- $miniProgramConfig = WxAccountConfig::getWechatPayConfig();//获取小程序配置
- // print_r($miniProgramConfig);
- $this->app = Factory::payment($miniProgramConfig);
- $cache = new WechatCache();
- $this->app->rebind('cache', $cache);
- Log::record($cache);
- }
- /**
- * 获取小程序接口实例
- * @return \EasyWeChat\MiniProgram\Application
- */
- public function getApp()
- {
- return $this->app;
- }
- }
|