/** * 根据uid删除通知 * * @param int $uid * @param bool */ public function deleteNoticeByUid($uid) { $this->_getNoticesDs()->deleteNoticeByUid($uid); Wind::import('SRV:user.dm.PwUserInfoDm'); $user = Wekit::load('user.PwUser'); $dm = new PwUserInfoDm($uid); $dm->setNoticeCount(0); $user->editUser($dm, PwUser::FETCH_DATA); }
/** * * 设置已读 * @param int $unreadCount * @param array $noticeList */ private function _readNoticeList($unreadCount, $noticeList) { if ($unreadCount && $noticeList) { //更新用户的通知未读数 $readnum = 0; //本次阅读数 Wind::import('SRV:message.dm.PwMessageNoticesDm'); $dm = new PwMessageNoticesDm(); $dm->setRead(1); $ids = array(); foreach ($noticeList as $v) { if ($v['is_read']) { continue; } $readnum++; $ids[] = $v['id']; } $ids && $this->_getNoticeDs()->batchUpdateNotice($ids, $dm); $newUnreadCount = $unreadCount - $readnum; if ($newUnreadCount != $unreadCount) { Wind::import('SRV:user.dm.PwUserInfoDm'); $dm = new PwUserInfoDm($this->loginUser->uid); $dm->setNoticeCount($newUnreadCount); $this->_getUserDs()->editUser($dm, PwUser::FETCH_DATA); } } }