12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- namespace app\controller\admin\system\notice;
- use app\common\repositories\system\notice\SystemNoticeRepository;
- use app\validate\admin\SystemNoticeValidate;
- use ln\basic\BaseController;
- use think\App;
- /**
- * Class SystemNotice
- * @package app\controller\merchant\system\notice
- * @author zfy
- * @day 2020/11/6
- */
- class SystemNotice extends BaseController
- {
- /**
- * @var SystemNoticeRepository
- */
- protected $repository;
- /**
- * SystemNotice constructor.
- * @param App $app
- * @param SystemNoticeRepository $repository
- */
- public function __construct(App $app, SystemNoticeRepository $repository)
- {
- parent::__construct($app);
- $this->repository = $repository;
- }
- /**
- * @return \think\response\Json
- * @author zfy
- * @day 2020/11/6
- */
- public function lst()
- {
- $where = $this->request->params(['keyword', 'date']);
- [$page, $limit] = $this->getPage();
- return app('json')->success($this->repository->getList($where, $page, $limit));
- }
- /**
- * @param SystemNoticeValidate $validate
- * @return \think\response\Json
- * @author zfy
- * @day 2020/11/6
- */
- public function create(SystemNoticeValidate $validate)
- {
- $data = $this->request->params(['type', 'mer_id', 'is_trader', 'category_id', 'notice_title', 'notice_content']);
- $validate->check($data);
- $this->repository->create($data, $this->request->adminId());
- return app('json')->success('发布成功');
- }
- }
|