作者 lishaoshuai
1 个管道 的构建 通过 耗费 0 秒

红点漏洞修复

@@ -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 }