['title'], ]; } /** * @notes 获取系统消息列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/05/29 14:04 */ public function lists(): array { $params = $this->request->get(['start_time','end_time']); if(!empty($params['start_time']) && !empty($params['end_time'])){ $this->where[] = ['create_time','between',[strtotime($params['start_time']),strtotime($params['end_time'])]]; } return OaMessage::where($this->searchWhere)->where($this->where)->where('to_uid',$this->adminId) ->field(['id', 'title', 'content', 'read_time', 'create_time']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ $data['is_read'] = empty($data['read_time']) ? '未读' : '已读'; }) ->toArray(); } /** * @notes 获取系统消息数量 * @return int * @author likeadmin * @date 2024/05/29 14:04 */ public function count(): int { return OaMessage::where($this->searchWhere)->where($this->where)->where('to_uid',$this->adminId)->count(); } }