From e3bc3cfb9cb051db3a0ae5788a6435227c3027b9 Mon Sep 17 00:00:00 2001 From: vilson <545522390@qq.com> Date: Fri, 12 Jul 2019 14:48:34 +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/project/behavior/Task.php | 29 ++++++++++++++------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/application/project/behavior/Task.php b/application/project/behavior/Task.php index cde4bcf..5088092 100644 --- a/application/project/behavior/Task.php +++ b/application/project/behavior/Task.php @@ -218,26 +218,27 @@ class Task } } //触发推送的事件 + $messageService = new MessageService(); + $messageDingTalk = new DingTalk(); $notifyActions = ['done', 'redo', 'assign']; + $notifyModel = new Notify(); + $member = Member::where(['code' => $data['memberCode']])->find(); + $notifyData['title'] = $member['name'] . ' ' . $remark; + $notifyData['content'] = $task['name']; + $notifyData['avatar'] = $member['avatar']; + $socketMessage = $socketGroupMessage = ['content' => $notifyData['content'], 'title' => $notifyData['title'], 'data' => ['organizationCode' => getCurrentOrganizationCode(), 'projectCode' => $task['project_code'], 'taskCode' => $task['code']]]; + $socketAction = $notifyData['action']; if (in_array($data['type'], $notifyActions)) { - //todo 短信,消息推送 - $notifyModel = new Notify(); - $member = Member::where(['code' => $data['memberCode']])->find(); - $notifyData['title'] = $member['name'] . ' ' . $remark; - $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(); + //todo 短信,消息推送 if ($taskMembers) { foreach ($taskMembers as $taskMember) { if ($taskMember['member_code'] == $data['memberCode']) { continue;//跳过产生者 } $member = Member::where(['code' => $taskMember['member_code']])->find(); - $result = $notifyModel->add($notifyData['title'], $notifyData['content'], $notifyData['type'], $data['memberCode'], $taskMember['member_code'], $notifyData['action'], json_encode($task), $notifyData['terminal'], $notifyData['avatar']); + //json_encode($task) + $result = $notifyModel->add($notifyData['title'], $notifyData['content'], $notifyData['type'], $data['memberCode'], $taskMember['member_code'], $notifyData['action'], [], $notifyData['terminal'], $notifyData['avatar']); if (isOpenDingTalkNoticePush()) { if ($member['dingtalk_userid']) { $params = [ @@ -257,9 +258,9 @@ class Task } } } - //通知所有组织内的成员 - $project = \app\common\Model\Project::where(['code' => $task['project_code']])->field('organization_code')->find(); - $messageService->sendToGroup($project['organization_code'], $socketGroupMessage, 'organization:task'); } + //通知所有组织内的成员 + $project = \app\common\Model\Project::where(['code' => $task['project_code']])->field('organization_code')->find(); + $messageService->sendToGroup($project['organization_code'], $socketGroupMessage, 'organization:task'); } }