andWhere(['mall_id' => $this->mall_id]); $pagination = new Pagination(['totalCount' => $model->count(), 'pageSize' => $limit]); $model->limit($pagination->limit)->offset($pagination->offset); $list = $model->orderBy('id desc') ->asArray() ->all(); $data['list'] = $list; $data['page_count'] = $pagination->pageCount; $data['current_page'] = $page + 1; return $data; } /** * 获取未读消息数量 * * @return int */ public function getUnReadCount() { $count = BackendUnreadCount::getUnReadCount([ 'mall_id' => $this->mall_id ]); return $count ? $count : 0; } /** * 阅读消息 * * @param integer $id * @return boolean */ public function readNotice(int $id) { return (boolean) BackendNotice::readNotice($id, $this->mall_id); } }