Commit 41e597be authored by 刘可心's avatar 刘可心

标记所有消息为已读

parent 5188c795
...@@ -184,14 +184,13 @@ public class MessageService { ...@@ -184,14 +184,13 @@ public class MessageService {
Integer userId = Db.queryInt(Db.getSql("getUserId"), username); Integer userId = Db.queryInt(Db.getSql("getUserId"), username);
List<Record> getUnReadMsg = Db.find(Db.getSqlPara("message.getMessageInUnread", Kv.by("send_to_id", userId))); List<Record> getUnReadMsg = Db.find(Db.getSqlPara("message.getMessageInUnread", Kv.by("send_to_id", userId)));
if(getUnReadMsg.size() == 0) { if(getUnReadMsg.size() == 0) {
return Ret.fail("msg", "暂没有未读消息"); return Ret.fail("msg", "暂未读消息");
} }
for (Record readMsg : getUnReadMsg) { for (Record readMsg : getUnReadMsg) {
if(readMsg.getStr("path") == null || "".equals(readMsg.getStr("path"))) { //LiuKexin 20210409 标记全部为已读
Db.update(Db.getSqlPara("message.markRead", Kv.by("id", readMsg.getStr("id")))); Db.update(Db.getSqlPara("message.markRead", Kv.by("id", readMsg.getStr("id"))));
}
} }
return Ret.ok("msg", "已将通知性消息全部标记为已读"); return Ret.ok("msg", "已标记全部消息为已读");
} catch (Exception e) { } catch (Exception e) {
return Ret.fail("msg", "批量标为已读失败"); return Ret.fail("msg", "批量标为已读失败");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment