12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Administrator
- * Date: 2020-08-28
- * Time: 8:53
- */
-
- namespace app\back\controller;
-
-
- use app\back\model\IndustryModel;
- use cmf\controller\AdminBaseController;
- class IndustryController extends AdminBaseController
- {
- public function index()
- {
-
- $where = [];
- $list = IndustryModel::where($where)->order('list_order','asc')->select();
- $this->assign('list',$list);
-
- return $this->fetch();
- }
- public function add()
- {
- return $this->fetch();
- }
- public function addPost()
- {
- $data = $this->request->param();
- $industryModel = new IndustryModel();
- $industryModel->allowField(true)->isUpdate(false)->save($data);
- $this->success('添加成功');
-
- }
- public function edit()
- {
- $id = $this->request->param('id');
- $info = IndustryModel::get($id);
- $this->assign('info',$info);
- return $this->fetch();
- }
- public function editPost()
- {
- $data = $this->request->param();
- $industryModel = new IndustryModel();
- $industryModel->allowField(true)->isUpdate(true)->save($data);
- $this->success('编辑成功');
- }
- public function delete()
- {
- $id = $this->request->param('id');
- IndustryModel::destroy($id);
- $this->success('删除成功');
- }
-
- public function show()
- {
- $ids = $this->request->param('ids/a');
- $is_show = $this->request->param('is_show');
- IndustryModel::where('id','in',$ids)->update(['is_show'=>$is_show]);
- $this->success('操作成功');
- }
-
- public function listOrder()
- {
- $industryModel = new IndustryModel();
- parent::listOrders($industryModel);
- $this->success("排序更新成功!");
- }
- }
|