Merge branch 'develop'
This commit is contained in:
@@ -16,15 +16,15 @@ class Feishu
|
||||
protected $client = null;
|
||||
protected $options = [];
|
||||
protected $error = '';
|
||||
protected $gs = 'hesu';
|
||||
protected $abbr = 'hesu';
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
public function __construct(string $appId = '', string $appSecret = '', string $gs = 'hesu')
|
||||
public function __construct(string $appId = '', string $appSecret = '', string $abbr = 'hesu')
|
||||
{
|
||||
|
||||
if ($gs === 'mbaf') {
|
||||
if ($abbr === 'mbaf') {
|
||||
$this->baseUri = 'https://open.larksuite.com/open-apis/';
|
||||
} else {
|
||||
$this->baseUri = 'https://open.feishu.cn/open-apis/';
|
||||
@@ -32,7 +32,7 @@ class Feishu
|
||||
|
||||
$this->appId = $appId;
|
||||
$this->appSecret = $appSecret;
|
||||
$this->gs = $gs;
|
||||
$this->abbr = $abbr;
|
||||
|
||||
$this->client = new Client([
|
||||
'base_uri' => $this->baseUri
|
||||
@@ -94,8 +94,8 @@ class Feishu
|
||||
public function authorize($certificate, $url = 'authen/v1/authorize')
|
||||
{
|
||||
$arr = [
|
||||
'app_id' => $certificate['appId'],
|
||||
'redirect_uri' => $certificate['rUrl'],
|
||||
'app_id' => $certificate['app_id'],
|
||||
'redirect_uri' => $certificate['r_url'],
|
||||
'scope' => $certificate['scope'],
|
||||
'state' => $certificate['state']
|
||||
];
|
||||
@@ -108,7 +108,7 @@ class Feishu
|
||||
*/
|
||||
public function tenantAccessToken()
|
||||
{
|
||||
$tenantAccessToken = Cache::get($this->gs.'-tenantAccessToken');
|
||||
$tenantAccessToken = Cache::get($this->abbr.'-tenantAccessToken');
|
||||
if (!$tenantAccessToken) {
|
||||
$this->options["json"] = [
|
||||
"app_id" => $this->appId,
|
||||
@@ -117,7 +117,7 @@ class Feishu
|
||||
$rst = $this->requestResult('auth/v3/tenant_access_token/internal', 'POST');
|
||||
if ($rst) {
|
||||
$tenantAccessToken = $rst['tenant_access_token'];
|
||||
Cache::set($this->gs.'-tenantAccessToken', $tenantAccessToken, $rst['expire']);
|
||||
Cache::set($this->abbr.'-tenantAccessToken', $tenantAccessToken, $rst['expire']);
|
||||
} else {
|
||||
throw new BusinessException('tenant_access_token 获取失败');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user