SystemNoticeLog.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\controller\merchant\system\notice;
  12. use app\common\repositories\system\notice\SystemNoticeLogRepository;
  13. use crmeb\basic\BaseController;
  14. use think\App;
  15. /**
  16. * Class SystemNotice
  17. * @package app\controller\merchant\system\notice
  18. * @author xaboy
  19. * @day 2020/11/6
  20. */
  21. class SystemNoticeLog extends BaseController
  22. {
  23. /**
  24. * @var SystemNoticeLogRepository
  25. */
  26. protected $repository;
  27. /**
  28. * SystemNoticeLog constructor.
  29. * @param App $app
  30. * @param SystemNoticeLogRepository $repository
  31. */
  32. public function __construct(App $app, SystemNoticeLogRepository $repository)
  33. {
  34. parent::__construct($app);
  35. $this->repository = $repository;
  36. }
  37. /**
  38. * @return \think\response\Json
  39. * @author xaboy
  40. * @day 2020/11/6
  41. */
  42. public function lst()
  43. {
  44. [$page, $limit] = $this->getPage();
  45. $where = $this->request->params(['is_read', 'date', 'keyword']);
  46. $where['mer_id'] = $this->request->merId();
  47. return app('json')->success($this->repository->getList($where, $page, $limit));
  48. }
  49. /**
  50. * @param $id
  51. * @author xaboy
  52. * @day 2020/11/6
  53. */
  54. public function read($id)
  55. {
  56. $this->repository->read(intval($id), $this->request->merId());
  57. return app('json')->success();
  58. }
  59. public function del($id)
  60. {
  61. $this->repository->del(intval($id), $this->request->merId());
  62. return app('json')->success();
  63. }
  64. public function unreadCount()
  65. {
  66. return app('json')->success(['count' => $this->repository->unreadCount($this->request->merId())]);
  67. }
  68. }