where('doctor_id', $id) ->where('status', 0) ->page($params['page'],$params['num']) ->order('createdAt desc,is_read asc') // ->field('doctor_id,status,institution_id,department_id,url,application_id', true) ->select(); $total = $this ->where('doctor_id', $id) ->where('status', 0) ->count(); return ['total'=>$total, 'list'=>$list]; } public function readMessage($id) { $res = $this ->where('doctor_id',$id) ->update(['is_read'=>1]); return $res; } public function unReadMessage($id) { $res = $this ->where('doctor_id',$id) ->where('is_read',0) ->where('status',0) ->count(); return $res; } public function getAppUnread($id) { $info = $this->where('is_read',0) ->where('doctor_id', $id) ->field("count(*) AS count,application_id") ->group('application_id') ->select(); return $info; } public function delReadMessage($id) { $info = $this ->where('doctor_id', $id) ->where('is_read', 1) ->update(['status'=>1]); return $info; } public function delAllMessage($id) { $info = $this ->where('doctor_id', $id) ->update(['status'=>1]); return $info; } public function read($id) { $res = $this ->where('id',$id) ->update(['is_read'=>1]); return $res; } public function getInfo($id) { $info = $this ->where('id',$id) ->field('title,content,application_id,is_read,exam_id,is_remote') ->find(); $this->where('id',$id) ->update(['is_read'=>1]); return $info; } public function deleteone($id) { $info = $this ->where('id',$id) ->update(['status'=>1]); return $info; } public function getSpecialMessage($institution) { $message = $this->where('institution_id',$institution)->where('type',10)->where('status',0)->value('content'); return $message; } }