* finish task #7274.

This commit is contained in:
z
2020-06-28 13:16:47 +08:00
parent 7ab4e53714
commit 0e70771cd8
4 changed files with 27 additions and 12 deletions
+19 -7
View File
@@ -40,6 +40,9 @@ class webhook extends control
$this->app->loadClass('pager', $static = true);
$pager = new pager($recTotal, $recPerPage, $pageID);
/* Unset whiteListDept cookie. */
setcookie('whiteListDept', '', 0, $this->config->webRoot, '', false, true);
$this->view->title = $this->lang->webhook->api . $this->lang->colon . $this->lang->webhook->list;
$this->view->webhooks = $this->webhook->getList($orderBy, $pager);
$this->view->position[] = html::a(inlink('browse'), $this->lang->webhook->api);
@@ -175,11 +178,19 @@ class webhook extends control
}
$webhook->secret = json_decode($webhook->secret);
/* Get whiteList dept. */
if($this->get->whiteListDept)
{
setcookie('whiteListDept', $this->get->whiteListDept, 0, $this->config->webRoot, '', false, true);
$_COOKIE['whiteListDept'] = $this->get->whiteListDept;
}
$whiteListDept = $this->cookie->whiteListDept ? $this->cookie->whiteListDept : '';
if($webhook->type == 'dinguser')
{
$this->app->loadClass('dingapi', true);
$dingapi = new dingapi($webhook->secret->appKey, $webhook->secret->appSecret, $webhook->secret->agentId);
$response = $dingapi->getAllUsers($this->get->whiteListDept);
$response = $dingapi->getAllUsers($whiteListDept);
}
elseif($webhook->type == 'wechatuser')
{
@@ -222,12 +233,13 @@ class webhook extends control
$this->view->position[] = html::a($this->createLink('webhook', 'browse'), $this->lang->webhook->common);
$this->view->position[] = $this->lang->webhook->bind;
$this->view->webhook = $webhook;
$this->view->dingUsers = $dingUsers;
$this->view->useridPairs = $useridPairs;
$this->view->users = $users;
$this->view->pager = $pager;
$this->view->bindedUsers = $bindedPairs;
$this->view->webhook = $webhook;
$this->view->dingUsers = $dingUsers;
$this->view->useridPairs = $useridPairs;
$this->view->users = $users;
$this->view->pager = $pager;
$this->view->bindedUsers = $bindedPairs;
$this->view->whiteListDept = $whiteListDept;
$this->display();
}
+5 -4
View File
@@ -9,10 +9,11 @@ $lang->webhook->chooseDept = '选择同步部门';
$lang->webhook->assigned = '指派给';
$lang->webhook->setting = '设置';
$lang->webhook->browse = '浏览Webhook';
$lang->webhook->create = '添加Webhook';
$lang->webhook->edit = '编辑Webhook';
$lang->webhook->delete = '删除Webhook';
$lang->webhook->browse = '浏览Webhook';
$lang->webhook->create = '添加Webhook';
$lang->webhook->edit = '编辑Webhook';
$lang->webhook->delete = '删除Webhook';
$lang->webhook->rechooseDept = '重选部门';
$lang->webhook->id = 'ID';
$lang->webhook->type = '类型';
+1
View File
@@ -48,6 +48,7 @@
<div class='text'>
<?php echo html::submitButton($lang->save, '', 'btn btn-primary');?>
<?php echo html::a($this->createLink('webhook', 'browse'), $lang->goback, '', "class='btn'");?>
<?php if($whiteListDept) echo html::a($this->createLink('webhook', 'chooseDept', "id={$webhook->id}"), $lang->webhook->rechooseDept, '', "class='btn'");?>
</div>
<?php $pager->show('right', 'pagerjs');?>
</div>