Merge branch 'sprint/168_xuan_notifications' of https://gitlab.zcorp.cc/easycorp/zentaopms into sprint/168_xuan_notifications

This commit is contained in:
chaideqing
2021-12-01 15:00:12 +08:00
2 changed files with 15 additions and 6 deletions
@@ -207,10 +207,10 @@ class xuanxuanIm extends imModel
$messageGroups = array();
foreach($userMessages as $message)
{
/* group by $message->content->content->objectType, ...content->action, ...content->actor */
/* group by $message->content->content->objectType, ...content->action, ...content->actor, ...content->parent */
$contentData = json_decode($message->content);
$contentData = json_decode($contentData->content);
$messageGroups["$contentData->objectType-$contentData->action-$contentData->actor"][] = $message;
$messageGroups["$contentData->objectType-$contentData->action-$contentData->actor-$contentData->parent"][] = $message;
}
foreach($messageGroups as $groupKey => $messages)
{
@@ -218,9 +218,15 @@ class xuanxuanIm extends imModel
$notification = current($messages);
array_shift($messages);
$notification->content = array($notification->content);
foreach($messages as $message) $notification->content[] = $message->content;
$messageGroups[$groupKey] = array($message);
$notificationContent = json_decode($notification->content);
$notificationContent->content = array($notificationContent->content);
foreach($messages as $message)
{
$messageContent = json_decode($message->content);
$notificationContent->content[] = $messageContent->content;
}
$notification->content = json_encode($notificationContent);
$messageGroups[$groupKey] = array($notification);
}
$mergedMessages = array();
@@ -66,22 +66,25 @@ class xuanxuanMessage extends messageModel
{
$subcontent->headTitle = $object->projectName;
$subcontent->headSubTitle = $object->execuName;
$subcontent->parent = $object->execution;
}
elseif($objectType == 'story')
{
$subcontent->headTitle = $object->productName;
$subcontent->parent = $object->product;
}
elseif($objectType == 'bug')
{
$subcontent->headTitle = empty($object->productName) ? $object->projectName : $object->productName;
$subcontent->headSubTitle = $object->execuName;
$subcontent->parent = empty($object->product) ? $object->project : $object->product;
}
$contentData = new stdclass();
$contentData->title = $title;
$contentData->subtitle = '';
$contentData->contentType = "zentao-$objectType-$actionType";
$contentData->content = json_encode(array($subcontent));
$contentData->content = json_encode($subcontent);
$contentData->actions = array();
$contentData->url = $url;
$content = json_encode($contentData);