|
@@ -0,0 +1,127 @@
|
|
|
+<?php
|
|
|
+namespace app\mall\controller;
|
|
|
+use library\Controller;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 类型管理
|
|
|
+ * Class WashCate
|
|
|
+ * @package app\mall\controller
|
|
|
+ */
|
|
|
+class WashType extends Controller
|
|
|
+{
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 当前操作数据库
|
|
|
+ * @var string
|
|
|
+ */
|
|
|
+ protected $table = 'WashType';
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 类型管理
|
|
|
+ * @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 = '类型管理';
|
|
|
+ $module = input('module',1);
|
|
|
+ $this->module = input('module',1);
|
|
|
+ $query = $this->_query($this->table)
|
|
|
+ ->where('is_deleted',0)
|
|
|
+ ->where('module',$module)
|
|
|
+ ->like('title')
|
|
|
+ ->page();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 列表数据处理
|
|
|
+ * @param array $data
|
|
|
+ */
|
|
|
+ protected function _index_page_filter(&$data)
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加类型
|
|
|
+ * @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->_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->_form($this->table, 'form');
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 表单数据处理
|
|
|
+ * @param array $vo
|
|
|
+ * @throws \ReflectionException
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
+ protected function _form_filter(&$data)
|
|
|
+ {
|
|
|
+ if($this->request->isGet()) {
|
|
|
+ $this->ladder_set = !empty($data['ladder_set']) ? json_decode($data['ladder_set'],true):[];
|
|
|
+ }
|
|
|
+ if($this->request->isPost() && $this->request->action() == 'edit')unset($data['module']);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 启用类型
|
|
|
+ * @auth true
|
|
|
+ * @throws \think\Exception
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
+ */
|
|
|
+ public function enable()
|
|
|
+ {
|
|
|
+ $this->_save($this->table, ['status' => '1']);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 禁用类型
|
|
|
+ * @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 remove()
|
|
|
+ {
|
|
|
+ $this->_delete($this->table);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|