Code modification of issue 191 of zentao.
This commit is contained in:
@@ -70,3 +70,8 @@ DROP `tagKeywords`,
|
||||
DROP `commentKeywords`,
|
||||
ADD `comment` varchar(255) COLLATE 'utf8_general_ci' NULL AFTER `atTime`,
|
||||
ADD `lastTag` varchar(255) COLLATE 'utf8_general_ci' NULL;
|
||||
|
||||
ALTER TABLE `zt_webhook` MODIFY COLUMN `type` varchar(15) NOT NULL;
|
||||
UPDATE `zt_webhook` SET `type` = 'dinggroup' WHERE `type` = 'dingding';
|
||||
UPDATE `zt_webhook` SET `type` = 'dinguser' WHERE `type` = 'dingapi';
|
||||
UPDATE `zt_webhook` SET `type` = 'wechatgroup' WHERE `type` = 'weixin';
|
||||
@@ -84,9 +84,11 @@ $(function()
|
||||
});
|
||||
}
|
||||
|
||||
if($("main").is(".hide-sidebar")){
|
||||
if($("main").is(".hide-sidebar"))
|
||||
{
|
||||
$(".sidebar-toggle").children().attr("class", "icon icon-angle-left");
|
||||
}else
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#sidebar").bind("click", function ()
|
||||
{
|
||||
|
||||
@@ -65,12 +65,12 @@ class webhook extends control
|
||||
}
|
||||
|
||||
$this->app->loadLang('action');
|
||||
$this->view->title = $this->lang->webhook->api . $this->lang->colon . $this->lang->webhook->create;
|
||||
$this->view->products = $this->loadModel('product')->getPairs();
|
||||
$this->view->projects = $this->loadModel('project')->getPairs();
|
||||
$this->view->position[] = html::a(inlink('browse'), $this->lang->webhook->api);
|
||||
$this->view->position[] = html::a(inlink('browse'), $this->lang->webhook->common);
|
||||
$this->view->position[] = $this->lang->webhook->create;
|
||||
$this->view->title = $this->lang->webhook->api . $this->lang->colon . $this->lang->webhook->create;
|
||||
$this->view->products = $this->loadModel('product')->getPairs();
|
||||
$this->view->projects = $this->loadModel('project')->getPairs();
|
||||
$this->view->position[] = html::a(inlink('browse'), $this->lang->webhook->api);
|
||||
$this->view->position[] = html::a(inlink('browse'), $this->lang->webhook->common);
|
||||
$this->view->position[] = $this->lang->webhook->create;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -91,15 +91,16 @@ class webhook extends control
|
||||
}
|
||||
|
||||
$webhook = $this->webhook->getByID($id);
|
||||
$this->app->loadLang('action');
|
||||
|
||||
$this->view->title = $this->lang->webhook->edit . $this->lang->colon . $webhook->name;
|
||||
$this->view->position[] = html::a(inlink('browse'), $this->lang->webhook->api);
|
||||
$this->view->position[] = html::a(inlink('browse'), $this->lang->webhook->common);
|
||||
$this->view->position[] = $this->lang->webhook->edit;
|
||||
$this->view->products = $this->loadModel('product')->getPairs();
|
||||
$this->view->projects = $this->loadModel('project')->getPairs();
|
||||
$this->view->webhook = $webhook;
|
||||
|
||||
$this->view->products = $this->loadModel('product')->getPairs();
|
||||
$this->view->projects = $this->loadModel('project')->getPairs();
|
||||
$this->view->webhook = $webhook;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -156,7 +157,7 @@ class webhook extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function bind($id, $recTotal = 0, $recPerPage = 50, $pageID = 1)
|
||||
public function bind($id, $recTotal = 0, $recPerPage = 15, $pageID = 1)
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
@@ -167,18 +168,20 @@ class webhook extends control
|
||||
}
|
||||
|
||||
$webhook = $this->webhook->getById($id);
|
||||
if($webhook->type != 'dingapi' && $webhook->type != 'wechatApi')
|
||||
if($webhook->type != 'dinguser' && $webhook->type != 'wechatuser')
|
||||
{
|
||||
echo js::alert($this->lang->webhook->note->bind);
|
||||
die(js::locate($this->createLink('webhook', 'browse')));
|
||||
}
|
||||
$webhook->secret = json_decode($webhook->secret);
|
||||
|
||||
if($webhook->type == 'dingapi'){
|
||||
if($webhook->type == 'dinguser')
|
||||
{
|
||||
$this->app->loadClass('dingapi', true);
|
||||
$dingapi = new dingapi($webhook->secret->appKey, $webhook->secret->appSecret, $webhook->secret->agentId);
|
||||
$response = $dingapi->getAllUsers();
|
||||
}elseif ($webhook->type == 'wechatApi')
|
||||
}
|
||||
elseif($webhook->type == 'wechatuser')
|
||||
{
|
||||
$this->app->loadClass('wechatapi', true);
|
||||
$wechatApi = new wechatapi($webhook->secret->appKey, $webhook->secret->appSecret, $webhook->secret->agentId);
|
||||
|
||||
28
module/webhook/js/bind.js
Normal file
28
module/webhook/js/bind.js
Normal file
@@ -0,0 +1,28 @@
|
||||
function confirmChanges()
|
||||
{
|
||||
var inputValue1 = $("#userSelect option:selected").val();
|
||||
var spanText = $("#userSelect option:selected").text();
|
||||
var inputName = $("#saveInput").children('input').eq(0).attr("name");
|
||||
setInput(inputName, inputValue1, spanText);
|
||||
myModalTrigger.close()
|
||||
}
|
||||
|
||||
function setInput(setName, setValue1, spanText)
|
||||
{
|
||||
$("input[name='" + setName + "']").attr("value", setValue1).prev().html(spanText);
|
||||
}
|
||||
|
||||
var myModalTrigger = new $.zui.ModalTrigger({title:$("#triggerTitle").html(), custom:$('#userList').html(), height:"auto", size:"sm"});
|
||||
|
||||
$(function ()
|
||||
{
|
||||
$("#userList").html("");
|
||||
});
|
||||
|
||||
$(".bind").on("click",function()
|
||||
{
|
||||
var inputName = this.getAttribute("data-value");
|
||||
$("#saveInput").html();
|
||||
$("#saveInput").html("<input type='hidden' name='" + inputName + "' value=''>");
|
||||
myModalTrigger.show();
|
||||
});
|
||||
@@ -3,12 +3,12 @@ $(function()
|
||||
$('#type').change(function()
|
||||
{
|
||||
var type = $(this).val();
|
||||
$('#sendTypeTR').toggle(type != 'dingding' && type != 'dingapi');
|
||||
$('#secretTR').toggle(type == 'dingding');
|
||||
$('#urlTR').toggle(type != 'dingapi' && type != 'wechatApi');
|
||||
$('.dingapiTR').toggle(type == 'dingapi');
|
||||
$('.wechatTR').toggle(type == 'wechatApi');
|
||||
$('#paramsTR').toggle(type != 'bearychat' && type != 'dingding' && type != 'dingapi' && type != 'wechatApi' && type != 'weixin');
|
||||
$('#sendTypeTR').toggle(type != 'dinggroup' && type != 'dinguser' && type != 'wechatuser' && type != 'wechatgroup');
|
||||
$('#secretTR').toggle(type == 'dinggroup');
|
||||
$('#urlTR').toggle(type != 'dinguser' && type != 'wechatuser');
|
||||
$('.dinguserTR').toggle(type == 'dinguser');
|
||||
$('.wechatTR').toggle(type == 'wechatuser');
|
||||
$('#paramsTR').toggle(type != 'bearychat' && type != 'dinggroup' && type != 'dinguser' && type != 'wechatuser' && type != 'wechatgroup');
|
||||
$('#urlNote').html(urlNote[type]);
|
||||
});
|
||||
|
||||
|
||||
@@ -34,12 +34,12 @@ $lang->webhook->date = '发送时间';
|
||||
$lang->webhook->data = '数据';
|
||||
$lang->webhook->result = '结果';
|
||||
|
||||
$lang->webhook->typeList[''] = '';
|
||||
$lang->webhook->typeList['dingding'] = '钉钉群通知机器人';
|
||||
$lang->webhook->typeList['dingapi'] = '钉钉工作消息通知';
|
||||
$lang->webhook->typeList['weixin'] = '企业微信群机器人';
|
||||
$lang->webhook->typeList['wechatApi'] = '企业微信应用消息';
|
||||
$lang->webhook->typeList['default'] = '其他';
|
||||
$lang->webhook->typeList[''] = '';
|
||||
$lang->webhook->typeList['dinggroup'] = '钉钉群通知机器人';
|
||||
$lang->webhook->typeList['dinguser'] = '钉钉工作消息通知';
|
||||
$lang->webhook->typeList['wechatgroup'] = '企业微信群机器人';
|
||||
$lang->webhook->typeList['wechatuser'] = '企业微信应用消息';
|
||||
$lang->webhook->typeList['default'] = '其他';
|
||||
|
||||
$lang->webhook->sendTypeList['sync'] = '同步';
|
||||
$lang->webhook->sendTypeList['async'] = '异步';
|
||||
@@ -47,15 +47,17 @@ $lang->webhook->sendTypeList['async'] = '异步';
|
||||
$lang->webhook->dingAgentId = '钉钉AgentId';
|
||||
$lang->webhook->dingAppKey = '钉钉AppKey';
|
||||
$lang->webhook->dingAppSecret = '钉钉AppSecret';
|
||||
$lang->webhook->dingUserid = '钉钉Userid';
|
||||
$lang->webhook->dingUserid = '钉钉用户';
|
||||
$lang->webhook->dingBindStatus = '钉钉绑定状态';
|
||||
|
||||
$lang->webhook->wechatCorpId = '企业ID';
|
||||
$lang->webhook->wechatCorpSecret = '应用的凭证密钥';
|
||||
$lang->webhook->wechatAgentId = '企业应用的ID';
|
||||
$lang->webhook->wechatUserid = '微信Userid';
|
||||
$lang->webhook->wechatUserid = '微信用户';
|
||||
$lang->webhook->wechatBindStatus = '微信绑定状态';
|
||||
|
||||
$lang->webhook->zentaoUser = '禅道用户';
|
||||
|
||||
$lang->webhook->dingBindStatusList['0'] = '未绑定';
|
||||
$lang->webhook->dingBindStatusList['1'] = '已绑定';
|
||||
|
||||
@@ -78,13 +80,14 @@ $lang->webhook->note->async = '异步需要打开计划任务。';
|
||||
$lang->webhook->note->bind = '只有[钉钉/微信]工作通知类型才需要绑定用户。';
|
||||
$lang->webhook->note->product = "此项为空时所有{$lang->productCommon}的动作都会触发钩子,否则只有关联{$lang->productCommon}的动作才会触发。";
|
||||
$lang->webhook->note->project = "此项为空时所有{$lang->projectCommon}的动作都会触发钩子,否则只有关联{$lang->projectCommon}的动作才会触发。";
|
||||
$lang->webhook->note->dingKey = " <a href='http://www.zentao.net/book/zentaopmshelp/358.html' target='_blank'><i class='icon-help'></i></a>";
|
||||
$lang->webhook->note->wechat = " <a href='http://www.zentao.net/book/zentaopmshelp/367.html' target='_blank'><i class='icon-help'></i></a>";
|
||||
|
||||
$lang->webhook->note->typeList['bearychat'] = '请在倍洽中添加一个禅道机器人,并将其webhook填写到此处。';
|
||||
$lang->webhook->note->typeList['dingding'] = '请在钉钉中添加一个自定义机器人,并将其webhook填写到此处。';
|
||||
$lang->webhook->note->typeList['weixin'] = '请在企业微信中添加一个自定义机器人,并将其webhook填写到此处。';
|
||||
$lang->webhook->note->typeList['default'] = '从第三方系统获取webhook并填写到此处。';
|
||||
$lang->webhook->note->dingHelp = " <a href='http://www.zentao.net/book/zentaopmshelp/358.html' target='_blank'><i class='icon-help'></i></a>";
|
||||
$lang->webhook->note->wechatHelp = " <a href='http://www.zentao.net/book/zentaopmshelp/367.html' target='_blank'><i class='icon-help'></i></a>";
|
||||
|
||||
$lang->webhook->note->typeList['bearychat'] = '请在倍洽中添加一个禅道机器人,并将其webhook填写到此处。';
|
||||
$lang->webhook->note->typeList['dingding'] = '请在钉钉中添加一个自定义机器人,并将其webhook填写到此处。';
|
||||
$lang->webhook->note->typeList['weixin'] = '请在企业微信中添加一个自定义机器人,并将其webhook填写到此处。';
|
||||
$lang->webhook->note->typeList['default'] = '从第三方系统获取webhook并填写到此处。';
|
||||
|
||||
$lang->webhook->error = new stdclass();
|
||||
$lang->webhook->error->curl = '需要加载php-curl扩展。';
|
||||
|
||||
@@ -34,12 +34,12 @@ $lang->webhook->date = '發送時間';
|
||||
$lang->webhook->data = '數據';
|
||||
$lang->webhook->result = '結果';
|
||||
|
||||
$lang->webhook->typeList[''] = '';
|
||||
$lang->webhook->typeList['dingding'] = '釘釘群通知機器人';
|
||||
$lang->webhook->typeList['dingapi'] = '釘釘工作消息通知';
|
||||
$lang->webhook->typeList['weixin'] = '企業微信群機器人';
|
||||
$lang->webhook->typeList['wechatApi'] = '企業微信應用消息';
|
||||
$lang->webhook->typeList['default'] = '其他';
|
||||
$lang->webhook->typeList[''] = '';
|
||||
$lang->webhook->typeList['dinggroup'] = '釘釘群通知機器人';
|
||||
$lang->webhook->typeList['dinguser'] = '釘釘工作消息通知';
|
||||
$lang->webhook->typeList['wechatgroup'] = '企業微信群機器人';
|
||||
$lang->webhook->typeList['wechatuser'] = '企業微信應用消息';
|
||||
$lang->webhook->typeList['default'] = '其他';
|
||||
|
||||
$lang->webhook->sendTypeList['sync'] = '同步';
|
||||
$lang->webhook->sendTypeList['async'] = '非同步';
|
||||
@@ -47,15 +47,17 @@ $lang->webhook->sendTypeList['async'] = '非同步';
|
||||
$lang->webhook->dingAgentId = '釘釘AgentId';
|
||||
$lang->webhook->dingAppKey = '釘釘AppKey';
|
||||
$lang->webhook->dingAppSecret = '釘釘AppSecret';
|
||||
$lang->webhook->dingUserid = '釘釘Userid';
|
||||
$lang->webhook->dingUserid = '釘釘用戶';
|
||||
$lang->webhook->dingBindStatus = '釘釘綁定狀態';
|
||||
|
||||
$lang->webhook->wechatCorpId = '企業ID';
|
||||
$lang->webhook->wechatCorpSecret = '應用的憑證密鑰';
|
||||
$lang->webhook->wechatAgentId = '企業應用的ID';
|
||||
$lang->webhook->wechatUserid = '微信Userid';
|
||||
$lang->webhook->wechatUserid = '微信用戶';
|
||||
$lang->webhook->wechatBindStatus = '微信綁定狀態';
|
||||
|
||||
$lang->webhook->zentaoUser = '禪道用戶';
|
||||
|
||||
$lang->webhook->dingBindStatusList['0'] = '未綁定';
|
||||
$lang->webhook->dingBindStatusList['1'] = '已綁定';
|
||||
|
||||
@@ -78,9 +80,9 @@ $lang->webhook->note->async = '非同步需要打開計劃任務';
|
||||
$lang->webhook->note->bind = '只有[釘釘/微信]工作通知類型才需要綁定用戶。';
|
||||
$lang->webhook->note->product = "此項為空時所有{$lang->productCommon}的動作都會觸發鈎子,否則只有關聯{$lang->productCommon}的動作才會觸發。";
|
||||
$lang->webhook->note->project = "此項為空時所有{$lang->projectCommon}的動作都會觸發鈎子,否則只有關聯{$lang->projectCommon}的動作才會觸發。";
|
||||
$lang->webhook->note->dingKey = " <a href='http://www.zentao.net/book/zentaopmshelp/358.html' target='_blank'><i class='icon-help'></i></a>";
|
||||
$lang->webhook->note->wechatCorpid = " <a href='https://work.weixin.qq.com/api/doc/90000/90135/90665#corpid' target='_blank'><i class='icon-help'></i></a>";
|
||||
$lang->webhook->note->wechatSecret = " <a href='https://work.weixin.qq.com/api/doc/90000/90135/90665#secret' target='_blank'><i class='icon-help'></i></a>";
|
||||
|
||||
$lang->webhook->note->dingHelp = " <a href='http://www.zentao.net/book/zentaopmshelp/358.html' target='_blank'><i class='icon-help'></i></a>";
|
||||
$lang->webhook->note->wechatHelp = " <a href='http://www.zentao.net/book/zentaopmshelp/367.html' target='_blank'><i class='icon-help'></i></a>";
|
||||
|
||||
$lang->webhook->note->typeList['bearychat'] = '請在倍洽中添加一個禪道機器人,並將其webhook填寫到此處。';
|
||||
$lang->webhook->note->typeList['dingding'] = '請在釘釘中添加一個自定義機器人,並將其webhook填寫到此處。';
|
||||
|
||||
@@ -153,7 +153,7 @@ class webhookModel extends model
|
||||
->get();
|
||||
$webhook->params = $this->post->params ? implode(',', $this->post->params) . ',text' : 'text';
|
||||
|
||||
if($webhook->type == 'dingapi')
|
||||
if($webhook->type == 'dinguser')
|
||||
{
|
||||
$webhook->secret = array();
|
||||
$webhook->secret['agentId'] = $webhook->agentId;
|
||||
@@ -167,7 +167,8 @@ class webhookModel extends model
|
||||
|
||||
$webhook->secret = json_encode($webhook->secret);
|
||||
$webhook->url = $this->config->webhook->dingapiUrl;
|
||||
}elseif ($webhook->type == 'wechatApi')
|
||||
}
|
||||
elseif ($webhook->type == 'wechatuser')
|
||||
{
|
||||
$webhook->secret = array();
|
||||
$webhook->secret['agentId'] = $webhook->wechatAgentId;
|
||||
@@ -219,7 +220,7 @@ class webhookModel extends model
|
||||
->get();
|
||||
$webhook->params = $this->post->params ? implode(',', $this->post->params) . ',text' : 'text';
|
||||
|
||||
if($webhook->type == 'dingapi')
|
||||
if($webhook->type == 'dinguser')
|
||||
{
|
||||
$webhook->secret = array();
|
||||
$webhook->secret['agentId'] = $webhook->agentId;
|
||||
@@ -232,7 +233,8 @@ class webhookModel extends model
|
||||
if(dao::isError()) return false;
|
||||
|
||||
$webhook->secret = json_encode($webhook->secret);
|
||||
}elseif ($webhook->type == 'wechatApi')
|
||||
}
|
||||
elseif ($webhook->type == 'wechatuser')
|
||||
{
|
||||
$webhook->secret = array();
|
||||
$webhook->secret['agentId'] = $webhook->wechatAgentId;
|
||||
@@ -310,7 +312,7 @@ class webhookModel extends model
|
||||
|
||||
if($webhook->sendType == 'async')
|
||||
{
|
||||
if($webhook->type == 'dingapi')
|
||||
if($webhook->type == 'dinguser')
|
||||
{
|
||||
$openIdList = $this->getOpenIdList($webhook->id, $actionID);
|
||||
if(empty($openIdList)) continue;
|
||||
@@ -383,15 +385,15 @@ class webhookModel extends model
|
||||
}
|
||||
$action->text = $text;
|
||||
|
||||
if($webhook->type == 'dingding' or $webhook->type == 'dingapi')
|
||||
if($webhook->type == 'dinggroup' or $webhook->type == 'dinguser')
|
||||
{
|
||||
$data = $this->getDingdingData($title, $text, $webhook->type == 'dingapi' ? '' : $mobile);
|
||||
$data = $this->getDingdingData($title, $text, $webhook->type == 'dinguser' ? '' : $mobile);
|
||||
}
|
||||
elseif($webhook->type == 'bearychat')
|
||||
{
|
||||
$data = $this->getBearychatData($text, $mobile, $email, $objectType, $objectID);
|
||||
}
|
||||
elseif($webhook->type == 'weixin' or $webhook->type == 'wechatApi')
|
||||
elseif($webhook->type == 'wechatgroup' or $webhook->type == 'wechatuser')
|
||||
{
|
||||
$data = $this->getWeixinData($title, $text, $mobile);
|
||||
}
|
||||
@@ -559,18 +561,20 @@ class webhookModel extends model
|
||||
{
|
||||
if(!extension_loaded('curl')) die(helper::jsonEncode($this->lang->webhook->error->curl));
|
||||
|
||||
if($webhook->type == 'dingapi' || $webhook->type == 'wechatApi')
|
||||
if($webhook->type == 'dinguser' || $webhook->type == 'wechatuser')
|
||||
{
|
||||
if(is_string($webhook->secret)) $webhook->secret = json_decode($webhook->secret);
|
||||
|
||||
$openIdList = $this->getOpenIdList($webhook->id, $actionID);
|
||||
if(empty($openIdList)) return false;
|
||||
if($webhook->type == 'dingapi'){
|
||||
if($webhook->type == 'dinguser')
|
||||
{
|
||||
$this->app->loadClass('dingapi', true);
|
||||
$dingapi = new dingapi($webhook->secret->appKey, $webhook->secret->appSecret, $webhook->secret->agentId);
|
||||
$result = $dingapi->send($openIdList, $sendData);
|
||||
return json_encode($result);
|
||||
}elseif ($webhook->type == 'wechatApi')
|
||||
}
|
||||
elseif ($webhook->type == 'wechatuser')
|
||||
{
|
||||
$this->app->loadClass('wechatapi', true);
|
||||
$wechatapi = new wechatapi($webhook->secret->appKey, $webhook->secret->appSecret, $webhook->secret->agentId);
|
||||
@@ -580,11 +584,11 @@ class webhookModel extends model
|
||||
}
|
||||
|
||||
$contentType = "Content-Type: {$webhook->contentType};charset=utf-8";
|
||||
if($webhook->type == 'dingding' or $webhook->type == 'weixin') $contentType = "Content-Type: application/json";
|
||||
if($webhook->type == 'dinggroup' or $webhook->type == 'wechatgroup') $contentType = "Content-Type: application/json";
|
||||
$header[] = $contentType;
|
||||
|
||||
$url = $webhook->url;
|
||||
if($webhook->type == 'dingding' and $webhook->secret)
|
||||
if($webhook->type == 'dinggroup' and $webhook->secret)
|
||||
{
|
||||
$timestamp = time() * 1000;
|
||||
$sign = $timestamp . "\n" . $webhook->secret;
|
||||
@@ -640,8 +644,7 @@ class webhookModel extends model
|
||||
|
||||
/**
|
||||
* Save log.
|
||||
*
|
||||
* @param int $webhookID
|
||||
*
|
||||
* @param int $actionID
|
||||
* @param object $webhook
|
||||
* @param string $data
|
||||
|
||||
@@ -5,22 +5,20 @@
|
||||
<h2><?php echo $lang->webhook->bind?></h2>
|
||||
</div>
|
||||
<form class='main-form' id='bindForm' target='hiddenwin' method='post' data-ride='table'>
|
||||
<table id='bindList' class='table table-fixed table-bordered active-disabled'>
|
||||
<table id='bindList' class='table table-fixed table-bordered active-disabled table-hover'>
|
||||
<thead>
|
||||
<tr class='text-center'>
|
||||
<th class='text-left'><?php echo $lang->user->account?></th>
|
||||
<th class='w-200px text-left'><?php echo $lang->user->realname?></th>
|
||||
<th class='w-200px'><?php echo $webhook->type == 'dingapi' ? $lang->webhook->dingUserid : $lang->webhook->wechatUserid;?></th>
|
||||
<th class='text-left' colspan="2"><?php echo $lang->webhook->zentaoUser?></th>
|
||||
<th class='text-left' colspan="2"><?php echo $webhook->type == 'dinguser' ? $lang->webhook->dingUserid : $lang->webhook->wechatUserid;?></th>
|
||||
<th class='w-100px'><?php echo $lang->actions;?></th>
|
||||
<th class='w-100px'><?php echo $webhook->type == 'dingapi' ? $lang->webhook->dingBindStatus : $lang->webhook->wechatBindStatus;?></th>
|
||||
<th class='w-100px'><?php echo $webhook->type == 'dinguser' ? $lang->webhook->dingBindStatus : $lang->webhook->wechatBindStatus;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $inputVars = 0;?>
|
||||
<?php foreach($users as $user):?>
|
||||
<tr>
|
||||
<td><?php echo $user->account;?></td>
|
||||
<td><?php echo $user->realname;?></td>
|
||||
<td colspan="2"><?php echo $user->account;?> <span class="label label-badge label-info label-outline"><?php echo $user->realname;?></span></td>
|
||||
<?php
|
||||
$userid = '';
|
||||
$bindStatus = 0;
|
||||
@@ -34,8 +32,10 @@
|
||||
$userid = $dingUsers[$user->realname];
|
||||
}
|
||||
?>
|
||||
<!-- <td>--><?php //echo html::select("userid[{$user->account}]", $useridPairs, 0, 'class="form-control"')?><!--</td>-->
|
||||
<td ><?php echo '<span class="label label-badge label-primary label-outline">' . $useridPairs[$userid] . '</span>'; echo html::input("userid[{$user->account}]", $userid, 'class="form-control hidden"');?></td>
|
||||
<td colspan="2">
|
||||
<?php echo '<span class="label label-badge label-primary label-outline">' . $useridPairs[$userid] . '</span>';?>
|
||||
<?php echo html::input("userid[{$user->account}]", $userid, 'class="form-control hidden"');?>
|
||||
</td>
|
||||
<td class='text-center c-actions'><?php echo '<button class="btn bind" type="button" data-value="userid[' . $user->account . ']"><i class="icon-common-edit icon-edit"></i></button>';?></td>
|
||||
<td class='text-center'><?php echo zget($lang->webhook->dingBindStatusList, $bindStatus, '');?></td>
|
||||
</tr>
|
||||
@@ -53,38 +53,18 @@
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</form>
|
||||
<div class="content" id="user-list">
|
||||
<?php echo html::select("userid", $useridPairs, 0, 'class="form-control" id="user-select"')?>
|
||||
<div class='table-footer'>
|
||||
<?php echo html::submitButton($lang->save, '', 'btn btn-primary btn-select');?>
|
||||
<?php echo html::submitButton($lang->cancel, '', 'btn btn-close');?>
|
||||
</div>
|
||||
<div class="text-hide" id="triggerTitle"><?php echo $lang->webhook->bind;?></div>
|
||||
<div class="content" id="userList">
|
||||
<?php echo html::select("userid", $useridPairs, 0, 'class="form-control" id="userSelect"');?>
|
||||
<div class='table-footer'><?php echo html::commonButton($lang->save, 'onclick = "confirmChanges();"', 'btn btn-primary');?></div>
|
||||
<script>
|
||||
$(".btn-close").click(function(){myModalTrigger.close()});
|
||||
$(".btn-select").click(function()
|
||||
{
|
||||
var inputValue1 = $("#user-select option:selected").val();
|
||||
var spanValue = $("#user-select option:selected").text();
|
||||
var inputName = $("#save-input").children('input').eq(0).attr("name");
|
||||
setInput(inputName, inputValue1, spanValue);
|
||||
myModalTrigger.close()
|
||||
});
|
||||
$("#userSelect").chosen();
|
||||
$('.chosen-container').eq(1).remove();
|
||||
</script>
|
||||
</div>
|
||||
<div id="save-input"></div>
|
||||
</div>
|
||||
<div id="saveInput"></div>
|
||||
</div>
|
||||
<script>
|
||||
var myModalTrigger = myModalTrigger = new $.zui.ModalTrigger({title:"<?php echo $lang->webhook->bind;?>", custom:$('#user-list').html(), height:"auto"});
|
||||
$(function () {$("#user-list").html("");});
|
||||
$(".bind").on("click",function()
|
||||
{
|
||||
var inputName = this.getAttribute("data-value");
|
||||
$("#save-input").html();
|
||||
$("#save-input").html("<input type='hidden' name='" + inputName + "' value=''>");
|
||||
myModalTrigger.show();
|
||||
});
|
||||
function setInput(setName, setValue1, spanValue){$("input[name='" + setName + "']").attr("value", setValue1); $("input[name='" + setName + "']").prev().html(spanValue);}
|
||||
<?php if(common::judgeSuhosinSetting($inputVars)):?>
|
||||
$(function()
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<td class='text' title='<?php echo $webhook->url;?>'><?php echo $webhook->url;?></td>
|
||||
<td class='c-actions text-right'>
|
||||
<?php
|
||||
if($webhook->type == 'dingapi' or $webhook->type == 'wechatApi') common::printIcon('webhook', 'bind', "webhookID=$id", '', 'list', 'link');
|
||||
if($webhook->type == 'dinguser' or $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'))
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='thWidth'><?php echo $lang->webhook->type;?></th>
|
||||
<td style="width:550px" ><?php echo html::select('type', $lang->webhook->typeList, '', "class='form-control'");?></td>
|
||||
<td style="width:550px" ><?php echo html::select('type', $lang->webhook->typeList, '', "class='form-control chosen'");?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -39,23 +39,23 @@
|
||||
<th><?php echo $lang->webhook->secret;?></th>
|
||||
<td><?php echo html::input('secret', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr class='dingapiTR'>
|
||||
<tr class='dinguserTR'>
|
||||
<th><?php echo $lang->webhook->dingAgentId;?></th>
|
||||
<td class='required'><?php echo html::input('agentId', '', "class='form-control'");?></td>
|
||||
<td><?php echo $lang->webhook->note->dingKey;?></td>
|
||||
<td><?php echo $lang->webhook->note->dingHelp;?></td>
|
||||
</tr>
|
||||
<tr class='dingapiTR'>
|
||||
<tr class='dinguserTR'>
|
||||
<th><?php echo $lang->webhook->dingAppKey;?></th>
|
||||
<td class='required'><?php echo html::input('appKey', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr class='dingapiTR'>
|
||||
<tr class='dinguserTR'>
|
||||
<th><?php echo $lang->webhook->dingAppSecret;?></th>
|
||||
<td class='required'><?php echo html::input('appSecret', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr class="wechatTR">
|
||||
<th><?php echo $lang->webhook->wechatCorpId;?></th>
|
||||
<td class='required'><?php echo html::input('wechatCorpId', '', "class='form-control'")?></td>
|
||||
<td><?php echo $lang->webhook->note->wechat;?></td>
|
||||
<td><?php echo $lang->webhook->note->wechatHelp;?></td>
|
||||
</tr>
|
||||
<tr class="wechatTR">
|
||||
<th><?php echo $lang->webhook->wechatCorpSecret;?></th>
|
||||
|
||||
@@ -29,22 +29,23 @@
|
||||
<td><?php echo html::input('name', $webhook->name, "class='form-control'");?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr id='urlTR' class='<?php echo in_array($webhook->type, array('dingapi', 'wechatApi')) ? 'hidden' : '';?>'>
|
||||
<tr id='urlTR' class='<?php echo in_array($webhook->type, array('dinguser', 'wechatuser')) ? 'hidden' : '';?>'>
|
||||
<th><?php echo $lang->webhook->url;?></th>
|
||||
<td><?php echo html::input('url', $webhook->url, "class='form-control'");?></td>
|
||||
<td><?php echo zget($lang->webhook->note->typeList, $webhook->type, '');?></td>
|
||||
</tr>
|
||||
<?php if($webhook->type == 'dingding'):?>
|
||||
<?php if($webhook->type == 'dinggroup'):?>
|
||||
<tr id='secretTR'>
|
||||
<th><?php echo $lang->webhook->secret;?></th>
|
||||
<td><?php echo html::input('secret', $webhook->secret, "class='form-control'");?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<?php if($webhook->type == 'dingapi'):?>
|
||||
<?php if($webhook->type == 'dinguser'):?>
|
||||
<?php $secret = json_decode($webhook->secret);?>
|
||||
<tr class='dingapiTR'>
|
||||
<th><?php echo $lang->webhook->dingAgentId;?></th>
|
||||
<td class='required'><?php echo html::input('agentId', $secret->agentId, "class='form-control'");?></td>
|
||||
<td><?php echo $lang->webhook->note->dingHelp;?></td>
|
||||
</tr>
|
||||
<tr class='dingapiTR'>
|
||||
<th><?php echo $lang->webhook->dingAppKey;?></th>
|
||||
@@ -55,22 +56,22 @@
|
||||
<td class='required'><?php echo html::input('appSecret', $secret->appSecret, "class='form-control'");?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<?php if($webhook->type == 'wechatApi'):?>
|
||||
<?php if($webhook->type == 'wechatuser'):?>
|
||||
<?php $secret = json_decode($webhook->secret);?>
|
||||
<tr class="wechatTR">
|
||||
<th><?php echo $lang->webhook->wechatCorpId;?></th>
|
||||
<td class='required'><?php echo html::input('wechatCorpId', $secret->appKey, "class='form-control'")?></td>
|
||||
<td><?php echo $lang->webhook->note->wechat;?></td>
|
||||
<th><?php echo $lang->webhook->wechatCorpId;?></th>
|
||||
<td class='required'><?php echo html::input('wechatCorpId', $secret->appKey, "class='form-control'")?></td>
|
||||
<td><?php echo $lang->webhook->note->wechatHelp;?></td>
|
||||
</tr>
|
||||
<tr class="wechatTR">
|
||||
<th><?php echo $lang->webhook->wechatCorpSecret;?></th>
|
||||
<td class='required'><?php echo html::input('wechatCorpSecret', $secret->appSecret, "class='form-control'")?></td>
|
||||
<td></td>
|
||||
<th><?php echo $lang->webhook->wechatCorpSecret;?></th>
|
||||
<td class='required'><?php echo html::input('wechatCorpSecret', $secret->appSecret, "class='form-control'")?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="wechatTR">
|
||||
<th><?php echo $lang->webhook->wechatAgentId;?></th>
|
||||
<td class='required'><?php echo html::input('wechatAgentId', $secret->agentId, "class='form-control'")?></td>
|
||||
<td></td>
|
||||
<th><?php echo $lang->webhook->wechatAgentId;?></th>
|
||||
<td class='required'><?php echo html::input('wechatAgentId', $secret->agentId, "class='form-control'")?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
@@ -78,7 +79,7 @@
|
||||
<td><?php echo html::input('domain', $webhook->domain, "class='form-control'");?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php if($webhook->type != 'dingding' and $webhook->type != 'dingapi'):?>
|
||||
<?php if(!in_array($webhook->type,array('dinggroup', 'dinguser', 'wechatgroup', 'wechatuser'))):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->webhook->sendType;?></th>
|
||||
<td><?php echo html::select('sendType', $lang->webhook->sendTypeList, $webhook->sendType, "class='form-control'");?></td>
|
||||
@@ -95,7 +96,7 @@
|
||||
<td><?php echo html::select('projects[]', $projects, $webhook->projects, "class='form-control chosen' multiple");?></td>
|
||||
<td><?php echo $lang->webhook->note->project;?></td>
|
||||
</tr>
|
||||
<?php if(strpos(',bearychat,dingding,dingapi,weixin,wechatApi,', ",$webhook->type,") === false):?>
|
||||
<?php if(strpos(',bearychat,dinggroup,dinguser,wechatgroup,wechatuser,', ",$webhook->type,") === false):?>
|
||||
<tr id='paramsTR'>
|
||||
<th>
|
||||
<div class='checkbox-primary'>
|
||||
|
||||
@@ -593,10 +593,11 @@ class zentao
|
||||
$responseData = json_decode($responseData->data);
|
||||
foreach ($extraFields as $k => $v)
|
||||
{
|
||||
$returnResult['result'][$v] = $responseData->$v;
|
||||
isset($responseData->$v) ? $returnResult['result'][$v] = $responseData->$v : $returnResult['result'][$v] = array();
|
||||
}
|
||||
if (count($extraFields) == 0) $returnResult['result'] = $responseData;
|
||||
} elseif (!empty($responseData->result))
|
||||
}
|
||||
elseif (!empty($responseData->result))
|
||||
{
|
||||
if (strcmp($responseData->result, 'success') === 0) $returnResult = array('status' => 1, 'msg' => 'success');
|
||||
$returnResult['result'] = $responseData->message;
|
||||
|
||||
Reference in New Issue
Block a user