65 lines
1.5 KiB
PHP
65 lines
1.5 KiB
PHP
<?php
|
|
|
|
|
|
|
|
|
|
namespace app\controller\admin\system\notice;
|
|
|
|
|
|
use app\common\repositories\system\notice\SystemNoticeRepository;
|
|
use app\validate\admin\SystemNoticeValidate;
|
|
use crmeb\basic\BaseController;
|
|
use think\App;
|
|
|
|
/**
|
|
* Class SystemNotice
|
|
* @package app\controller\merchant\system\notice
|
|
* @author xaboy
|
|
* @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 xaboy
|
|
* @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 xaboy
|
|
* @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('发布成功');
|
|
}
|
|
|
|
}
|