From 5374158453107954c5dc51ba1873b278b1025631 Mon Sep 17 00:00:00 2001 From: vilson <545522390@qq.com> Date: Fri, 12 Jul 2019 14:36:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8E=A8=E9=80=81=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: vilson <545522390@qq.com> --- application/index/controller/Index.php | 3 ++- application/project/behavior/Task.php | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/application/index/controller/Index.php b/application/index/controller/Index.php index 1881ab7..a01e93f 100644 --- a/application/index/controller/Index.php +++ b/application/index/controller/Index.php @@ -22,6 +22,7 @@ use app\common\Model\TaskLike; use app\common\Model\TaskMember; use app\common\Model\TaskStages; use app\common\Model\Notify; +use app\common\Model\TaskWorkflowRule; use controller\BasicApi; use Exception; use Firebase\JWT\JWT; @@ -236,7 +237,7 @@ class Index extends BasicApi } $messageService = new MessageService(); $messageService->bindUid($clientId, $uid); - $messageService->joinGroup($clientId, 'project'); + $messageService->joinGroup($clientId, getCurrentOrganizationCode()); $this->success('', $uid); } diff --git a/application/project/behavior/Task.php b/application/project/behavior/Task.php index 5b34fe1..cde4bcf 100644 --- a/application/project/behavior/Task.php +++ b/application/project/behavior/Task.php @@ -227,9 +227,11 @@ class Task $notifyData['content'] = $task['name']; $notifyData['avatar'] = $member['avatar']; $taskMembers = TaskMember::where(['task_code' => $task['code']])->select()->toArray(); + $socketMessage = $socketGroupMessage = ['content' => $notifyData['content'], 'title' => $notifyData['title'], 'data' => ['organizationCode' => getCurrentOrganizationCode(), 'projectCode' => $task['project_code'], 'taskCode' => $task['code']]]; + $socketAction = $notifyData['action']; + $messageService = new MessageService(); + $messageDingTalk = new DingTalk(); if ($taskMembers) { - $messageService = new MessageService(); - $messageDingTalk = new DingTalk(); foreach ($taskMembers as $taskMember) { if ($taskMember['member_code'] == $data['memberCode']) { continue;//跳过产生者 @@ -250,10 +252,14 @@ class Task } } if (isOpenNoticePush()) { - $messageService->sendToUid($taskMember['member_code'], ['content' => $notifyData['content'], 'title' => $notifyData['title'], 'data' => ['organizationCode' => getCurrentOrganizationCode(), 'projectCode' => $task['project_code'], 'taskCode' => $task['code']], 'notify' => $result], $notifyData['action']); + $socketMessage['notify'] = $result; + $messageService->sendToUid($taskMember['member_code'], $socketMessage, $socketAction); } } } + //通知所有组织内的成员 + $project = \app\common\Model\Project::where(['code' => $task['project_code']])->field('organization_code')->find(); + $messageService->sendToGroup($project['organization_code'], $socketGroupMessage, 'organization:task'); } } }