1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- namespace app\data\controller\news;
- use app\data\model\DataNewsMark;
- use think\admin\Controller;
- /**
- * 文章标签管理
- * Class Mark
- * @package app\data\controller\news
- */
- class Mark extends Controller
- {
- /**
- * 文章标签管理
- * @auth true
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function index()
- {
- $this->title = '文章标签管理';
- $query = $this->_query(DataNewsMark::class);
- $query->like('name')->equal('status')->dateBetween('create_at');
- $query->where(['deleted' => 0])->order('sort desc,id desc')->page();
- }
- /**
- * 添加文章标签
- * @auth true
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function add()
- {
- $this->_form(DataNewsMark::class, 'form');
- }
- /**
- * 编辑文章标签
- * @auth true
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function edit()
- {
- $this->_form(DataNewsMark::class, 'form');
- }
- /**
- * 修改文章标签状态
- * @auth true
- * @throws \think\db\exception\DbException
- */
- public function state()
- {
- $this->_save(DataNewsMark::class, $this->_vali([
- 'status.in:0,1' => '状态值范围异常!',
- 'status.require' => '状态值不能为空!',
- ]));
- }
- /**
- * 删除文章标签
- * @auth true
- * @throws \think\db\exception\DbException
- */
- public function remove()
- {
- $this->_delete(DataNewsMark::class);
- }
- }
|