perf: 优化消息标记已读/未读

This commit is contained in:
kuaifan
2022-03-10 14:41:29 +08:00
parent 30c149be31
commit 48b7f4924e
9 changed files with 72 additions and 30 deletions

View File

@@ -96,12 +96,12 @@ class WebSocketDialogMsg extends AbstractModel
/**
* 获取占比
* @param bool $increment 是否新增阅读数
* @param bool|int $increment 是否新增阅读数
* @return int
*/
public function generatePercentage($increment = false) {
if ($increment) {
$this->increment('read');
$this->increment('read', is_bool($increment) ? 1 : $increment);
}
if ($this->read > $this->send || empty($this->send)) {
return $this->appendattrs['percentage'] = 100;