<?php


namespace app\common\util\wechat;

use app\common\util\SingleObjectClass;

use EasyWeChat\Factory;
use think\Log;


/**
 * 微信小程序实例化对象
 * Class MiniProgramSDK
 * @package app\common\util
 */
class WechatMpSDK
{
    protected $app;

    /**
     * 构造函数
     * MiniProgramSDK constructor.
     */
    public function __construct($config = [])
    {
        //WxAccountConfig::getMpConfig();//获取小程序配置
        $this->app = Factory::officialAccount($config); //  Factory::officialAccount($config);
        $cache = new WechatCache();
        $this->app->rebind('cache', $cache);
        Log::record($cache);
        //return $this->app;

    }

    /**
     * 获取小程序接口实例
     * @return \EasyWeChat\MiniProgram\Application
     */
    public function getApp()
    {
        return $this->app;
    }

}