| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace backend\modules\mall\controllers;
- use backend\controllers\MallController;
- use backend\modules\mall\services\NoticeService;
- /**
- * 消息控制器
- *
- * Class NoticeController
- * @package backend\modules\mall\controllers
- */
- class NoticeController extends MallController
- {
- /**
- * 消息列表
- *
- * @return mixed
- */
- public function actionIndex()
- {
- if ($this->request->isAjax) {
- $params = $this->request->get();
- $service = new NoticeService(['mall_id' => $this->mall_id]);
- return $this->success('ok', $service->getPageList($params));
- }
- return $this->render($this->action->id);
- }
- /**
- * 消息阅读
- *
- * @return mixed
- */
- public function actionRead()
- {
- $id = $this->request->get('id');
- $service = new NoticeService(['mall_id' => $this->mall_id]);
- $service->readNotice($id);
- return $this->success('ok');
- }
- /**
- * 未读消息
- *
- * @return mixed
- */
- public function actionUnreadCount()
- {
- $service = new NoticeService(['mall_id' => $this->mall_id]);
- $unread_count = $service->getUnReadCount();
- return $this->success('ok', compact('unread_count'));
- }
- }
|