|
@@ -0,0 +1,113 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+// | ThinkAdmin
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+// | 官方网站: http://demo.thinkadmin.top
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+// | 开源协议 ( https://mit-license.org )
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
|
|
|
+// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+
|
|
|
+namespace app\store\controller;
|
|
|
+
|
|
|
+use library\Controller;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 轮播图管理
|
|
|
+ * Class GoodsCate
|
|
|
+ * @package app\store\controller
|
|
|
+ */
|
|
|
+class Banner extends Controller
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * 绑定数据表
|
|
|
+ * @var string
|
|
|
+ */
|
|
|
+ protected $table = 'StoreBanner';
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 轮播图管理
|
|
|
+ * @auth true
|
|
|
+ * @menu true
|
|
|
+ * @throws \think\Exception
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
+ */
|
|
|
+ public function index()
|
|
|
+ {
|
|
|
+ $this->title = '轮播图管理';
|
|
|
+ $query = $this->_query($this->table)->like('title')->equal('status');
|
|
|
+ $query->where(['is_deleted' => '0'])->order('sort desc,id desc')->page();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加轮播图
|
|
|
+ * @auth true
|
|
|
+ * @throws \think\Exception
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
+ */
|
|
|
+ public function add()
|
|
|
+ {
|
|
|
+ $this->title = '添加轮播图';
|
|
|
+ $this->_form($this->table, 'form');
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑轮播图
|
|
|
+ * @auth true
|
|
|
+ * @throws \think\Exception
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
+ */
|
|
|
+ public function edit()
|
|
|
+ {
|
|
|
+ $this->title = '编辑轮播图';
|
|
|
+ $this->_form($this->table, 'form');
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 禁用轮播图
|
|
|
+ * @auth true
|
|
|
+ * @throws \think\Exception
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
+ */
|
|
|
+ public function forbid()
|
|
|
+ {
|
|
|
+ $this->_save($this->table, ['status' => '0']);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 启用轮播图
|
|
|
+ * @auth true
|
|
|
+ * @throws \think\Exception
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
+ */
|
|
|
+ public function resume()
|
|
|
+ {
|
|
|
+ $this->_save($this->table, ['status' => '1']);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除轮播图
|
|
|
+ * @auth true
|
|
|
+ * @throws \think\Exception
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
+ */
|
|
|
+ public function remove()
|
|
|
+ {
|
|
|
+ $this->_delete($this->table);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|