<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2017 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目:https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace controller;
use service\WechatService;
use think\Controller;
/**
* 微信基础控制器
* Class BasicWechat
* @package controller
*/
class BasicWechat extends Controller
{
/**
* 当前粉丝用户OPENID
* @var string
*/
protected $openid;
/**
* 获取粉丝用户OPENID
* @return bool|string
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
protected function getOpenid()
{
return WechatService::webOauth(0)['openid'];
}
/**
* 获取微信粉丝信息
* @return bool|array
* @throws \Exception
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
protected function getFansinfo()
{
return WechatService::webOauth(1)['fansinfo'];
}
}