Files
spacestation/api/controllers/Weixin.php
T
2024-05-29 21:21:55 +08:00

70 lines
1.6 KiB
PHP

<?php
/**
* Created by PhpStorm.
* User: xuxb
* Date: 2020/9/14
* Time: 10:51
*/
class Weixin extends CI_Controller
{
private $app_id;
private $reset;
private $appid;
private $secret;
private $corpid;
private $corpsecret;
public function __construct()
{
parent::__construct();
$this->app_id = $this->input->get('app_id');
$this->reset = $this->input->get('reset');
$this->appid = $this->input->get('appid');
$this->secret = $this->input->get('secret');
$this->corpid = $this->input->get('corpid');
$this->corpsecret = $this->input->get('corpsecret');
$wx_configs = array(
);
$wx_config = $wx_configs[$this->app_id];
if ($wx_config) {
!$this->appid && $this->appid = $wx_config['appid'];
!$this->secret && $this->secret = $wx_config['secret'];
}
$param = array('appid' => $this->appid, "secret" => $this->secret);
$this->load->library("hd_wechat", $param);
}
/**
* 获取access_token
*/
function access_token()
{
$access_token = $this->hd_wechat->access_token($this->reset);
$data = array("access_token" => $access_token);
echo json_encode($data, JSON_UNESCAPED_UNICODE);
return;
}
/**
* 获取分享凭证
*/
function api_ticket()
{
$api_ticket = $this->hd_wechat->api_ticket($this->reset);
$data = array("api_ticket" => $api_ticket);
echo json_encode($data, JSON_UNESCAPED_UNICODE);
return;
}
}