From 237d606f250e03e296cfeef8386ded4d225376a5 Mon Sep 17 00:00:00 2001 From: nizongfeng Date: Tue, 30 Nov 2021 16:09:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9A=94=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/CfChannelInfo.php | 66 +++- application/admin/controller/CfHotelInfo.php | 13 +- application/admin/controller/CfItem.php | 31 +- application/admin/controller/CfRoomInfo.php | 20 +- application/admin/controller/CfRoomPlan.php | 31 +- application/admin/controller/CfSuplierInfo.php | 94 +++++- application/admin/controller/Deposit.php | 2 +- application/admin/controller/OrderHotel.php | 52 ++- application/admin/controller/OrderItem.php | 50 ++- application/admin/controller/OrderMain.php | 372 +--------------------- application/admin/controller/PaymentOrder.php | 10 +- application/admin/controller/ReceiptOrder.php | 156 +-------- application/admin/controller/auth/Admin.php | 1 + application/admin/controller/general/Config.php | 3 +- application/admin/dao/CfHotelInfoDao.php | 3 + application/admin/dao/CfItemDao.php | 2 +- application/admin/dao/GroupDao.php | 42 +++ application/admin/dao/OrderHotelDao.php | 3 +- application/admin/dao/OrderItemDao.php | 2 + application/admin/dao/PaymentOrderDao.php | 4 +- application/admin/dao/ReceiptOrderDao.php | 4 +- application/admin/model/CfHotelInfo.php | 9 +- application/admin/service/OrderMainService.php | 3 +- application/admin/service/PaymentOrderService.php | 4 +- application/admin/service/ReceiptOrderService.php | 2 +- 25 files changed, 394 insertions(+), 585 deletions(-) create mode 100644 application/admin/dao/GroupDao.php diff --git a/application/admin/controller/CfChannelInfo.php b/application/admin/controller/CfChannelInfo.php index 07eab41..172cad9 100755 --- a/application/admin/controller/CfChannelInfo.php +++ b/application/admin/controller/CfChannelInfo.php @@ -2,7 +2,12 @@ namespace app\admin\controller; +use app\admin\dao\GroupDao; use app\common\controller\Backend; +use think\Db; +use think\Exception; +use think\exception\PDOException; +use think\exception\ValidateException; /** * 渠道配置 @@ -11,7 +16,7 @@ use app\common\controller\Backend; */ class CfChannelInfo extends Backend { - + protected $noNeedRight = ['getList']; /** * CfChannelInfo模型对象 * @var \app\admin\model\CfChannelInfo @@ -35,7 +40,53 @@ class CfChannelInfo extends Backend * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 */ + /** + * 添加 + */ + public function add() + { + if ($this->request->isPost()) { + $params = $this->request->post("row/a"); + if ($params) { + $params = $this->preExcludeFields($params); + if ($this->dataLimit && $this->dataLimitFieldAutoFill) { + $params[$this->dataLimitField] = $this->auth->id; + } + $result = false; + Db::startTrans(); + try { + //是否采用模型验证 + if ($this->modelValidate) { + $name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); + $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate; + $this->model->validateFailException(true)->validate($validate); + } + $params['create_id']=$this->auth->id; + $groupDao = new GroupDao(); + $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupId()); + $result = $this->model->allowField(true)->save($params); + Db::commit(); + } catch (ValidateException $e) { + Db::rollback(); + $this->error($e->getMessage()); + } catch (PDOException $e) { + Db::rollback(); + $this->error($e->getMessage()); + } catch (Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); + } + if ($result !== false) { + $this->success(); + } else { + $this->error(__('No rows were inserted')); + } + } + $this->error(__('Parameter %s can not be empty', '')); + } + return $this->view->fetch(); + } /** * 查看 @@ -49,10 +100,12 @@ class CfChannelInfo extends Backend if ($this->request->request('keyField')) { return $this->selectpage(); } + $groupDao = new GroupDao(); + $group_id = $groupDao->getTopGroup($this->auth->getGroupId()); list($where, $sort, $order, $offset, $limit) = $this->buildparams(); - $list = $this->model ->where($where) + ->where("group_id",'=',$group_id) ->order($sort, $order) ->paginate($limit); @@ -68,12 +121,15 @@ class CfChannelInfo extends Backend $name=$this->request->post('name'); $keyValue=$this->request->post('keyValue'); $this->model->field('id,channel_name as name,commission_rate'); + $groupDao = new GroupDao(); + $group_id = $groupDao->getTopGroup($this->auth->getGroupId()); + $where = ["group_id"=>$group_id]; if($keyValue){ - $this->model->where(['id'=>$keyValue]); + $where = ['id'=>$keyValue,"group_id"=>$group_id]; }elseif($name){ - $this->model->where(['channel_name'=>['like','%'.$name.'%']]); + $where = ['channel_name'=>['like','%'.$name.'%',"group_id"=>$group_id]]; } - $result= $this->model->select(); + $result= $this->model->where($where)->select(); if($keyValue){ return json(['list' => $result]); } diff --git a/application/admin/controller/CfHotelInfo.php b/application/admin/controller/CfHotelInfo.php index db78784..7a30915 100755 --- a/application/admin/controller/CfHotelInfo.php +++ b/application/admin/controller/CfHotelInfo.php @@ -2,6 +2,7 @@ namespace app\admin\controller; +use app\admin\dao\GroupDao; use app\admin\model\Area; use app\admin\service\CfHotelInfoService; use app\common\controller\Backend; @@ -17,6 +18,7 @@ use think\exception\ValidateException; class CfHotelInfo extends Backend { + protected $noNeedRight = ['getHotelList',"getList","save","delAll"]; /** * CfHotelInfo模型对象 * @var \app\admin\model\CfHotelInfo @@ -44,7 +46,10 @@ class CfHotelInfo extends Backend public function getHotelList(){ $name=$this->request->post('name'); $keyValue=$this->request->post('keyValue'); - $result= $this->model->getList($name,$keyValue); + $params['create_id']=$this->auth->id; + $groupDao = new GroupDao(); + $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupId()); + $result= $this->model->getList($name,$keyValue,$params); if($keyValue){ return json(['list' => $result]); } @@ -58,6 +63,9 @@ class CfHotelInfo extends Backend */ public function getList(){ $params=$this->request->post(); + $params['create_id']=$this->auth->id; + $groupDao = new GroupDao(); + $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupId()); $service = new CfHotelInfoService(); return json($service->getList($params)); } @@ -69,7 +77,8 @@ class CfHotelInfo extends Backend public function save(){ $params=$this->request->post(); $params['create_id']=$this->auth->id; - $params['group_id']=$this->auth->getGroupId(); + $groupDao = new GroupDao(); + $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupId()); $service = new CfHotelInfoService(); return json($service->save($params)); } diff --git a/application/admin/controller/CfItem.php b/application/admin/controller/CfItem.php index 89594e5..3ae1ba6 100755 --- a/application/admin/controller/CfItem.php +++ b/application/admin/controller/CfItem.php @@ -2,6 +2,7 @@ namespace app\admin\controller; +use app\admin\dao\GroupDao; use app\admin\model\Area; use app\admin\service\CfItemService; use app\common\controller\Backend; @@ -16,7 +17,7 @@ use think\exception\ValidateException; */ class CfItem extends Backend { - + protected $noNeedRight = ['list',"save","delAll","getList"]; /** * CfItem模型对象 * @var \app\admin\model\CfItem @@ -60,16 +61,10 @@ class CfItem extends Backend ->join('hbp_admin d','a.purchase_user_id = d.id','left') ->field("a.*,d.nickname") ->where($where); - if ($group_id){ - $list = $list - ->where("group_id","=",$group_id) - ->order($sort, $order) - ->paginate($limit); - }else{ - $list = $list - ->order($sort, $order) - ->paginate($limit); - } + $list = $list + ->where("group_id","=",$group_id) + ->order($sort, $order) + ->paginate($limit); $config = \think\Config::get("site.item_category"); $config = json_decode($config,true); @@ -214,11 +209,13 @@ class CfItem extends Backend $name=$this->request->post('name'); $keyValue=$this->request->post('keyValue'); $this->model->field('id,item_name as name,item_unit,item_type,item_memo,purchase_user_id'); - $where = ["del_flag"=>0]; + $groupDao = new GroupDao(); + $group_id = $groupDao->getTopGroup($this->auth->getGroupId()); + $where = ["del_flag"=>0,"group_id"=>$group_id]; if($keyValue){ - $where = ['id'=>$keyValue,"del_flag"=>0]; + $where = ['id'=>$keyValue,"del_flag"=>0,"group_id"=>$group_id]; }elseif($name){ - $where = ['item_name'=>['like','%'.$name.'%'],"del_flag"=>0]; + $where = ['item_name'=>['like','%'.$name.'%'],"del_flag"=>0,"group_id"=>$group_id]; } $result= $this->model->where($where)->select()->toArray(); @@ -245,6 +242,9 @@ class CfItem extends Backend */ public function list(){ $params=$this->request->post(); + $params['create_id']=$this->auth->id; + $groupDao = new GroupDao(); + $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupId()); $service = new CfItemService(); return json($service->getList($params)); } @@ -256,7 +256,8 @@ class CfItem extends Backend public function save(){ $params=$this->request->post(); $params['create_id']=$this->auth->id; - $params['group_id']=$this->auth->getGroupId(); + $groupDao = new GroupDao(); + $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupId()); $service = new CfItemService(); return json($service->save($params)); } diff --git a/application/admin/controller/CfRoomInfo.php b/application/admin/controller/CfRoomInfo.php index 64340a3..800e3e1 100755 --- a/application/admin/controller/CfRoomInfo.php +++ b/application/admin/controller/CfRoomInfo.php @@ -2,6 +2,7 @@ namespace app\admin\controller; +use app\admin\dao\GroupDao; use app\admin\model\Area; use app\common\controller\Backend; use think\Db; @@ -15,6 +16,7 @@ use think\exception\ValidateException; */ class CfRoomInfo extends Backend { + protected $noNeedRight = ['getRoomList',"getList"]; /** * CfRoomInfo模型对象 @@ -53,21 +55,18 @@ class CfRoomInfo extends Backend } list($where, $sort, $order, $offset, $limit) = $this->buildparams(); $group_id=$this->auth->getGroupId(); + $groupDao = new GroupDao(); + $group_id = $groupDao->getTopGroup($group_id); $list = $this->model ->alias('a') ->join('hbp_cf_hotel_info b','a.hotel_id = b.id','left') ->join('hbp_admin c','a.create_id = c.id','left') ->field("a.id,a.hotel_id,a.room_name,a.room_memo,b.hotel_name,a.create_time,a.update_time,c.nickname") ->where($where); - if ($group_id){ - $list = $list - ->where("group_id","=",$group_id) - ->order($sort, $order) - ->paginate($limit); - }else{ - $list= $list->order($sort, $order) - ->paginate($limit); - } + $list = $list + ->where("a.group_id","=",$group_id) + ->order($sort, $order) + ->paginate($limit); $result = array("total" => $list->total(), "rows" => $list->items()); return json($result); @@ -100,7 +99,8 @@ class CfRoomInfo extends Backend $this->model->validateFailException(true)->validate($validate); } $params['create_id']=$this->auth->id; - $params['group_id']=$this->auth->getGroupId(); + $groupDao = new GroupDao(); + $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupId()); $result = $this->model->allowField(true)->save($params); Db::commit(); } catch (ValidateException $e) { diff --git a/application/admin/controller/CfRoomPlan.php b/application/admin/controller/CfRoomPlan.php index 0b38a57..1ff12e1 100755 --- a/application/admin/controller/CfRoomPlan.php +++ b/application/admin/controller/CfRoomPlan.php @@ -2,6 +2,7 @@ namespace app\admin\controller; +use app\admin\dao\GroupDao; use app\admin\model\Area; use app\common\controller\Backend; use think\Db; @@ -15,7 +16,7 @@ use think\exception\ValidateException; */ class CfRoomPlan extends Backend { - + protected $noNeedRight = ['getList']; /** * CfRoomPlan模型对象 * @var \app\admin\model\CfRoomPlan @@ -49,14 +50,16 @@ class CfRoomPlan extends Backend public function getList(){ + $groupDao = new GroupDao(); + $group_id = $groupDao->getTopGroup($this->auth->getGroupId()); $name=$this->request->post('name'); $keyValue=$this->request->post('keyValue'); $this->model->field('id,plan_name as name,purchase_user_id,plan_memo'); - $where = ["del_flag"=>0]; + $where = ["del_flag"=>0,"group_id"=>$group_id]; if($keyValue){ - $where = ['id'=>$keyValue,"del_flag"=>0]; + $where = ['id'=>$keyValue,"del_flag"=>0,"group_id"=>$group_id]; }elseif($name){ - $where = ['plan_name'=>['like','%'.$name.'%'],"del_flag"=>0]; + $where = ['plan_name'=>['like','%'.$name.'%'],"del_flag"=>0,"group_id"=>$group_id]; } $roomId =$this->request->get('room_id'); if ($roomId){ @@ -82,7 +85,8 @@ class CfRoomPlan extends Backend return $this->selectpage(); } list($where, $sort, $order, $offset, $limit) = $this->buildparams(); - $group_id=$this->auth->getGroupId(); + $groupDao = new GroupDao(); + $group_id = $groupDao->getTopGroup($this->auth->getGroupId()); $list = $this->model ->alias("a") ->join('hbp_admin','a.purchase_user_id = hbp_admin.id','left') @@ -90,16 +94,10 @@ class CfRoomPlan extends Backend ->join('hbp_cf_hotel_info f','a.hotel_id = f.id','left') ->field("a.*,hbp_admin.nickname,e.room_name,f.hotel_name") ->where($where); - if ($group_id){ - $list = $list - ->where("group_id","=",$group_id) - ->order($sort, $order) - ->paginate($limit); - }else{ - $list = $list - ->order($sort, $order) - ->paginate($limit); - } + $list = $list + ->where("a.group_id","=",$group_id) + ->order($sort, $order) + ->paginate($limit); $result = $list->items(); foreach ($result as $k=>$item){ $result[$k]["continuity_type"]=$this->continuity_type[$item["continuity_type"]]; @@ -134,8 +132,9 @@ class CfRoomPlan extends Backend $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate; $this->model->validateFailException(true)->validate($validate); } + $groupDao = new GroupDao(); $params['create_id']=$this->auth->id; - $params['group_id']=$this->auth->getGroupId(); + $params['group_id']=$groupDao->getTopGroup($this->auth->getGroupId()); $result = $this->model->allowField(true)->save($params); Db::commit(); } catch (ValidateException $e) { diff --git a/application/admin/controller/CfSuplierInfo.php b/application/admin/controller/CfSuplierInfo.php index 376b8b7..629f4f9 100755 --- a/application/admin/controller/CfSuplierInfo.php +++ b/application/admin/controller/CfSuplierInfo.php @@ -2,7 +2,12 @@ namespace app\admin\controller; +use app\admin\dao\GroupDao; use app\common\controller\Backend; +use think\Db; +use think\Exception; +use think\exception\PDOException; +use think\exception\ValidateException; /** * 供应商配置 @@ -11,7 +16,7 @@ use app\common\controller\Backend; */ class CfSuplierInfo extends Backend { - + protected $noNeedRight = ['getList']; /** * CfSuplierInfo模型对象 * @var \app\admin\model\CfSuplierInfo @@ -36,14 +41,97 @@ class CfSuplierInfo extends Backend * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 */ + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + /** + * 添加 + */ + public function add() + { + if ($this->request->isPost()) { + $params = $this->request->post("row/a"); + if ($params) { + $params = $this->preExcludeFields($params); + + if ($this->dataLimit && $this->dataLimitFieldAutoFill) { + $params[$this->dataLimitField] = $this->auth->id; + } + $result = false; + Db::startTrans(); + try { + //是否采用模型验证 + if ($this->modelValidate) { + $name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); + $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate; + $this->model->validateFailException(true)->validate($validate); + } + $params['create_id']=$this->auth->id; + $groupDao = new GroupDao(); + $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupId()); + $result = $this->model->allowField(true)->save($params); + Db::commit(); + } catch (ValidateException $e) { + Db::rollback(); + $this->error($e->getMessage()); + } catch (PDOException $e) { + Db::rollback(); + $this->error($e->getMessage()); + } catch (Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); + } + if ($result !== false) { + $this->success(); + } else { + $this->error(__('No rows were inserted')); + } + } + $this->error(__('Parameter %s can not be empty', '')); + } + return $this->view->fetch(); + } + + /** + * 查看 + */ + public function index() + { + //设置过滤方法 + $this->request->filter(['strip_tags', 'trim']); + if ($this->request->isAjax()) { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + $groupDao = new GroupDao(); + $group_id = $groupDao->getTopGroup($this->auth->getGroupId()); + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + $list = $this->model + ->where($where) + ->where("group_id",'=',$group_id) + ->order($sort, $order) + ->paginate($limit); + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } + public function getList(){ $name=$this->request->post('name'); $keyValue=$this->request->post('keyValue'); $this->model->field('id,supplier_name as name'); + $groupDao = new GroupDao(); + $group_id = $groupDao->getTopGroup($this->auth->getGroupId()); if($keyValue){ - $this->model->where(['id'=>$keyValue]); + $this->model->where(['id'=>$keyValue,"group_id"=>$group_id]); }elseif($name){ - $this->model->where(['supplier_name'=>['like','%'.$name.'%']]); + $this->model->where(['supplier_name'=>['like','%'.$name.'%'],"group_id"=>$group_id]); } $result= $this->model->select(); if($keyValue){ diff --git a/application/admin/controller/Deposit.php b/application/admin/controller/Deposit.php index 3372aed..497a41b 100644 --- a/application/admin/controller/Deposit.php +++ b/application/admin/controller/Deposit.php @@ -58,7 +58,7 @@ class Deposit extends Backend ->where($where); if ($group_id){ $list = $list - ->where("group_id","=",$group_id) + ->where("a.group_id","=",$group_id) ->order($sort, $order) ->paginate($limit); }else{ diff --git a/application/admin/controller/OrderHotel.php b/application/admin/controller/OrderHotel.php index c592be3..6453780 100755 --- a/application/admin/controller/OrderHotel.php +++ b/application/admin/controller/OrderHotel.php @@ -2,7 +2,12 @@ namespace app\admin\controller; +use app\admin\dao\GroupDao; use app\common\controller\Backend; +use think\Db; +use think\Exception; +use think\exception\PDOException; +use think\exception\ValidateException; /** * 订单-酒店订单子管理 @@ -11,7 +16,7 @@ use app\common\controller\Backend; */ class OrderHotel extends Backend { - + /** * OrderHotel模型对象 * @var \app\admin\model\OrderHotel @@ -35,6 +40,49 @@ class OrderHotel extends Backend * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 */ - + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + /** + * 添加 + */ + public function add() + { + if ($this->request->isPost()) { + $this->error(__('不可新增', '')); + } + return $this->view->fetch(); + } + + /** + * 查看 + */ + public function index() + { + //设置过滤方法 + $this->request->filter(['strip_tags', 'trim']); + if ($this->request->isAjax()) { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + $groupDao = new GroupDao(); + $group_id = $groupDao->getTopGroup($this->auth->getGroupId()); + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + $list = $this->model + ->where($where) + ->where("group_id",'=',$group_id) + ->order($sort, $order) + ->paginate($limit); + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } } diff --git a/application/admin/controller/OrderItem.php b/application/admin/controller/OrderItem.php index 667b18c..6f8bc83 100755 --- a/application/admin/controller/OrderItem.php +++ b/application/admin/controller/OrderItem.php @@ -2,7 +2,12 @@ namespace app\admin\controller; +use app\admin\dao\GroupDao; use app\common\controller\Backend; +use think\Db; +use think\Exception; +use think\exception\PDOException; +use think\exception\ValidateException; /** * 订单-附加项目子订单 @@ -35,6 +40,49 @@ class OrderItem extends Backend * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 */ - + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + /** + * 添加 + */ + public function add() + { + if ($this->request->isPost()) { + $this->error(__('不可新增', '')); + } + return $this->view->fetch(); + } + + /** + * 查看 + */ + public function index() + { + //设置过滤方法 + $this->request->filter(['strip_tags', 'trim']); + if ($this->request->isAjax()) { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + $groupDao = new GroupDao(); + $group_id = $groupDao->getTopGroup($this->auth->getGroupId()); + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + $list = $this->model + ->where($where) + ->where("group_id",'=',$group_id) + ->order($sort, $order) + ->paginate($limit); + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } } diff --git a/application/admin/controller/OrderMain.php b/application/admin/controller/OrderMain.php index b7ad38f..2788457 100755 --- a/application/admin/controller/OrderMain.php +++ b/application/admin/controller/OrderMain.php @@ -2,6 +2,7 @@ namespace app\admin\controller; +use app\admin\dao\GroupDao; use app\admin\model\Area; use app\admin\service\OrderMainService; use app\common\controller\Backend; @@ -17,6 +18,7 @@ use think\Loader; */ class OrderMain extends Backend { + protected $noNeedRight = ['getOrderList',"save","delSubOrder","subOrderSave","getShowInfo","newAdd","insertOrderMain"]; /** * OrderMain模型对象 * @var \app\admin\model\OrderMain @@ -43,375 +45,14 @@ class OrderMain extends Backend /** - * 查看 - */ - public function index() - { - //设置过滤方法 - $this->request->filter(['strip_tags', 'trim']); - if ($this->request->isAjax()) { - //如果发送的来源是Selectpage,则转发到Selectpage - if ($this->request->request('keyField')) { - return $this->selectpage(); - } - list($where, $sort, $order, $offset, $limit) = $this->buildparams(); - $group_id=$this->auth->getGroupId(); - $list = $this->model - ->alias("order_main") - ->join('hbp_cf_channel_info b','order_main.channel_id = b.id','left') - ->join('hbp_admin','order_main.create_id = hbp_admin.id','left') - ->field("order_main.*,b.channel_name,hbp_admin.nickname") - ->where($where); - if ($group_id){ - $list = $list - ->where("group_id","=",$group_id) - ->order($sort, $order) - ->paginate($limit); - }else{ - $list = $list - ->order($sort, $order) - ->paginate($limit); - } - $result = $list->items(); - foreach ($result as $k=>$item){ - switch ($item["order_status"]){ - case 0: - $result[$k]["order_status"]="待处理"; - break; - case 1: - $result[$k]["order_status"]="已确认"; - break; - case 2: - $result[$k]["order_status"]="部分取消"; - break; - case 10: - $result[$k]["order_status"]="已完成"; - break; - case 11: - $result[$k]["order_status"]="已取消"; - break; - } - $result[$k]["hbp_admin.nickname"] = $item["nickname"]; - } - - $result = array("total" => $list->total(), "rows" =>$result); - return json($result); - } - return $this->view->fetch(); - } - - - /** - * 生成查询所需要的条件,排序方式 - * @param mixed $searchfields 快速查询的字段 - * @param boolean $relationSearch 是否关联查询 - * @return array - */ - protected function buildparams($searchfields = null, $relationSearch = null) - { - $searchfields = is_null($searchfields) ? $this->searchFields : $searchfields; - $relationSearch = is_null($relationSearch) ? $this->relationSearch : $relationSearch; - $search = $this->request->get("search", ''); - $filter = $this->request->get("filter", ''); - $op = $this->request->get("op", '', 'trim'); - $sort = $this->request->get("sort", !empty($this->model) && $this->model->getPk() ? $this->model->getPk() : 'id'); - $order = $this->request->get("order", "DESC"); - $offset = $this->request->get("offset/d", 0); - $limit = $this->request->get("limit/d", 999999); - //新增自动计算页码 - $page = $limit ? intval($offset / $limit) + 1 : 1; - if ($this->request->has("page")) { - $page = $this->request->get("page/d", 1); - } - $this->request->get([config('paginate.var_page') => $page]); - $filter = (array)json_decode($filter, true); - $op = (array)json_decode($op, true); - $filter = $filter ? $filter : []; - $where = []; - $alias = []; - $bind = []; - $name = ''; - $aliasName = ''; - if (!empty($this->model) && $this->relationSearch) { - $name = $this->model->getTable(); - $alias[$name] = Loader::parseName(basename(str_replace('\\', '/', get_class($this->model)))); - $aliasName = $alias[$name] . '.'; - } - $sortArr = explode(',', $sort); - foreach ($sortArr as $index => & $item) { - $item = stripos($item, ".") === false ? $aliasName . trim($item) : $item; - } - unset($item); - $sort = implode(',', $sortArr); - $adminIds = $this->getDataLimitAdminIds(); - if (is_array($adminIds)) { - $where[] = [$aliasName . $this->dataLimitField, 'in', $adminIds]; - } - if ($search) { - $searcharr = is_array($searchfields) ? $searchfields : explode(',', $searchfields); - foreach ($searcharr as $k => &$v) { - $v = stripos($v, ".") === false ? $aliasName . $v : $v; - } - unset($v); - $where[] = [implode("|", $searcharr), "LIKE", "%{$search}%"]; - } - $index = 0; - foreach ($filter as $k => $v) { - if (!preg_match('/^[a-zA-Z0-9_\-\.]+$/', $k)) { - continue; - } - $sym = isset($op[$k]) ? $op[$k] : '='; - if (stripos($k, ".") === false) { - $k = $aliasName . $k; - } - $v = !is_array($v) ? trim($v) : $v; - $sym = strtoupper(isset($op[$k]) ? $op[$k] : $sym); - //null和空字符串特殊处理 - if (!is_array($v)) { - if (in_array(strtoupper($v), ['NULL', 'NOT NULL'])) { - $sym = strtoupper($v); - } - if (in_array($v, ['""', "''"])) { - $v = ''; - $sym = '='; - } - } - - switch ($sym) { - case '=': - case '<>': - $where[] = [$k, $sym, (string)$v]; - break; - case 'LIKE': - case 'NOT LIKE': - case 'LIKE %...%': - case 'NOT LIKE %...%': - $where[] = [$k, trim(str_replace('%...%', '', $sym)), "%{$v}%"]; - break; - case '>': - case '>=': - case '<': - case '<=': - $where[] = [$k, $sym, intval($v)]; - break; - case 'FINDIN': - case 'FINDINSET': - case 'FIND_IN_SET': - $v = is_array($v) ? $v : explode(',', str_replace(' ', ',', $v)); - $findArr = array_values($v); - foreach ($findArr as $idx => $item) { - $bindName = "item_" . $index . "_" . $idx; - $bind[$bindName] = $item; - $where[] = "FIND_IN_SET(:{$bindName}, `" . str_replace('.', '`.`', $k) . "`)"; - } - break; - case 'IN': - case 'IN(...)': - case 'NOT IN': - case 'NOT IN(...)': - $where[] = [$k, str_replace('(...)', '', $sym), is_array($v) ? $v : explode(',', $v)]; - break; - case 'BETWEEN': - case 'NOT BETWEEN': - $arr = array_slice(explode(',', $v), 0, 2); - if (stripos($v, ',') === false || !array_filter($arr)) { - continue 2; - } - //当出现一边为空时改变操作符 - if ($arr[0] === '') { - $sym = $sym == 'BETWEEN' ? '<=' : '>'; - $arr = $arr[1]; - } elseif ($arr[1] === '') { - $sym = $sym == 'BETWEEN' ? '>=' : '<'; - $arr = $arr[0]; - } - $where[] = [$k, $sym, $arr]; - break; - case 'RANGE': - case 'NOT RANGE': - $v = str_replace(' - ', ',', $v); - $arr = array_slice(explode(',', $v), 0, 2); - if (stripos($v, ',') === false || !array_filter($arr)) { - continue 2; - } - //当出现一边为空时改变操作符 - if ($arr[0] === '') { - $sym = $sym == 'RANGE' ? '<=' : '>'; - $arr = $arr[1]; - } elseif ($arr[1] === '') { - $sym = $sym == 'RANGE' ? '>=' : '<'; - $arr = $arr[0]; - } - $tableArr = explode('.', $k); - if (count($tableArr) > 1 && $tableArr[0] != $name && !in_array($tableArr[0], $alias) && !empty($this->model)) { - //修复关联模型下时间无法搜索的BUG - $relation = Loader::parseName($tableArr[0], 1, false); - $alias[$this->model->$relation()->getTable()] = $tableArr[0]; - } - $where[] = [$k, str_replace('RANGE', 'BETWEEN', $sym) . ' TIME', $arr]; - break; - case 'NULL': - case 'IS NULL': - case 'NOT NULL': - case 'IS NOT NULL': - $where[] = [$k, strtolower(str_replace('IS ', '', $sym))]; - break; - default: - break; - } - $index++; - } - if (!empty($this->model)) { - $this->model->alias($alias); - } - $model = $this->model; - $where = function ($query) use ($where, $alias, $bind, &$model) { - if (!empty($model)) { - $model->alias($alias); - $model->bind($bind); - } - foreach ($where as $k => $v) { - if (is_array($v)) { - call_user_func_array([$query, 'where'], $v); - } else { - $query->where($v); - } - } - }; - return [$where, $sort, $order, $offset, $limit, $page, $alias, $bind]; - } - - - /** - * 添加 - */ - public function add() - { - if ($this->request->isPost()) { - - $params = $this->request->post("row/a"); - if ($params) { - $params = $this->preExcludeFields($params); - - if ($this->dataLimit && $this->dataLimitFieldAutoFill) { - $params[$this->dataLimitField] = $this->auth->id; - } - $result = false; - Db::startTrans(); - try { - //是否采用模型验证 - if ($this->modelValidate) { - $name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); - $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate; - $this->model->validateFailException(true)->validate($validate); - } - $params['create_id']=$this->auth->id; - $params['group_id']=$this->auth->getGroupId(); - $result = $this->model->allowField(true)->save($params); - Db::commit(); - } catch (ValidateException $e) { - Db::rollback(); - $this->error($e->getMessage()); - } catch (PDOException $e) { - Db::rollback(); - $this->error($e->getMessage()); - } catch (Exception $e) { - Db::rollback(); - $this->error($e->getMessage()); - } - if ($result !== false) { - $this->success(); - } else { - $this->error(__('No rows were inserted')); - } - } - $this->error(__('Parameter %s can not be empty', '')); - } - return $this->view->fetch(); - } - - - /** - * 编辑 - */ - public function edit($ids = null) - { - $row = $this->model->get($ids); - if (!$row) { - $this->error(__('No Results were found')); - } - $adminIds = $this->getDataLimitAdminIds(); - if (is_array($adminIds)) { - if (!in_array($row[$this->dataLimitField], $adminIds)) { - $this->error(__('You have no permission')); - } - } - if ($this->request->isPost()) { - $params = $this->request->post("row/a"); - if ($params) { - $params = $this->preExcludeFields($params); - $result = false; - Db::startTrans(); - try { - //是否采用模型验证 - if ($this->modelValidate) { - $name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); - $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate; - $row->validateFailException(true)->validate($validate); - } - $result = $row->allowField(true)->save($params); - Db::commit(); - } catch (ValidateException $e) { - Db::rollback(); - $this->error($e->getMessage()); - } catch (PDOException $e) { - Db::rollback(); - $this->error($e->getMessage()); - } catch (Exception $e) { - Db::rollback(); - $this->error($e->getMessage()); - } - if ($result !== false) { - $this->success(); - } else { - $this->error(__('No rows were updated')); - } - } - $this->error(__('Parameter %s can not be empty', '')); - } - $this->view->assign("row", $row); - return $this->view->fetch(); - } - - - public function newEdit($id =null){ - $orderMain = $this->model->find($id); - if (!$orderMain){ - return null; - } - $orderHotelList=(new \app\admin\model\OrderHotel()) - ->where("order_id","=",$id) - ->find(); - - $orderItemList=(new \app\admin\model\OrderItem()) - ->where("order_id","=",$id) - ->find(); - $result = [ - "orderMain"=>$orderMain, - "hotel"=>$orderHotelList, - "item"=>$orderItemList - ]; - return json($result); - } - - /** * 订单页面保存接口 * @return \think\response\Json */ public function save(){ $params=$this->request->post(); $params['create_id']=$this->auth->id; - $params['group_id']=$this->auth->getGroupId(); + $groupDao = new GroupDao(); + $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupId()); $orderMainService = new OrderMainService(); Db::startTrans(); $result = $orderMainService->saveOrder($params); @@ -430,7 +71,8 @@ class OrderMain extends Backend public function subOrderSave(){ $params=$this->request->post(); $params['create_id']=$this->auth->id; - $params['group_id']=$this->auth->getGroupId(); + $groupDao = new GroupDao(); + $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupId()); $orderMainService = new OrderMainService(); Db::startTrans(); $result = $orderMainService->subOrderSave($params); @@ -484,6 +126,8 @@ class OrderMain extends Backend */ public function getOrderList(){ $params=$this->request->post(); + $groupDao = new GroupDao(); + $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupId()); $orderMainService = new OrderMainService(); $result = $orderMainService->getOrderList($params); return json($result); diff --git a/application/admin/controller/PaymentOrder.php b/application/admin/controller/PaymentOrder.php index dba82d8..f8a9d4c 100755 --- a/application/admin/controller/PaymentOrder.php +++ b/application/admin/controller/PaymentOrder.php @@ -2,6 +2,7 @@ namespace app\admin\controller; +use app\admin\dao\GroupDao; use app\admin\service\PaymentOrderService; use app\common\controller\Backend; @@ -12,7 +13,7 @@ use app\common\controller\Backend; */ class PaymentOrder extends Backend { - + protected $noNeedRight = ['save',"getList","setStatus","addOrderMain","removeOrderMain","getSubOrderList","delAll"]; /** * PaymentOrder模型对象 * @var \app\admin\model\PaymentOrder @@ -44,7 +45,8 @@ class PaymentOrder extends Backend public function save(){ $params=$this->request->post(); $params['create_id']=$this->auth->id; - $params['group_id']=$this->auth->getGroupId(); + $groupDao = new GroupDao(); + $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupId()); $service = new PaymentOrderService(); $result = $service->save($params); return json($result); @@ -56,6 +58,8 @@ class PaymentOrder extends Backend */ public function getList(){ $params=$this->request->post(); + $groupDao = new GroupDao(); + $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupId()); $service = new PaymentOrderService(); $result = $service->getList($params); return json($result); @@ -101,6 +105,8 @@ class PaymentOrder extends Backend */ public function getSubOrderList(){ $params=$this->request->post(); + $groupDao = new GroupDao(); + $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupId()); $service = new PaymentOrderService(); $result = $service->getSubOrderList($params); return json($result); diff --git a/application/admin/controller/ReceiptOrder.php b/application/admin/controller/ReceiptOrder.php index 9a15af4..391ab04 100755 --- a/application/admin/controller/ReceiptOrder.php +++ b/application/admin/controller/ReceiptOrder.php @@ -2,6 +2,7 @@ namespace app\admin\controller; +use app\admin\dao\GroupDao; use app\admin\service\ReceiptOrderDao; use app\admin\service\ReceiptOrderService; use app\common\controller\Backend; @@ -16,7 +17,7 @@ use think\exception\ValidateException; */ class ReceiptOrder extends Backend { - protected $noNeedLogin = ['getOrderMainList',"getList"]; + protected $noNeedRight = ['save',"getList","setStatus","addOrderMain","removeOrderMain","getOrderMainList","delAll"]; /** * ReceiptOrder模型对象 * @var \app\admin\model\ReceiptOrder @@ -41,152 +42,6 @@ class ReceiptOrder extends Backend * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 */ - - /** - * 查看 - */ - public function index() - { - //设置过滤方法 - $this->request->filter(['strip_tags', 'trim']); - if ($this->request->isAjax()) { - //如果发送的来源是Selectpage,则转发到Selectpage - if ($this->request->request('keyField')) { - return $this->selectpage(); - } - list($where, $sort, $order, $offset, $limit) = $this->buildparams(); - $group_id=$this->auth->getGroupId(); - $list = $this->model - ->alias("a") - ->join('hbp_admin c','a.create_id = c.id','left') - ->field("a.*,c.nickname") - ->where($where); - if ($group_id){ - $list = $list - ->where("group_id","=",$group_id) - ->order($sort, $order) - ->paginate($limit); - }else{ - $list = $list - ->order($sort, $order) - ->paginate($limit); - } - $res = $list->items(); - foreach ($res as $k=>$item){ - switch ($item["status"]){ - case 0: - $res[$k]["status"]="未付款"; - break; - case 1: - $res[$k]["status"]="已付款"; - break; - } - } - $result = array("total" => $list->total(), "rows" => $list->items()); - return json($result); - } - return $this->view->fetch(); - } - - /** - * 添加 - */ - public function add() - { - if ($this->request->isPost()) { - $params = $this->request->post("row/a"); - if ($params) { - $params = $this->preExcludeFields($params); - - if ($this->dataLimit && $this->dataLimitFieldAutoFill) { - $params[$this->dataLimitField] = $this->auth->id; - } - $result = false; - Db::startTrans(); - try { - //是否采用模型验证 - if ($this->modelValidate) { - $name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); - $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate; - $this->model->validateFailException(true)->validate($validate); - } - $params['create_id']=$this->auth->id; - $params['group_id']=$this->auth->getGroupId(); - $result = $this->model->allowField(true)->save($params); - Db::commit(); - } catch (ValidateException $e) { - Db::rollback(); - $this->error($e->getMessage()); - } catch (PDOException $e) { - Db::rollback(); - $this->error($e->getMessage()); - } catch (Exception $e) { - Db::rollback(); - $this->error($e->getMessage()); - } - if ($result !== false) { - $this->success(); - } else { - $this->error(__('No rows were inserted')); - } - } - $this->error(__('Parameter %s can not be empty', '')); - } - return $this->view->fetch(); - } - - /** - * 编辑 - */ - public function edit($ids = null) - { - $row = $this->model->get($ids); - if (!$row) { - $this->error(__('No Results were found')); - } - $adminIds = $this->getDataLimitAdminIds(); - if (is_array($adminIds)) { - if (!in_array($row[$this->dataLimitField], $adminIds)) { - $this->error(__('You have no permission')); - } - } - if ($this->request->isPost()) { - $params = $this->request->post("row/a"); - if ($params) { - $params = $this->preExcludeFields($params); - $result = false; - Db::startTrans(); - try { - //是否采用模型验证 - if ($this->modelValidate) { - $name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); - $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate; - $row->validateFailException(true)->validate($validate); - } - $result = $row->allowField(true)->save($params); - Db::commit(); - } catch (ValidateException $e) { - Db::rollback(); - $this->error($e->getMessage()); - } catch (PDOException $e) { - Db::rollback(); - $this->error($e->getMessage()); - } catch (Exception $e) { - Db::rollback(); - $this->error($e->getMessage()); - } - if ($result !== false) { - $this->success(); - } else { - $this->error(__('No rows were updated')); - } - } - $this->error(__('Parameter %s can not be empty', '')); - } - $this->view->assign("row", $row); - return $this->view->fetch(); - } - /** * 保存记录 * @return \think\response\Json @@ -194,7 +49,8 @@ class ReceiptOrder extends Backend public function save(){ $params=$this->request->post(); $params['create_id']=$this->auth->id; - $params['group_id']=$this->auth->getGroupId(); + $groupDao = new GroupDao(); + $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupId()); $service = new ReceiptOrderService(); $result = $service->save($params); return json($result); @@ -206,6 +62,8 @@ class ReceiptOrder extends Backend */ public function getList(){ $params=$this->request->post(); + $groupDao = new GroupDao(); + $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupId()); $service = new ReceiptOrderService(); $result = $service->getList($params); return json($result); @@ -251,6 +109,8 @@ class ReceiptOrder extends Backend */ public function getOrderMainList(){ $params=$this->request->post(); + $groupDao = new GroupDao(); + $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupId()); $service = new ReceiptOrderService(); $result = $service->getOrderMainList($params); return json($result); diff --git a/application/admin/controller/auth/Admin.php b/application/admin/controller/auth/Admin.php index d7434cb..ea3e269 100755 --- a/application/admin/controller/auth/Admin.php +++ b/application/admin/controller/auth/Admin.php @@ -18,6 +18,7 @@ use think\Validate; */ class Admin extends Backend { + protected $noNeedRight = ['getList']; /** * @var \app\admin\model\Admin diff --git a/application/admin/controller/general/Config.php b/application/admin/controller/general/Config.php index f7090fe..4925275 100755 --- a/application/admin/controller/general/Config.php +++ b/application/admin/controller/general/Config.php @@ -18,12 +18,11 @@ use think\Validate; */ class Config extends Backend { - /** * @var \app\common\model\Config */ protected $model = null; - protected $noNeedRight = ['check', 'rulelist', 'selectpage', 'get_fields_list']; + protected $noNeedRight = ['check', 'rulelist', 'selectpage', 'get_fields_list',"getList"]; public function _initialize() { diff --git a/application/admin/dao/CfHotelInfoDao.php b/application/admin/dao/CfHotelInfoDao.php index 190f42e..fee70e6 100644 --- a/application/admin/dao/CfHotelInfoDao.php +++ b/application/admin/dao/CfHotelInfoDao.php @@ -75,6 +75,9 @@ class CfHotelInfoDao if (!empty($param['id'])) { $where['id'] = $param['id']; } + if (!empty($param['group_id'])) { + $where['group_id'] = $param['group_id']; + } $offset = ($param['pageNum'] - 1) * $param['pageSize']; $model = new CfHotelInfo(); $total = $model->where($where)->count(); diff --git a/application/admin/dao/CfItemDao.php b/application/admin/dao/CfItemDao.php index 0ee7d9f..e4be142 100644 --- a/application/admin/dao/CfItemDao.php +++ b/application/admin/dao/CfItemDao.php @@ -59,7 +59,7 @@ class CfItemDao public function getList($param) { try { - $where = ["del_flag"=>0]; + $where = ["del_flag"=>0,"group_id"=>$param['group_id']]; if (!empty($param['item_name'])) { $where['item_name'] = ["like","%".$param['item_name']."%"]; } diff --git a/application/admin/dao/GroupDao.php b/application/admin/dao/GroupDao.php new file mode 100644 index 0000000..8039142 --- /dev/null +++ b/application/admin/dao/GroupDao.php @@ -0,0 +1,42 @@ +where(["id" => $id])->find(); + if ($result == null) { + return $id; + } + $info = $result->toArray(); + if ($info['pid']==1) { + return $id; + } + return $this->getTopGroup($info['pid']); + } catch (Exception $e) { + return $id; + } + } +} \ No newline at end of file diff --git a/application/admin/dao/OrderHotelDao.php b/application/admin/dao/OrderHotelDao.php index b85397c..60bd7e3 100644 --- a/application/admin/dao/OrderHotelDao.php +++ b/application/admin/dao/OrderHotelDao.php @@ -74,7 +74,8 @@ class OrderHotelDao ]; $orderHotelModel = new OrderHotel(); if (empty($param['id'])) { - + $data["create_id"]= $param['create_id']; + $data["group_id"]= $param['group_id']; $id = $orderHotelModel->insertGetId($data); return Util::returnArrSu("", $id); }else { diff --git a/application/admin/dao/OrderItemDao.php b/application/admin/dao/OrderItemDao.php index a0f9e8a..5c04063 100644 --- a/application/admin/dao/OrderItemDao.php +++ b/application/admin/dao/OrderItemDao.php @@ -60,6 +60,8 @@ class OrderItemDao ]; $model = new OrderItem(); if (empty($param['id'])) { + $data["create_id"]= $param['create_id']; + $data["group_id"]= $param['group_id']; $id = $model->insertGetId($data); return Util::returnArrSu("",$id); }else { diff --git a/application/admin/dao/PaymentOrderDao.php b/application/admin/dao/PaymentOrderDao.php index 3f76f1e..2937603 100644 --- a/application/admin/dao/PaymentOrderDao.php +++ b/application/admin/dao/PaymentOrderDao.php @@ -71,7 +71,7 @@ class PaymentOrderDao public function checkName($param):bool { try { $model = new PaymentOrder(); - $infoRe = $model->where(["name" => $param['name']])->find(); + $infoRe = $model->where(["name" => $param['name'],"group_id"=>$param['group_id']])->find(); if ($infoRe == null) { return false; } @@ -116,7 +116,7 @@ class PaymentOrderDao public function getList($param) { try { - $where = ["a.del_flag"=>0]; + $where = ["a.del_flag"=>0,"a.group_id"=>$param['group_id']]; if (!empty($param['name'])) { $where['a.name'] = ["like","%".$param['name']."%"]; } diff --git a/application/admin/dao/ReceiptOrderDao.php b/application/admin/dao/ReceiptOrderDao.php index 9d5de0d..bdd95a0 100644 --- a/application/admin/dao/ReceiptOrderDao.php +++ b/application/admin/dao/ReceiptOrderDao.php @@ -72,7 +72,7 @@ class ReceiptOrderDao public function checkName($param):bool { try { $model = new ReceiptOrder(); - $infoRe = $model->where(["name" => $param['name']])->find(); + $infoRe = $model->where(["name" => $param['name'],"group_id"=>$param['group_id']])->find(); if ($infoRe == null) { return false; } @@ -117,7 +117,7 @@ class ReceiptOrderDao public function getList($param) { try { - $where = ["a.del_flag"=>0]; + $where = ["a.del_flag"=>0,"a.group_id"=>$param['group_id']]; if (!empty($param['name'])) { $where['a.name'] = ["like","%".$param['name']."%"]; } diff --git a/application/admin/model/CfHotelInfo.php b/application/admin/model/CfHotelInfo.php index 60154d2..b18426e 100755 --- a/application/admin/model/CfHotelInfo.php +++ b/application/admin/model/CfHotelInfo.php @@ -29,14 +29,15 @@ class CfHotelInfo extends Model ]; - public function getList($name='',$keyValue=''){ + public function getList($name='',$keyValue='',$params){ $this->field('id,hotel_name as name'); - $where = ["del_flag"=>0]; + $where = ["del_flag"=>0,"group_id"=>$params['group_id']]; if($keyValue){ - $where = ['id'=>$keyValue,"del_flag"=>0]; + $where = ['id'=>$keyValue,"del_flag"=>0,"group_id"=>$params['group_id']]; }elseif($name){ - $where = ['hotel_name'=>['like','%'.$name.'%'],"del_flag"=>0]; + $where = ['hotel_name'=>['like','%'.$name.'%'],"del_flag"=>0,"group_id"=>$params['group_id']]; } + return $this->where($where)->select()->toArray(); } diff --git a/application/admin/service/OrderMainService.php b/application/admin/service/OrderMainService.php index 6e92687..312a58d 100644 --- a/application/admin/service/OrderMainService.php +++ b/application/admin/service/OrderMainService.php @@ -48,6 +48,7 @@ class OrderMainService $purchasePriceDao->delete($orderId); //循环子订单 foreach ($param['subOrderList'] as $subOrderParam) { + $subOrderParam['create_id'] = $param['create_id']; $subOrderParam['group_id'] = $param['group_id']; //1.获取负责人昵称 $adminDao = new AdminDao(); @@ -306,7 +307,7 @@ class OrderMainService */ public function getOrderList($param){ $orderMainDao = new OrderMainDao(); - $where = [" a.del_flag = 0 "]; + $where = [" a.del_flag = 0 ","a.group_id= {$param['group_id']} "]; if (!empty($param['order_id'])) { $where[] =" a.id = {$param['order_id']} "; } diff --git a/application/admin/service/PaymentOrderService.php b/application/admin/service/PaymentOrderService.php index dd55614..9435b5f 100644 --- a/application/admin/service/PaymentOrderService.php +++ b/application/admin/service/PaymentOrderService.php @@ -147,8 +147,8 @@ class PaymentOrderService */ public function getSubOrderList($param){ $dao = new PaymentOrderDao(); - $item_where_arr = ["d.del_flag=0","a.del_flag=0"]; - $hotel_where_arr = ["c.del_flag=0","b.del_flag=0"]; + $item_where_arr = ["d.del_flag=0","a.del_flag=0","a.group_id = {$param['group_id']}"]; + $hotel_where_arr = ["c.del_flag=0","b.del_flag=0","b.group_id = {$param['group_id']}"]; $where_arr = []; if ($param['prod_type']=='hotel'){ $item_where_arr[] = " a.id = 0 "; diff --git a/application/admin/service/ReceiptOrderService.php b/application/admin/service/ReceiptOrderService.php index efd6c0e..072afea 100644 --- a/application/admin/service/ReceiptOrderService.php +++ b/application/admin/service/ReceiptOrderService.php @@ -119,7 +119,7 @@ class ReceiptOrderService */ public function getOrderMainList($param){ $orderMainDao = new OrderMainDao(); - $where = ["id"=>["neq",""]]; + $where = ["id"=>["neq",""],"group_id"=>$param['group_id']]; if (!empty($param['order_id'])) { $where["id"]=$param['order_id']; }