123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- <?php
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- namespace app\shop\controller;
-
-
- use app\shop\logic\FileLogic;
- use app\common\basics\ShopBase;
- use app\common\server\JsonServer;
-
- class File extends ShopBase
- {
-
-
- public function lists()
- {
- if ($this->request->isAjax()) {
- $get = $this->request->get();
- $get['shop_id'] = $this->shop_id;
- $lists = FileLogic::getFile($get);
- return JsonServer::success('获取成功', $lists);
- }
-
- $get = $this->request->get();
- $get['type'] = $get['type'] ?? 10;
- $get['shop_id'] = $get['shop_id'] ?? $this->shop_id;
-
- return view('', [
- 'type' => $get['type'],
- 'category' => json_encode(FileLogic::getCate($get))
- ]);
- }
-
-
-
- public function move()
- {
- if ($this->request->isAjax()) {
- $post = $this->request->post();
- $res = FileLogic::move($post);
- if ($res) {
- return JsonServer::success('移动成功', FileLogic::getCate($post["type"]));
- }
-
- $error = FileLogic::getError() ?: '移动失败';
- return JsonServer::error($error);
- }
-
- $get = $this->request->get();
- $get['type'] = $get['type'] ?? 10;
- $get['shop_id'] = $get['shop_id'] ?? $this->shop_id;
- return view('', [
- 'categoryTree' => FileLogic::categoryToSelectThree($get)
- ]);
- }
-
-
-
- public function del()
- {
- if ($this->request->isAjax()) {
- $post = $this->request->post();
- $res = FileLogic::del($post);
- $data = [
- 'shop_id' => $this->shop_id,
- 'type' => $post['type']
- ];
- if ($res) {
- return JsonServer::success('删除成功', FileLogic::getCate($data));
- }
-
- $error = FileLogic::getError() ?: '删除失败';
- return JsonServer::error($error);
- }
-
- return JsonServer::error("请求异常");
- }
-
-
-
-
-
- public function addCate()
- {
- if ($this->request->isAjax()) {
- $post = $this->request->post();
- $post['shop_id'] = $this->shop_id;
- $res = FileLogic::addCate($post);
- $data = [
- 'type' => $post['type'],
- 'shop_id' => $this->shop_id
- ];
- if ($res) {
- return JsonServer::success('新增成功', FileLogic::getCate($data));
- }
-
- $error = FileLogic::getError() ?: '新增失败';
- return JsonServer::error($error);
- }
- $get = $this->request->get();
- $get['type'] = $get['type'] ?? 10;
- $get['shop_id'] = $get['shop_id'] ?? $this->shop_id;
- return view('addCate', [
- 'categoryTree' => FileLogic::categoryToSelect($get)
- ]);
- }
-
-
-
- public function editCate()
- {
- if ($this->request->isAjax()) {
- $post = $this->request->post();
- $res = FileLogic::editCate($post);
- if ($res) {
- $data = [
- 'type' => $post["type"],
- 'shop_id' => $this->shop_id
- ];
- return JsonServer::success('编辑成功', FileLogic::getCate($data));
- }
-
- $error = FileLogic::getError() ?: '编辑失败';
- return JsonServer::error($error);
- }
-
- $get = $this->request->get();
- $get['shop_id'] = $this->shop_id;
- return view('editCate', [
- 'detail' => FileLogic::getCateById($get['id']),
- 'categoryTree' => FileLogic::categoryToSelect($get)
- ]);
- }
-
-
-
- public function delCate()
- {
- if ($this->request->isAjax()) {
- $id = $this->request->post('id');
- $type = $this->request->post('type');
- $res = FileLogic::delCate($id);
- $data = [
- 'shop_id' => $this->shop_id,
- 'type' => $type
- ];
- if ($res) {
- return JsonServer::success('删除成功', FileLogic::getCate($data));
- }
-
- $error = FileLogic::getError() ?: '删除失败';
- return JsonServer::error($error, FileLogic::getCate($data));
- }
-
- return JsonServer::error('请求异常');
- }
-
-
-
- public function videoList()
- {
- $get = [
- 'type' => 20,
- 'shop_id' => $this->shop_id
- ];
- return view('', [
- 'type' => $get['type'],
- 'category' => json_encode(FileLogic::getCate($get))
- ]);
- }
- }
|