53 lines
1.6 KiB
PHP
53 lines
1.6 KiB
PHP
<?php
|
|
namespace app\mp\model;
|
|
use addon\qqapp\model\Config;
|
|
use app\model\BaseModel;
|
|
use EasyWeChat\OpenPlatform\Server\Guard;
|
|
use EasyWeChat\Factory;
|
|
use \GuzzleHttp\Client;
|
|
use Pimple\Container;
|
|
class QqminCode extends BaseModel
|
|
{
|
|
protected $app;//对象
|
|
public $openPlatform;
|
|
public $open_config;
|
|
public $qqapp_config;
|
|
|
|
public function __construct($site_id = '', $appid = '')
|
|
{
|
|
$config_model = new Config();
|
|
if ($site_id) {
|
|
$config_result = $config_model->getQqappConfig($site_id);
|
|
} else if ($appid) {
|
|
$config_result = $config_model->getAppidConfig($appid);
|
|
} else {
|
|
$config_result = [];
|
|
}
|
|
$openPlatform = $config_model->getOpenConfig()['data'];
|
|
$config = $config_result["data"] ?? [];
|
|
if (!empty($config)) {
|
|
$this->qqapp_config = $config["values"];
|
|
}
|
|
if ($openPlatform && $appinfo = $openPlatform['value']) {
|
|
$platform = [
|
|
'app_id' => $appinfo['appid'],
|
|
'secret' => $appinfo['appsecret'],
|
|
'token' => $appinfo['token'],
|
|
'aes_key' => $appinfo['encodingaeskey'],
|
|
];
|
|
$this->open_config = $appinfo;
|
|
$this->openPlatform =new QqServer($platform,$this->qqapp_config['appid']??'');
|
|
}
|
|
}
|
|
public function getopenPlatform(){
|
|
return $this->openPlatform;
|
|
}
|
|
/***
|
|
*授权响应
|
|
*/
|
|
public function ticket()
|
|
{
|
|
$openPlatform=$this->openPlatform;
|
|
return $openPlatform->ticket();
|
|
}
|
|
} |