正在显示
1 个修改的文件
包含
6 行增加
和
1 行删除
@@ -127,14 +127,19 @@ class LeaveController extends RestBaseController | @@ -127,14 +127,19 @@ class LeaveController extends RestBaseController | ||
127 | */ | 127 | */ |
128 | public function getUnread() { | 128 | public function getUnread() { |
129 | $condition['parent_id'] = 0; | 129 | $condition['parent_id'] = 0; |
130 | - $condition['is_read'] = 0; | ||
131 | $condition['to_uid|from_uid'] = $this->userId; | 130 | $condition['to_uid|from_uid'] = $this->userId; |
131 | + $check = Db::name('leave')->where($condition)->field('is_read')->find(); | ||
132 | + if($check) { | ||
133 | + $condition['is_read'] = 0; | ||
132 | $result = Db::name('leave')->where($condition)->field('is_read')->find(); | 134 | $result = Db::name('leave')->where($condition)->field('is_read')->find(); |
133 | if($result) { | 135 | if($result) { |
134 | $is_unread = 1; | 136 | $is_unread = 1; |
135 | } else { | 137 | } else { |
136 | $is_unread = 0; | 138 | $is_unread = 0; |
137 | } | 139 | } |
140 | + } else { | ||
141 | + $is_unread = 0; | ||
142 | + } | ||
138 | $this->success('获取成功',['is_unread'=>$is_unread]); | 143 | $this->success('获取成功',['is_unread'=>$is_unread]); |
139 | } | 144 | } |
140 | } | 145 | } |
-
请 注册 或 登录 后发表评论