new_naweigete/crmeb/services/app/WechatOpenService.php
2025-03-12 10:47:34 +08:00

66 lines
1.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace crmeb\services\app;
use crmeb\services\easywechat\Application;
class WechatOpenService
{
protected function options()
{
$options = [
'app_id' => sys_config('wechat_open_app_id'),
'secret' => sys_config('wechat_open_app_secret')
];
return $options;
}
/**
* @return Application
*/
protected function application()
{
return new Application($this->options());
}
/**
* @return mixed
*/
public function serve()
{
return $this->application()->open_platform->server->serve();
}
/**
* 使用授权码换取公众号的接口调用凭据和授权信息
* @param string $code
* @return \EasyWeChat\Support\Collection
*/
public function getAuthorizationInfo()
{
return $this->application()->oauth->user();
}
/**
* 获取授权方的公众号帐号基本信息
* @param string $appid
* @return \EasyWeChat\Support\Collection
*/
public function getAuthorizerInfo()
{
return $this->application()->oauth->user();
}
}