SystemNoticeLog.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace app\controller\merchant\system\notice;
  3. use app\common\repositories\system\notice\SystemNoticeLogRepository;
  4. use ln\basic\BaseController;
  5. use think\App;
  6. /**
  7. * Class SystemNotice
  8. * @package app\controller\merchant\system\notice
  9. * @author zfy
  10. * @day 2020/11/6
  11. */
  12. class SystemNoticeLog extends BaseController
  13. {
  14. /**
  15. * @var SystemNoticeLogRepository
  16. */
  17. protected $repository;
  18. /**
  19. * SystemNoticeLog constructor.
  20. * @param App $app
  21. * @param SystemNoticeLogRepository $repository
  22. */
  23. public function __construct(App $app, SystemNoticeLogRepository $repository)
  24. {
  25. parent::__construct($app);
  26. $this->repository = $repository;
  27. }
  28. /**
  29. * @return \think\response\Json
  30. * @author zfy
  31. * @day 2020/11/6
  32. */
  33. public function lst()
  34. {
  35. [$page, $limit] = $this->getPage();
  36. $where = $this->request->params(['is_read', 'date', 'keyword']);
  37. $where['mer_id'] = $this->request->merId();
  38. return app('json')->success($this->repository->getList($where, $page, $limit));
  39. }
  40. /**
  41. * @param $id
  42. * @author zfy
  43. * @day 2020/11/6
  44. */
  45. public function read($id)
  46. {
  47. $this->repository->read(intval($id), $this->request->merId());
  48. return app('json')->success();
  49. }
  50. public function del($id)
  51. {
  52. $this->repository->del(intval($id), $this->request->merId());
  53. return app('json')->success();
  54. }
  55. public function unreadCount()
  56. {
  57. return app('json')->success(['count' => $this->repository->unreadCount($this->request->merId())]);
  58. }
  59. }