no message

This commit is contained in:
kuaifan 2022-05-17 19:55:47 +08:00
parent 3f17c0689c
commit 6347454098
2 changed files with 20 additions and 9 deletions

View File

@ -185,15 +185,18 @@ class WebSocketDialog extends AbstractModel
*/
public function getGroupName()
{
$name = $this->name;
if ($this->type == "group") {
if ($this->group_type === 'project') {
$name = \DB::table('projects')->where('dialog_id', $this->id)->value('name');
} elseif ($this->group_type === 'task') {
$name = \DB::table('project_tasks')->where('dialog_id', $this->id)->value('name');
if (!isset($this->appendattrs['groupName'])) {
$name = $this->name;
if ($this->type == "group") {
if ($this->group_type === 'project') {
$name = \DB::table('projects')->where('dialog_id', $this->id)->value('name');
} elseif ($this->group_type === 'task') {
$name = \DB::table('project_tasks')->where('dialog_id', $this->id)->value('name');
}
}
$this->appendattrs['groupName'] = $name;
}
return $name;
return $this->appendattrs['groupName'];
}
/**

View File

@ -195,8 +195,8 @@ class EmailNoticeTask extends AbstractTask
continue;
}
$setting = Base::setting('emailSetting');
$msgType = $dialogType === "group" ? "群聊" : "个人";
$subject = env('APP_NAME') . " 未读{$msgType}消息提醒";
$msgType = $dialogType === "group" ? "群聊" : "成员";
$subject = null;
$content = view('email.unread', [
'type' => 'head',
'nickname' => $user->nickname,
@ -227,6 +227,14 @@ class EmailNoticeTask extends AbstractTask
}
}
}
if ($subject === null) {
$count = count($lists);
if ($count > 1) {
$subject = "来自{$count}{$msgType}未读消息提醒";
} else {
$subject = "来自{$dialogName}未读消息提醒";
}
}
$content .= view('email.unread', [
'type' => 'content',
'dialogUrl' => config("app.url") . "/manage/messenger/{$dialogId}",