* Finish task#44172,task#44273.

This commit is contained in:
leiyong
2021-11-11 05:26:27 +00:00
parent ef338371e1
commit 088a6374df
12 changed files with 273 additions and 17 deletions
+12 -5
View File
@@ -211,14 +211,14 @@ class webhook extends control
elseif($webhook->type == 'wechatuser')
{
$this->app->loadClass('wechatapi', true);
$wechatApi = new wechatapi($webhook->secret->appKey, $webhook->secret->appSecret, $webhook->secret->agentId);
$response = $wechatApi->getAllUsers();
$wechatApi = new wechatapi($webhook->secret->appKey, $webhook->secret->appSecret, $webhook->secret->agentId);
$response = $wechatApi->getAllUsers();
}
elseif($webhook->type == 'feishuuser')
{
$this->app->loadClass('feishuapi', true);
$feishuApi = new feishuapi($webhook->secret->appId, $webhook->secret->appSecret);
$response = $feishuApi->getAllUsers();
$feishuApi = new feishuapi($webhook->secret->appId, $webhook->secret->appSecret);
$response = $feishuApi->getAllUsers($selectedDepts);
}
if($response['result'] == 'fail')
@@ -275,7 +275,7 @@ class webhook extends control
public function chooseDept($id)
{
$webhook = $this->webhook->getById($id);
if($webhook->type != 'dinguser' && $webhook->type != 'wechatuser')
if($webhook->type != 'dinguser' && $webhook->type != 'wechatuser' && $webhook->type != 'feishuuser')
{
echo js::alert($this->lang->webhook->note->bind);
die(js::locate($this->createLink('webhook', 'browse')));
@@ -289,6 +289,13 @@ class webhook extends control
$response = $dingapi->getDeptTree();
}
if($webhook->type == 'feishuuser')
{
$this->app->loadClass('feishuapi', true);
$feishuApi = new feishuapi($webhook->secret->appId, $webhook->secret->appSecret);
$response = $feishuApi->getDeptTree();
}
if($response['result'] == 'fail')
{
echo js::error($response['message']);
+26
View File
@@ -24,6 +24,32 @@ class webhookModel extends model
return $webhook;
}
/**
* Get a webhook by type.
*
* @param int $type
* @access public
* @return object
*/
public function getByType($type)
{
$webhook = $this->dao->select('*')->from(TABLE_WEBHOOK)->where('type')->eq($type)->fetch();
return $webhook;
}
/**
* Get a webhook by type.
*
* @param int $type
* @access public
* @return object
*/
public function getBindAccount($webhookID, $webhookType, $openID)
{
$account = $this->dao->select('account')->from(TABLE_OAUTH)->where('providerID')->eq($webhookID)->andWhere('providerType')->eq($webhookType)->andWhere('openID')->eq($openID)->fetch('account');
return $account;
}
/**
* Get webhook list.
*
+2 -2
View File
@@ -34,8 +34,8 @@
<td class='text' title='<?php echo $webhook->url;?>'><?php echo $webhook->url;?></td>
<td class='c-actions text-right'>
<?php
if($webhook->type == 'dinguser') common::printIcon('webhook', 'chooseDept', "webhookID=$id", '', 'list', 'link');
if($webhook->type == 'wechatuser' or $webhook->type == 'feishuuser') common::printIcon('webhook', 'bind', "webhookID=$id", '', 'list', 'link');
if($webhook->type == 'dinguser' or $webhook->type == 'feishuuser') common::printIcon('webhook', 'chooseDept', "webhookID=$id", '', 'list', 'link');
if($webhook->type == 'wechatuser') common::printIcon('webhook', 'bind', "webhookID=$id", '', 'list', 'link');
common::printIcon('webhook', 'log', "webhookID=$id", '', 'list', 'file-text');
common::printIcon('webhook', 'edit', "webhookID=$id", '', 'list');
if(common::hasPriv('webhook', 'delete'))
+6 -2
View File
@@ -28,9 +28,13 @@
<script>
$(function()
{
var ztreeSettings =
var ztreeSettings =
{
check:
view:
{
showIcon: false
},
check:
{
enable: true,
chkStyle: "checkbox",