Browse Source

朋友圈消息提醒列表优化

master
wanghongjun 7 months ago
parent
commit
803927703f
  1. 33
      app/enterprise/controller/Posts.php
  2. 3
      app/lang/en_us.php
  3. 3
      app/lang/zh_cn.php

33
app/enterprise/controller/Posts.php

@ -446,7 +446,6 @@ class Posts extends BaseController
if ($reply_user_id != $this->uid) { if ($reply_user_id != $this->uid) {
PostsNotice::optionNotice($posts_id, $id, $reply_user_id); PostsNotice::optionNotice($posts_id, $id, $reply_user_id);
// 向作者好友推送新的消息 // 向作者好友推送新的消息
$this->wsSendMsg($this->uid, $id, 'postsLikes');
$this->wsSendMsg($reply_user_id, 0, 'postsNotice'); $this->wsSendMsg($reply_user_id, 0, 'postsNotice');
} }
@ -525,7 +524,6 @@ class Posts extends BaseController
} }
if ($reply_user_id != $this->uid) { if ($reply_user_id != $this->uid) {
PostsNotice::optionNotice($posts_id, $id, $reply_user_id, 2); PostsNotice::optionNotice($posts_id, $id, $reply_user_id, 2);
$this->wsSendMsg($this->uid, $id);
$this->wsSendMsg($reply_user_id, 0, 'postsNotice'); $this->wsSendMsg($reply_user_id, 0, 'postsNotice');
} }
return success(lang('system.success')); return success(lang('system.success'));
@ -570,7 +568,7 @@ class Posts extends BaseController
['user_id', '=', $this->uid] ['user_id', '=', $this->uid]
]; ];
$field = '*'; $field = '*';
$order = 'create_time desc'; $order = 'is_read asc';
$list = $this->paginate($model->where($where)->field($field)->order($order)); $list = $this->paginate($model->where($where)->field($field)->order($order));
$data = []; $data = [];
@ -598,10 +596,37 @@ class Posts extends BaseController
if (!$item['is_read']) { if (!$item['is_read']) {
PostsNotice::read($item['id']); PostsNotice::read($item['id']);
} }
if ($item['type'] == 2) {
$commentWhere = [
'id' => $item['relevance_id'],
'delete_time' => 0,
'type' => 1
];
$comment = Comment::where($commentWhere)->field('content,reply_user_id,user_id')->find();
$item['content'] = $comment['content'] ?? lang('posts.comment_del');
$item['reply_user'] = [];
$item['option_user'] = [];
if ($comment['reply_user_id']) {
$item['reply_user'] = $this->getFriendUserInfo($comment['reply_user_id']);
}
if ($comment['user_id']) {
$item['option_user'] = $this->getFriendUserInfo($comment['user_id']);
}
}
if ($item['type'] == 1) {
$likesWhere = [
'id' => $item['relevance_id'],
'type' => 1
];
$Likes = Likes::where($likesWhere)->field('user_id')->find();
if ($Likes['user_id']) {
$item['option_user'] = $this->getFriendUserInfo($Likes['user_id']);
}
}
// 用户信息 // 用户信息
$item['user'] = $this->getFriendUserInfo($item['user_id']); $item['user'] = $this->getFriendUserInfo($item['user_id']);
// 评论回复 // 评论回复
unset($item['is_read']); //unset($item['is_read']);
} }
} }
return success('', $data,$list->total(),$list->currentPage()); return success('', $data,$list->total(),$list->currentPage());

3
app/lang/en_us.php

@ -165,6 +165,7 @@ return [
'user_empty' => 'Restricting users to not be empty', 'user_empty' => 'Restricting users to not be empty',
'success_like' => 'Liked successfully', 'success_like' => 'Liked successfully',
'cancel_like' => 'Cancel likes', 'cancel_like' => 'Cancel likes',
'img_max_length' => 'Up to 9 images can be uploaded' 'img_max_length' => 'Up to 9 images can be uploaded',
'comment_del' => 'This comment has been deleted'
] ]
]; ];

3
app/lang/zh_cn.php

@ -164,6 +164,7 @@ return [
'user_empty' => '限制用户不能为空', 'user_empty' => '限制用户不能为空',
'success_like' => '点赞成功', 'success_like' => '点赞成功',
'cancel_like' => '取消点赞', 'cancel_like' => '取消点赞',
'img_max_length' => '图片最多上传9张' 'img_max_length' => '图片最多上传9张',
'comment_del' => '此条评论已被删除'
] ]
]; ];
Loading…
Cancel
Save