Commit bd002ddd authored by 安宁's avatar 安宁

不同项目发送不同机器人

parent be5c78fd
<?php
namespace app\common\Model;
/**
* 钉钉机器人
* Class TaskLike
* @package app\common\Model
*/
class DingDing extends CommonModel
{
protected $append = [];
}
...@@ -16,6 +16,7 @@ use app\common\Model\ProjectVersion; ...@@ -16,6 +16,7 @@ use app\common\Model\ProjectVersion;
use app\common\Model\TaskMember; use app\common\Model\TaskMember;
use app\common\Model\TaskStages; use app\common\Model\TaskStages;
use app\common\Model\TaskWorkflowRule; use app\common\Model\TaskWorkflowRule;
use app\common\Model\DingDing;
use Exception; use Exception;
use mail\Mail; use mail\Mail;
use message\DingTalk; use message\DingTalk;
...@@ -323,13 +324,17 @@ class Task ...@@ -323,13 +324,17 @@ class Task
public function dingding($type, $task, $obj) public function dingding($type, $task, $obj)
{ {
$dingding = DingDing::where(['project' => $task['project_code']])->find();
if (!$dingding) {
return;
}
$ding = new \DingNotice\DingTalk([ $ding = new \DingNotice\DingTalk([
"default" => [ "default" => [
'enabled' => true, 'enabled' => true,
'token' => "a4eeb2dc0dd7a3cc627a0e9cff12487b393b667d35d1c3598f3e987536e33e6c", 'token' => $dingding['token'],
'timeout' => 2.0, 'timeout' => 2.0,
'ssl_verify' => false, 'ssl_verify' => false,
'secret' => 'SEC216b9359e12f0193a623ec3e4da2d65ce6fb6d29c16cb9f98be29d6b476303ad', 'secret' => $dingding['secret'],
] ]
]); ]);
$data = ''; $data = '';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment