酒店预订平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

96 lines
2.7 KiB

  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\dao\GroupDao;
  4. use app\admin\model\Area;
  5. use app\admin\service\CfHotelInfoService;
  6. use app\common\controller\Backend;
  7. use think\Db;
  8. use think\exception\PDOException;
  9. use think\exception\ValidateException;
  10. /**
  11. * 配置-酒店详情
  12. *
  13. * @icon fa fa-circle-o
  14. */
  15. class CfHotelInfo extends Backend
  16. {
  17. protected $noNeedRight = ['getHotelList',"getList","save","delAll"];
  18. /**
  19. * CfHotelInfo模型对象
  20. * @var \app\admin\model\CfHotelInfo
  21. */
  22. protected $model = null;
  23. public function _initialize()
  24. {
  25. parent::_initialize();
  26. $this->model = new \app\admin\model\CfHotelInfo;
  27. }
  28. public function import()
  29. {
  30. parent::import();
  31. }
  32. /**
  33. * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
  34. * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
  35. * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
  36. */
  37. public function getHotelList(){
  38. $name=$this->request->post('name');
  39. $keyValue=$this->request->post('keyValue');
  40. $params['create_id']=$this->auth->id;
  41. $groupDao = new GroupDao();
  42. $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupIds()[0]);
  43. $result= $this->model->getList($name,$keyValue,$params);
  44. if($keyValue){
  45. return json(['list' => $result]);
  46. }
  47. return json(['list' => $result]);
  48. }
  49. /****=========================================**/
  50. /**
  51. * 获取列表
  52. * @return \think\response\Json
  53. */
  54. public function getList(){
  55. $params=$this->request->post();
  56. $params['create_id']=$this->auth->id;
  57. $groupDao = new GroupDao();
  58. $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupIds()[0]);
  59. $service = new CfHotelInfoService();
  60. return json($service->getList($params));
  61. }
  62. /**
  63. * 保存记录
  64. * @return \think\response\Json
  65. */
  66. public function save(){
  67. $params=$this->request->post();
  68. $params['create_id']=$this->auth->id;
  69. $groupDao = new GroupDao();
  70. $params['group_id'] = $groupDao->getTopGroup($this->auth->getGroupIds()[0]);
  71. $service = new CfHotelInfoService();
  72. return json($service->save($params));
  73. }
  74. /**
  75. * 删除
  76. * @return \think\response\Json
  77. */
  78. public function delAll(){
  79. $params=$this->request->post();
  80. $service = new CfHotelInfoService();
  81. return json($service->del($params));
  82. }
  83. }