zx/app/controller/admin/system/notice/SystemNotice.php

70 lines
2.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
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 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('发布成功');
}
}