优化推送数据结构
Signed-off-by: vilson <545522390@qq.com>
This commit is contained in:
parent
5374158453
commit
e3bc3cfb9c
@ -218,26 +218,27 @@ class Task
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//触发推送的事件
|
//触发推送的事件
|
||||||
|
$messageService = new MessageService();
|
||||||
|
$messageDingTalk = new DingTalk();
|
||||||
$notifyActions = ['done', 'redo', 'assign'];
|
$notifyActions = ['done', 'redo', 'assign'];
|
||||||
if (in_array($data['type'], $notifyActions)) {
|
|
||||||
//todo 短信,消息推送
|
|
||||||
$notifyModel = new Notify();
|
$notifyModel = new Notify();
|
||||||
$member = Member::where(['code' => $data['memberCode']])->find();
|
$member = Member::where(['code' => $data['memberCode']])->find();
|
||||||
$notifyData['title'] = $member['name'] . ' ' . $remark;
|
$notifyData['title'] = $member['name'] . ' ' . $remark;
|
||||||
$notifyData['content'] = $task['name'];
|
$notifyData['content'] = $task['name'];
|
||||||
$notifyData['avatar'] = $member['avatar'];
|
$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']]];
|
$socketMessage = $socketGroupMessage = ['content' => $notifyData['content'], 'title' => $notifyData['title'], 'data' => ['organizationCode' => getCurrentOrganizationCode(), 'projectCode' => $task['project_code'], 'taskCode' => $task['code']]];
|
||||||
$socketAction = $notifyData['action'];
|
$socketAction = $notifyData['action'];
|
||||||
$messageService = new MessageService();
|
if (in_array($data['type'], $notifyActions)) {
|
||||||
$messageDingTalk = new DingTalk();
|
$taskMembers = TaskMember::where(['task_code' => $task['code']])->select()->toArray();
|
||||||
|
//todo 短信,消息推送
|
||||||
if ($taskMembers) {
|
if ($taskMembers) {
|
||||||
foreach ($taskMembers as $taskMember) {
|
foreach ($taskMembers as $taskMember) {
|
||||||
if ($taskMember['member_code'] == $data['memberCode']) {
|
if ($taskMember['member_code'] == $data['memberCode']) {
|
||||||
continue;//跳过产生者
|
continue;//跳过产生者
|
||||||
}
|
}
|
||||||
$member = Member::where(['code' => $taskMember['member_code']])->find();
|
$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 (isOpenDingTalkNoticePush()) {
|
||||||
if ($member['dingtalk_userid']) {
|
if ($member['dingtalk_userid']) {
|
||||||
$params = [
|
$params = [
|
||||||
@ -257,9 +258,9 @@ class Task
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//通知所有组织内的成员
|
//通知所有组织内的成员
|
||||||
$project = \app\common\Model\Project::where(['code' => $task['project_code']])->field('organization_code')->find();
|
$project = \app\common\Model\Project::where(['code' => $task['project_code']])->field('organization_code')->find();
|
||||||
$messageService->sendToGroup($project['organization_code'], $socketGroupMessage, 'organization:task');
|
$messageService->sendToGroup($project['organization_code'], $socketGroupMessage, 'organization:task');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user