From 21a340c39d113dcf8b435ce8ed76bc65505c43b7 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Fri, 5 Mar 2021 13:30:38 +0800 Subject: [PATCH] * Adjust code for webhook module. --- db/update15.0.sql | 31 +++--- module/webhook/config.php | 6 +- module/webhook/control.php | 80 +++++++------- module/webhook/lang/de.php | 12 +- module/webhook/lang/en.php | 12 +- module/webhook/lang/fr.php | 12 +- module/webhook/lang/vi.php | 12 +- module/webhook/lang/zh-cn.php | 12 +- module/webhook/lang/zh-tw.php | 12 +- module/webhook/model.php | 166 ++++++++++++++-------------- module/webhook/view/create.html.php | 6 +- module/webhook/view/edit.html.php | 6 +- 12 files changed, 184 insertions(+), 183 deletions(-) diff --git a/db/update15.0.sql b/db/update15.0.sql index e05c76f15c..c33c43fed8 100644 --- a/db/update15.0.sql +++ b/db/update15.0.sql @@ -11,8 +11,8 @@ ALTER TABLE `zt_project` ADD `percent` float unsigned NOT NULL DEFAULT '0' AFTER ALTER TABLE `zt_project` ADD `path` varchar(255) NOT NULL AFTER `parent`; ALTER TABLE `zt_project` ADD `grade` tinyint unsigned NOT NULL AFTER `path`; ALTER TABLE `zt_project` ADD `auth` char(30) NOT NULL AFTER `percent`; -ALTER TABLE `zt_project` ADD `milestone` enum('0','1') NOT NULL default '0' AFTER `percent`; -ALTER TABLE `zt_project` ADD `attribute` varchar(30) NOT NULL DEFAULT '' AFTER `budgetUnit`; +ALTER TABLE `zt_project` ADD `milestone` enum('0','1') NOT NULL default '0' AFTER `percent`; +ALTER TABLE `zt_project` ADD `attribute` varchar(30) NOT NULL DEFAULT '' AFTER `budgetUnit`; ALTER TABLE `zt_project` ADD `realBegan` date NOT NULL AFTER `end`; ALTER TABLE `zt_project` ADD `realEnd` date NOT NULL AFTER `realBegan`; ALTER TABLE `zt_project` ADD `version` smallint(6) NOT NULL AFTER `desc`; @@ -23,17 +23,18 @@ ALTER TABLE `zt_project` ADD `output` text NOT NULL AFTER `milestone`; ALTER TABLE `zt_project` ADD `lastEditedBy` varchar(30) NOT NULL DEFAULT '' AFTER `openedVersion`; ALTER TABLE `zt_project` ADD `lastEditedDate` datetime NOT NULL AFTER `lastEditedBy`; -ALTER TABLE `zt_action` CHANGE `project` `execution` mediumint(8) unsigned NOT NULL; -ALTER TABLE `zt_bug` CHANGE `project` `execution` mediumint(8) unsigned NOT NULL; -ALTER TABLE `zt_build` CHANGE `project` `execution` mediumint(8) unsigned NOT NULL; -ALTER TABLE `zt_burn` CHANGE `project` `execution` mediumint(8) unsigned NOT NULL; -ALTER TABLE `zt_doc` CHANGE `project` `execution` mediumint(8) unsigned NOT NULL; -ALTER TABLE `zt_relation` CHANGE `project` `execution` mediumint(8) unsigned NOT NULL; -ALTER TABLE `zt_relation` CHANGE `program` `project` mediumint(8) unsigned NOT NULL; -ALTER TABLE `zt_doclib` CHANGE `project` `execution` mediumint(8) unsigned NOT NULL; -ALTER TABLE `zt_task` CHANGE `project` `execution` mediumint(8) unsigned NOT NULL; -ALTER TABLE `zt_testreport` CHANGE `project` `execution` mediumint(8) unsigned NOT NULL; -ALTER TABLE `zt_testtask` CHANGE `project` `execution` mediumint(8) unsigned NOT NULL; +ALTER TABLE `zt_action` CHANGE `project` `execution` mediumint(8) unsigned NOT NULL; +ALTER TABLE `zt_bug` CHANGE `project` `execution` mediumint(8) unsigned NOT NULL; +ALTER TABLE `zt_build` CHANGE `project` `execution` mediumint(8) unsigned NOT NULL; +ALTER TABLE `zt_burn` CHANGE `project` `execution` mediumint(8) unsigned NOT NULL; +ALTER TABLE `zt_doc` CHANGE `project` `execution` mediumint(8) unsigned NOT NULL; +ALTER TABLE `zt_relation` CHANGE `project` `execution` mediumint(8) unsigned NOT NULL; +ALTER TABLE `zt_relation` CHANGE `program` `project` mediumint(8) unsigned NOT NULL; +ALTER TABLE `zt_doclib` CHANGE `project` `execution` mediumint(8) unsigned NOT NULL; +ALTER TABLE `zt_task` CHANGE `project` `execution` mediumint(8) unsigned NOT NULL; +ALTER TABLE `zt_testreport` CHANGE `project` `execution` mediumint(8) unsigned NOT NULL; +ALTER TABLE `zt_testtask` CHANGE `project` `execution` mediumint(8) unsigned NOT NULL; +ALTER TABLE `zt_webhook` CHANGE `projects` `executions` mediumint(8) unsigned NOT NULL; ALTER TABLE `zt_task` ADD `project` mediumint(8) unsigned NOT NULL AFTER `id`; ALTER TABLE `zt_doc` ADD `project` mediumint(8) unsigned NOT NULL AFTER `id`; @@ -138,7 +139,7 @@ ALTER TABLE `zt_block` ADD UNIQUE `account_module_type_order` (`account`, `modul INSERT INTO `zt_cron` (`m`, `h`, `dom`, `mon`, `dow`, `command`, `remark`, `type`, `buildin`, `status`, `lastTime`) VALUES ('1', '0', '*', '*', '*', 'moduleName=weekly&methodName=computeWeekly', '更新项目周报', 'system', 0, 'normal', '2020-08-27 10:07:53'); -ALTER TABLE `zt_story` ADD `URChanged` enum('0','1') NOT NULL DEFAULT '0' AFTER `version`; +ALTER TABLE `zt_story` ADD `URChanged` enum('0','1') NOT NULL DEFAULT '0' AFTER `version`; ALTER TABLE `zt_team` MODIFY `type` enum('project','task','stage','sprint') NOT NULL DEFAULT 'project' AFTER `root`; @@ -182,7 +183,7 @@ CREATE TABLE IF NOT EXISTS `zt_searchdict` ( PRIMARY KEY (`key`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -REPLACE INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES +REPLACE INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (1, 'product', 'dashboard'), (1, 'product', 'manageLine'), (1, 'projectstory', 'story'), diff --git a/module/webhook/config.php b/module/webhook/config.php index 02efd24b24..1962854a63 100644 --- a/module/webhook/config.php +++ b/module/webhook/config.php @@ -11,10 +11,10 @@ $config->webhook->feishuApiUrl = 'https://open.feishu.cn/open-apis/'; /* Unset entry to hide actions. */ $config->webhook->objectTypes = array(); -$config->webhook->objectTypes['product'] = array('opened', 'edited', 'closed', 'undeleted'); +$config->webhook->objectTypes['product'] = array('opened', 'edited', 'closed', 'undeleted'); $config->webhook->objectTypes['story'] = array('opened', 'edited', 'commented', 'frombug', 'changed', 'reviewed', 'closed', 'activated'); -$config->webhook->objectTypes['productplan'] = array('opened', 'edited'); -$config->webhook->objectTypes['project'] = array('opened', 'edited', 'started', 'delayed', 'suspended', 'closed', 'activated', 'undeleted'); +$config->webhook->objectTypes['productplan'] = array('opened', 'edited'); +$config->webhook->objectTypes['execution'] = array('opened', 'edited', 'started', 'delayed', 'suspended', 'closed', 'activated', 'undeleted'); $config->webhook->objectTypes['task'] = array('opened', 'edited', 'commented', 'assigned', 'confirmed', 'started', 'finished', 'paused', 'canceled', 'restarted', 'closed', 'activated'); $config->webhook->objectTypes['bug'] = array('opened', 'edited', 'commented', 'assigned', 'confirmed', 'bugconfirmed', 'resolved', 'closed', 'activated'); $config->webhook->objectTypes['case'] = array('opened', 'edited', 'commented', 'reviewed', 'confirmed'); diff --git a/module/webhook/control.php b/module/webhook/control.php index 46320d8823..ff5d3fafac 100644 --- a/module/webhook/control.php +++ b/module/webhook/control.php @@ -5,17 +5,17 @@ * @copyright Copyright 2009-2017 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com) * @license ZPL (http://zpl.pub/page/zplv12.html) * @author Gang Liu - * @package webhook + * @package webhook * @version $Id$ * @link http://www.zentao.net */ class webhook extends control { /** - * Construct - * - * @param string $moduleName - * @param string $methodName + * Construct + * + * @param string $moduleName + * @param string $methodName * @access public * @return void */ @@ -26,12 +26,12 @@ class webhook extends control } /** - * Browse webhooks. - * - * @param string $orderBy - * @param int $recTotal - * @param int $recPerPage - * @param int $pageID + * Browse webhooks. + * + * @param string $orderBy + * @param int $recTotal + * @param int $recPerPage + * @param int $pageID * @access public * @return void */ @@ -53,8 +53,8 @@ class webhook extends control } /** - * Create a webhook. - * + * Create a webhook. + * * @access public * @return void */ @@ -70,7 +70,7 @@ 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')->getExecutionPairs(); + $this->view->executions = $this->loadModel('execution')->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; @@ -78,9 +78,9 @@ class webhook extends control } /** - * Edit a webhook. - * - * @param int $id + * Edit a webhook. + * + * @param int $id * @access public * @return void */ @@ -101,15 +101,15 @@ class webhook extends control $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')->getExecutionPairs(); + $this->view->executions = $this->loadModel('execution')->getPairs(); $this->view->webhook = $webhook; $this->display(); } /** - * Delete a webhook. - * + * Delete a webhook. + * * @param int $id * @access public * @return void @@ -123,13 +123,13 @@ class webhook extends control } /** - * Browse logs of a webhook. - * - * @param int $id - * @param string $orderBy - * @param int $recTotal - * @param int $recPerPage - * @param int $pageID + * Browse logs of a webhook. + * + * @param int $id + * @param string $orderBy + * @param int $recTotal + * @param int $recPerPage + * @param int $pageID * @access public * @return void */ @@ -141,7 +141,7 @@ class webhook extends control $this->session->set('productPlanList', $uri); $this->session->set('releaseList', $uri); $this->session->set('storyList', $uri); - $this->session->set('projectList', $uri); + $this->session->set('executionList', $uri); $this->session->set('taskList', $uri); $this->session->set('buildList', $uri); $this->session->set('bugList', $uri); @@ -166,11 +166,11 @@ class webhook extends control /** * Bind dingtalk userid. - * - * @param int $id - * @param int $recTotal - * @param int $recPerPage - * @param int $pageID + * + * @param int $id + * @param int $recTotal + * @param int $recPerPage + * @param int $pageID * @access public * @return void */ @@ -265,8 +265,8 @@ class webhook extends control /** * choose dept. - * - * @param int $id + * + * @param int $id * @access public * @return void */ @@ -302,22 +302,22 @@ class webhook extends control } /** - * Send data by async. - * + * Send data by async. + * * @access public * @return void */ public function asyncSend() { $webhooks = $this->webhook->getList($orderBy = 'id_desc', $pager = null, $decode = false); - if(empty($webhooks)) + if(empty($webhooks)) { echo "NO WEBHOOK EXIST.\n"; return false; } $dataList = $this->webhook->getDataList(); - if(empty($dataList)) + if(empty($dataList)) { echo "OK\n"; return true; @@ -341,7 +341,7 @@ class webhook extends control } $this->webhook->saveLog($webhook, $data->action, $data->data, $result); } - + $this->webhook->setSentStatus($data->id, 'sended', $now); } diff --git a/module/webhook/lang/de.php b/module/webhook/lang/de.php index c3f5310d60..5eea6ae5eb 100644 --- a/module/webhook/lang/de.php +++ b/module/webhook/lang/de.php @@ -23,7 +23,7 @@ $lang->webhook->contentType = 'Content Type'; $lang->webhook->sendType = 'Sendungs Typ'; $lang->webhook->secret = 'Secret'; $lang->webhook->product = "{$lang->productCommon}"; -$lang->webhook->project = "{$lang->executionCommon}"; +$lang->webhook->execution = "{$lang->executionCommon}"; $lang->webhook->params = 'Parameter'; $lang->webhook->action = 'Aktion'; $lang->webhook->desc = 'Beschreibung'; @@ -66,7 +66,7 @@ $lang->webhook->dingBindStatusList['1'] = 'Yes'; $lang->webhook->paramsList['objectType'] = 'Objekt Typ'; $lang->webhook->paramsList['objectID'] = 'Objekt ID'; $lang->webhook->paramsList['product'] = "{$lang->productCommon}"; -$lang->webhook->paramsList['project'] = "{$lang->executionCommon}"; +$lang->webhook->paramsList['execution'] = "{$lang->executionCommon}"; $lang->webhook->paramsList['action'] = 'Aktion'; $lang->webhook->paramsList['actor'] = 'Actor'; $lang->webhook->paramsList['date'] = 'Datum'; @@ -78,10 +78,10 @@ $lang->webhook->confirmDelete = 'Möchten Sie diesen Hook löschen?'; $lang->webhook->trimWords = ''; $lang->webhook->note = new stdClass(); -$lang->webhook->note->async = 'Wenn der Sendungstyp asynchron ist, wird Cron benötigt.'; -$lang->webhook->note->bind = 'Bind User is only required for Dingding Notifier.'; -$lang->webhook->note->product = "Alle Aktionen triggern den Hook wenn das {$lang->productCommon} leer ist, andernsfalls werden nur Aktionen des {$lang->productCommon} ausgelöst."; -$lang->webhook->note->project = "Alle Aktionen triggern den Hook wenn das {$lang->executionCommon} leer ist, andernsfalls werden nur Aktionen des {$lang->executionCommon} ausgelöst."; +$lang->webhook->note->async = 'Wenn der Sendungstyp asynchron ist, wird Cron benötigt.'; +$lang->webhook->note->bind = 'Bind User is only required for Dingding Notifier.'; +$lang->webhook->note->product = "Alle Aktionen triggern den Hook wenn das {$lang->productCommon} leer ist, andernsfalls werden nur Aktionen des {$lang->productCommon} ausgelöst."; +$lang->webhook->note->execution = "Alle Aktionen triggern den Hook wenn das {$lang->executionCommon} leer ist, andernsfalls werden nur Aktionen des {$lang->executionCommon} ausgelöst."; $lang->webhook->note->dingHelp = " "; $lang->webhook->note->wechatHelp = " "; diff --git a/module/webhook/lang/en.php b/module/webhook/lang/en.php index 5e8a2c43d7..f2a23ddba3 100644 --- a/module/webhook/lang/en.php +++ b/module/webhook/lang/en.php @@ -23,7 +23,7 @@ $lang->webhook->contentType = 'Content Type'; $lang->webhook->sendType = 'Sending Type'; $lang->webhook->secret = 'Secret'; $lang->webhook->product = "{$lang->productCommon}"; -$lang->webhook->project = "{$lang->executionCommon}"; +$lang->webhook->execution = "{$lang->executionCommon}"; $lang->webhook->params = 'Parameters'; $lang->webhook->action = 'Trigger Action'; $lang->webhook->desc = 'Description'; @@ -66,7 +66,7 @@ $lang->webhook->dingBindStatusList['1'] = 'Yes'; $lang->webhook->paramsList['objectType'] = 'Object Type'; $lang->webhook->paramsList['objectID'] = 'Object ID'; $lang->webhook->paramsList['product'] = "{$lang->productCommon}"; -$lang->webhook->paramsList['project'] = "{$lang->executionCommon}"; +$lang->webhook->paramsList['execution'] = "{$lang->executionCommon}"; $lang->webhook->paramsList['action'] = 'Action'; $lang->webhook->paramsList['actor'] = 'ActedBy'; $lang->webhook->paramsList['date'] = 'ActedDate'; @@ -78,10 +78,10 @@ $lang->webhook->confirmDelete = 'Do you want to delete this hook?'; $lang->webhook->trimWords = ''; $lang->webhook->note = new stdClass(); -$lang->webhook->note->async = 'If it is asynchronous, you have to go to Admin-System to turn on the cron.'; -$lang->webhook->note->bind = 'Bind User is only required for Dingding Notifier.'; -$lang->webhook->note->product = "All actions will trigger the hook if {$lang->productCommon} is empty, or only actions of selected {$lang->productCommon} will trigger it."; -$lang->webhook->note->project = "All actions will trigger the hook if {$lang->executionCommon} is empty, or only actions of selected {$lang->executionCommon} will trigger it."; +$lang->webhook->note->async = 'If it is asynchronous, you have to go to Admin-System to turn on the cron.'; +$lang->webhook->note->bind = 'Bind User is only required for Dingding Notifier.'; +$lang->webhook->note->product = "All actions will trigger the hook if {$lang->productCommon} is empty, or only actions of selected {$lang->productCommon} will trigger it."; +$lang->webhook->note->execution = "All actions will trigger the hook if {$lang->executionCommon} is empty, or only actions of selected {$lang->executionCommon} will trigger it."; $lang->webhook->note->dingHelp = " "; $lang->webhook->note->wechatHelp = " "; diff --git a/module/webhook/lang/fr.php b/module/webhook/lang/fr.php index 1749a314cc..714e52e967 100644 --- a/module/webhook/lang/fr.php +++ b/module/webhook/lang/fr.php @@ -23,7 +23,7 @@ $lang->webhook->contentType = 'Type de contenu'; $lang->webhook->sendType = "Type d'envoi"; $lang->webhook->secret = 'Secret'; $lang->webhook->product = "{$lang->productCommon}"; -$lang->webhook->project = "{$lang->executionCommon}"; +$lang->webhook->execution = "{$lang->executionCommon}"; $lang->webhook->params = 'Paramètres'; $lang->webhook->action = 'Action capturée'; $lang->webhook->desc = 'Description'; @@ -66,7 +66,7 @@ $lang->webhook->dingBindStatusList['1'] = 'Yes'; $lang->webhook->paramsList['objectType'] = "Type d'objet"; $lang->webhook->paramsList['objectID'] = 'ID Objet'; $lang->webhook->paramsList['product'] = "{$lang->productCommon}"; -$lang->webhook->paramsList['project'] = "{$lang->executionCommon}"; +$lang->webhook->paramsList['execution'] = "{$lang->executionCommon}"; $lang->webhook->paramsList['action'] = 'Action'; $lang->webhook->paramsList['actor'] = 'Accomplie par'; $lang->webhook->paramsList['date'] = 'le'; @@ -78,10 +78,10 @@ $lang->webhook->confirmDelete = 'Voulez-vous vraiment supprimer ce flux ?'; $lang->webhook->trimWords = ''; $lang->webhook->note = new stdClass(); -$lang->webhook->note->async = "Si le type d'envoi est asynchrone, vous devez aller dans la console d'administration pour lancer la tâche cron."; -$lang->webhook->note->bind = "Lier l'utilisateur n'est requis que pour Dingding Notifier."; -$lang->webhook->note->product = "Toutes les actions vont déclencher le flux si {$lang->productCommon} est vide, ou seulement les actions du {$lang->productCommon} sélectionné vont le déclencher."; -$lang->webhook->note->project = "Toutes les actions vont déclencher le flux si {$lang->executionCommon} est vide, ou seulement les actions du {$lang->executionCommon} sélectionné vont le déclencher."; +$lang->webhook->note->async = "Si le type d'envoi est asynchrone, vous devez aller dans la console d'administration pour lancer la tâche cron."; +$lang->webhook->note->bind = "Lier l'utilisateur n'est requis que pour Dingding Notifier."; +$lang->webhook->note->product = "Toutes les actions vont déclencher le flux si {$lang->productCommon} est vide, ou seulement les actions du {$lang->productCommon} sélectionné vont le déclencher."; +$lang->webhook->note->execution = "Toutes les actions vont déclencher le flux si {$lang->executionCommon} est vide, ou seulement les actions du {$lang->executionCommon} sélectionné vont le déclencher."; $lang->webhook->note->dingHelp = " "; $lang->webhook->note->wechatHelp = " "; diff --git a/module/webhook/lang/vi.php b/module/webhook/lang/vi.php index 98b49bc738..5e1d985b2d 100644 --- a/module/webhook/lang/vi.php +++ b/module/webhook/lang/vi.php @@ -23,7 +23,7 @@ $lang->webhook->contentType = 'Content loại'; $lang->webhook->sendType = 'Sending loại'; $lang->webhook->secret = 'Secret'; $lang->webhook->product = "{$lang->productCommon}"; -$lang->webhook->project = "{$lang->executionCommon}"; +$lang->webhook->execution = "{$lang->executionCommon}"; $lang->webhook->params = 'Thông số'; $lang->webhook->action = 'Trigger hành động'; $lang->webhook->desc = 'Mô tả'; @@ -66,7 +66,7 @@ $lang->webhook->dingBindStatusList['1'] = 'Có'; $lang->webhook->paramsList['objectType'] = 'Loại đối tượng'; $lang->webhook->paramsList['objectID'] = 'ID đối tượng'; $lang->webhook->paramsList['product'] = "{$lang->productCommon}"; -$lang->webhook->paramsList['project'] = "{$lang->executionCommon}"; +$lang->webhook->paramsList['execution'] = "{$lang->executionCommon}"; $lang->webhook->paramsList['action'] = 'Hành động'; $lang->webhook->paramsList['actor'] = 'ActedBy'; $lang->webhook->paramsList['date'] = 'ActedDate'; @@ -78,10 +78,10 @@ $lang->webhook->confirmDelete = 'Bạn có muốn xóa this hook?'; $lang->webhook->trimWords = ''; $lang->webhook->note = new stdClass(); -$lang->webhook->note->async = 'If it is asynchronous, you have to go to Admin-System to bật CRON này.'; -$lang->webhook->note->bind = 'Bind User is only required for Dingding Notifier.'; -$lang->webhook->note->product = "Tất cả actions will trigger the hook if {$lang->productCommon} trống, or only actions of selected {$lang->productCommon} will trigger it."; -$lang->webhook->note->project = "Tất cả actions will trigger the hook if {$lang->executionCommon} trống, or only actions of selected {$lang->executionCommon} will trigger it."; +$lang->webhook->note->async = 'If it is asynchronous, you have to go to Admin-System to bật CRON này.'; +$lang->webhook->note->bind = 'Bind User is only required for Dingding Notifier.'; +$lang->webhook->note->product = "Tất cả actions will trigger the hook if {$lang->productCommon} trống, or only actions of selected {$lang->productCommon} will trigger it."; +$lang->webhook->note->execution = "Tất cả actions will trigger the hook if {$lang->executionCommon} trống, or only actions of selected {$lang->executionCommon} will trigger it."; $lang->webhook->note->dingHelp = " "; $lang->webhook->note->wechatHelp = " "; diff --git a/module/webhook/lang/zh-cn.php b/module/webhook/lang/zh-cn.php index 28ab0f8044..61dd3df00c 100644 --- a/module/webhook/lang/zh-cn.php +++ b/module/webhook/lang/zh-cn.php @@ -23,7 +23,7 @@ $lang->webhook->contentType = '内容类型'; $lang->webhook->sendType = '发送方式'; $lang->webhook->secret = '密钥'; $lang->webhook->product = "关联{$lang->productCommon}"; -$lang->webhook->project = "关联{$lang->executionCommon}"; +$lang->webhook->execution = "关联{$lang->executionCommon}"; $lang->webhook->params = '参数'; $lang->webhook->action = '触发动作'; $lang->webhook->desc = '描述'; @@ -73,7 +73,7 @@ $lang->webhook->dingBindStatusList['1'] = '已绑定'; $lang->webhook->paramsList['objectType'] = '对象类型'; $lang->webhook->paramsList['objectID'] = '对象ID'; $lang->webhook->paramsList['product'] = "所属{$lang->productCommon}"; -$lang->webhook->paramsList['project'] = "所属{$lang->executionCommon}"; +$lang->webhook->paramsList['execution'] = "所属{$lang->executionCommon}"; $lang->webhook->paramsList['action'] = '动作'; $lang->webhook->paramsList['actor'] = '操作者'; $lang->webhook->paramsList['date'] = '操作日期'; @@ -85,10 +85,10 @@ $lang->webhook->confirmDelete = '您确认要删除该webhook吗?'; $lang->webhook->trimWords = '了'; $lang->webhook->note = new stdClass(); -$lang->webhook->note->async = '异步需要打开计划任务。'; -$lang->webhook->note->bind = '只有[钉钉/微信]工作通知类型才需要绑定用户。'; -$lang->webhook->note->product = "此项为空时所有{$lang->productCommon}的动作都会触发钩子,否则只有关联{$lang->productCommon}的动作才会触发。"; -$lang->webhook->note->project = "此项为空时所有{$lang->executionCommon}的动作都会触发钩子,否则只有关联{$lang->executionCommon}的动作才会触发。"; +$lang->webhook->note->async = '异步需要打开计划任务。'; +$lang->webhook->note->bind = '只有[钉钉/微信]工作通知类型才需要绑定用户。'; +$lang->webhook->note->product = "此项为空时所有{$lang->productCommon}的动作都会触发钩子,否则只有关联{$lang->productCommon}的动作才会触发。"; +$lang->webhook->note->execution = "此项为空时所有{$lang->executionCommon}的动作都会触发钩子,否则只有关联{$lang->executionCommon}的动作才会触发。"; $lang->webhook->note->dingHelp = " "; $lang->webhook->note->wechatHelp = " "; diff --git a/module/webhook/lang/zh-tw.php b/module/webhook/lang/zh-tw.php index 517a3b27a6..8521ea31ee 100644 --- a/module/webhook/lang/zh-tw.php +++ b/module/webhook/lang/zh-tw.php @@ -23,7 +23,7 @@ $lang->webhook->contentType = '內容類型'; $lang->webhook->sendType = '發送方式'; $lang->webhook->secret = '密鑰'; $lang->webhook->product = "關聯{$lang->productCommon}"; -$lang->webhook->project = "關聯{$lang->executionCommon}"; +$lang->webhook->execution = "關聯{$lang->executionCommon}"; $lang->webhook->params = '參數'; $lang->webhook->action = '觸發動作'; $lang->webhook->desc = '描述'; @@ -66,7 +66,7 @@ $lang->webhook->dingBindStatusList['1'] = '已綁定'; $lang->webhook->paramsList['objectType'] = '對象類型'; $lang->webhook->paramsList['objectID'] = '對象ID'; $lang->webhook->paramsList['product'] = "所屬{$lang->productCommon}"; -$lang->webhook->paramsList['project'] = "所屬{$lang->executionCommon}"; +$lang->webhook->paramsList['execution'] = "所屬{$lang->executionCommon}"; $lang->webhook->paramsList['action'] = '動作'; $lang->webhook->paramsList['actor'] = '操作者'; $lang->webhook->paramsList['date'] = '操作日期'; @@ -78,10 +78,10 @@ $lang->webhook->confirmDelete = '您確認要刪除該webhook嗎?'; $lang->webhook->trimWords = '了'; $lang->webhook->note = new stdClass(); -$lang->webhook->note->async = '非同步需要打開計劃任務。'; -$lang->webhook->note->bind = '只有[釘釘/微信]工作通知類型才需要綁定用戶。'; -$lang->webhook->note->product = "此項為空時所有{$lang->productCommon}的動作都會觸發鈎子,否則只有關聯{$lang->productCommon}的動作才會觸發。"; -$lang->webhook->note->project = "此項為空時所有{$lang->executionCommon}的動作都會觸發鈎子,否則只有關聯{$lang->executionCommon}的動作才會觸發。"; +$lang->webhook->note->async = '非同步需要打開計劃任務。'; +$lang->webhook->note->bind = '只有[釘釘/微信]工作通知類型才需要綁定用戶。'; +$lang->webhook->note->product = "此項為空時所有{$lang->productCommon}的動作都會觸發鈎子,否則只有關聯{$lang->productCommon}的動作才會觸發。"; +$lang->webhook->note->execution = "此項為空時所有{$lang->executionCommon}的動作都會觸發鈎子,否則只有關聯{$lang->executionCommon}的動作才會觸發。"; $lang->webhook->note->dingHelp = " "; $lang->webhook->note->wechatHelp = " "; diff --git a/module/webhook/model.php b/module/webhook/model.php index ecc6186077..306d100d21 100644 --- a/module/webhook/model.php +++ b/module/webhook/model.php @@ -5,18 +5,18 @@ * @copyright Copyright 2009-2017 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com) * @license ZPL (http://zpl.pub/page/zplv12.html) * @author Gang Liu - * @package webhook + * @package webhook * @version $Id$ * @link http://www.zentao.net */ class webhookModel extends model { /** - * Get a webhook by id. - * + * Get a webhook by id. + * * @param int $id * @access public - * @return object + * @return object */ public function getByID($id) { @@ -25,8 +25,8 @@ class webhookModel extends model } /** - * Get webhook list. - * + * Get webhook list. + * * @param string $orderBy * @param object $pager * @param bool $decode @@ -44,13 +44,13 @@ class webhookModel extends model } /** - * Get log list of a webhook. - * + * Get log list of a webhook. + * * @param int $id - * @param string $orderBy - * @param object $pager + * @param string $orderBy + * @param object $pager * @access public - * @return array + * @return array */ public function getLogList($id, $orderBy = 'date_desc', $pager = null) { @@ -116,8 +116,8 @@ class webhookModel extends model } /** - * Get saved data list. - * + * Get saved data list. + * * @access public * @return array */ @@ -130,7 +130,7 @@ class webhookModel extends model /** * Get bind users. - * + * * @param int $webhookID * @param array $users * @access public @@ -145,8 +145,8 @@ class webhookModel extends model } /** - * Create a webhook. - * + * Create a webhook. + * * @access public * @return bool */ @@ -156,7 +156,7 @@ class webhookModel extends model ->add('createdBy', $this->app->user->account) ->add('createdDate', helper::now()) ->join('products', ',') - ->join('projects', ',') + ->join('executions', ',') ->skipSpecial('url') ->trim('agentId,appKey,appSecret,wechatAgentId,wechatCorpId,wechatCorpSecret,feishuAppId,feishuAppSecret') ->remove('allParams, allActions') @@ -206,7 +206,7 @@ class webhookModel extends model $webhook->secret = json_encode($webhook->secret); $webhook->url = $this->config->webhook->feishuApiUrl; } - + $this->dao->insert(TABLE_WEBHOOK)->data($webhook, 'agentId,appKey,appSecret,wechatCorpId,wechatCorpSecret,wechatAgentId,feishuAppId,feishuAppSecret') ->batchCheck($this->config->webhook->create->requiredFields, 'notempty') ->autoCheck() @@ -215,8 +215,8 @@ class webhookModel extends model } /** - * Update a webhook. - * + * Update a webhook. + * * @param int $id * @access public * @return bool @@ -227,9 +227,9 @@ class webhookModel extends model ->add('editedBy', $this->app->user->account) ->add('editedDate', helper::now()) ->setDefault('products', '') - ->setDefault('projects', '') + ->setDefault('executions', '') ->join('products', ',') - ->join('projects', ',') + ->join('executions', ',') ->skipSpecial('url') ->trim('agentId,appKey,appSecret,wechatAgentId,wechatCorpId,wechatCorpSecret,feishuAppId,feishuAppSecret') ->remove('allParams, allActions') @@ -287,8 +287,8 @@ class webhookModel extends model /** * Bind ding openID. - * - * @param int $webhookID + * + * @param int $webhookID * @access public * @return bool */ @@ -316,14 +316,14 @@ class webhookModel extends model } /** - * Send data. - * - * @param string $objectType - * @param int $objectID - * @param string $actionType - * @param int $actionID + * Send data. + * + * @param string $objectType + * @param int $objectID + * @param string $actionType + * @param int $actionID * @access public - * @return bool + * @return bool */ public function send($objectType, $objectID, $actionType, $actionID, $actor = '') { @@ -355,11 +355,11 @@ class webhookModel extends model } /** - * Build data. - * - * @param string $objectType - * @param int $objectID - * @param string $actionType + * Build data. + * + * @param string $objectType + * @param int $objectID + * @param string $actionType * @param int $actionID * @param object $webhook * @access public @@ -380,9 +380,9 @@ class webhookModel extends model $intersect = array_intersect($webhookProducts, $actionProduct); if(!$intersect) return false; } - if($webhook->projects) + if($webhook->executions) { - if(strpos(",$webhook->projects,", ",$action->project,") === false) return false; + if(strpos(",$webhook->executions,", ",$action->execution,") === false) return false; } static $users = array(); @@ -437,10 +437,10 @@ class webhookModel extends model } /** - * Get view link. - * - * @param string $objectType - * @param int $objectID + * Get view link. + * + * @param string $objectType + * @param int $objectID * @access public * @return string */ @@ -460,13 +460,13 @@ class webhookModel extends model } /** - * Get hook data for dingding. - * - * @param string $title - * @param string $text - * @param string $mobile + * Get hook data for dingding. + * + * @param string $title + * @param string $text + * @param string $mobile * @access public - * @return object + * @return object */ public function getDingdingData($title, $text, $mobile) { @@ -493,15 +493,15 @@ class webhookModel extends model } /** - * Get hook data for bearychat. - * - * @param string $text - * @param string $mobile - * @param string $email - * @param string $objectType - * @param int $objectID + * Get hook data for bearychat. + * + * @param string $text + * @param string $mobile + * @param string $email + * @param string $objectType + * @param int $objectID * @access public - * @return object + * @return object */ public function getBearychatData($text, $mobile, $email, $objectType, $objectID) { @@ -520,7 +520,7 @@ class webhookModel extends model { $attachment = array(); $attachment['title'] = $file->title; - $attachment['images'][]['url'] = common::getSysURL() . $this->file->webPath . $file->pathname; + $attachment['images'][]['url'] = common::getSysURL() . $this->file->webPath . $file->pathname; $data->attachments[] = $attachment; } } @@ -531,10 +531,10 @@ class webhookModel extends model /** * Get weixin data. - * - * @param string $title - * @param string $text - * @param string $mobile + * + * @param string $title + * @param string $text + * @param string $mobile * @access public * @return object */ @@ -564,8 +564,8 @@ class webhookModel extends model /** * Get openID list. - * - * @param int $actionID + * + * @param int $actionID * @access public * @return string */ @@ -588,13 +588,13 @@ class webhookModel extends model } /** - * Post hook data. - * - * @param object $webhook - * @param string $sendData - * @param int $actionID + * Post hook data. + * + * @param object $webhook + * @param string $sendData + * @param int $actionID * @access public - * @return int + * @return int */ public function fetchHook($webhook, $sendData, $actionID = 0) { @@ -677,11 +677,11 @@ class webhookModel extends model } /** - * Save datas. - * - * @param int $webhookID - * @param int $actionID - * @param string $data + * Save datas. + * + * @param int $webhookID + * @param int $actionID + * @param string $data * @access public * @return bool */ @@ -702,14 +702,14 @@ class webhookModel extends model } /** - * Save log. + * Save log. * - * @param object $webhook - * @param int $actionID - * @param string $data + * @param object $webhook + * @param int $actionID + * @param string $data * @param string $result * @access public - * @return bool + * @return bool */ public function saveLog($webhook, $actionID, $data, $result) { @@ -729,10 +729,10 @@ class webhookModel extends model /** * Set sent status. - * - * @param array $idList - * @param string $status - * @param string $time + * + * @param array $idList + * @param string $status + * @param string $time * @access public * @return void */ diff --git a/module/webhook/view/create.html.php b/module/webhook/view/create.html.php index 65bfb23dff..9221d2df84 100644 --- a/module/webhook/view/create.html.php +++ b/module/webhook/view/create.html.php @@ -91,9 +91,9 @@ webhook->note->product;?> - webhook->project;?> - - webhook->note->project;?> + webhook->execution;?> + + webhook->note->execution;?> diff --git a/module/webhook/view/edit.html.php b/module/webhook/view/edit.html.php index efba582f64..a781373b23 100644 --- a/module/webhook/view/edit.html.php +++ b/module/webhook/view/edit.html.php @@ -104,9 +104,9 @@ webhook->note->product;?> - webhook->project;?> - projects, "class='form-control chosen' multiple");?> - webhook->note->project;?> + webhook->execution;?> + executions, "class='form-control chosen' multiple");?> + webhook->note->execution;?> type,") === false):?>