Meeting.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use app\common\model\MeetingModel;
  5. use app\common\model\OfficeModel;
  6. use app\common\model\Park;
  7. /**
  8. * 会议室管理
  9. */
  10. class Meeting extends Api
  11. {
  12. protected $noNeedLogin = ['lists', 'parkLists', 'listInfo', 'qustion', 'qustionInfo', 'buildInfo', 'protable', 'cityLists', 'NoticeInfo', 'GgInfo'];
  13. protected $noNeedRight = ['*'];
  14. /**
  15. * 会议室列表
  16. * @param string $page 页数
  17. * @param string $limit 条数
  18. * @param string $area_name 条数
  19. * @param string $area_id 地区id
  20. * @param string $num 座位
  21. * @param string $money 租金
  22. */
  23. public function lists()
  24. {
  25. $page = $this->request->get('page');
  26. $limit = $this->request->get('limit');
  27. $area_name = $this->request->get('area_name');
  28. $area_id = $this->request->get('area_id');
  29. $num = $this->request->get('num');
  30. $money = $this->request->get('money');
  31. $mp = [];
  32. if (isset($area_id) && !empty($area_id)) $mp['c_id'] = $area_id;
  33. if (isset($area_name) && !empty($area_name)) {
  34. $name = Park::where('name','like','%'.$area_name.'%')->column('id');
  35. $idStr = implode(',',$name);
  36. if (!empty($idStr)) {
  37. $mp['p_id'] = ['in',$idStr];
  38. } else {
  39. $mp['p_id'] = 0;
  40. }
  41. };
  42. if (isset($num) && !empty($num)) {
  43. if ($num == 2) {
  44. $mp['yizi_count'] = ['between', '0,10'];
  45. } else if ($num == 3) {
  46. $mp['yizi_count'] = ['between', '10,30'];
  47. } else if ($num == 4) {
  48. $mp['yizi_count'] = ['between', '30,50'];
  49. } else if ($num == 5) {
  50. $mp['yizi_count'] = ['between', '50,100'];
  51. } else if ($num == 6) {
  52. $mp['yizi_count'] = ['between', '100,200'];
  53. } else if ($num == 7) {
  54. $mp['yizi_count'] = ['between', '200,300'];
  55. } else if ($num == 8) {
  56. $mp['yizi_count'] = ['>', '300'];
  57. }
  58. }
  59. if (isset($money) && !empty($money)) {
  60. if ($money == 2) {
  61. $mp['money_num'] = ['between', '0,100'];
  62. } else if ($money == 3) {
  63. $mp['money_num'] = ['between', '100,200'];
  64. } else if ($num == 4) {
  65. $mp['money_num'] = ['between', '200,500'];
  66. } else if ($money == 5) {
  67. $mp['money_num'] = ['between', '500,1000'];
  68. } else if ($money == 6) {
  69. $mp['money_num'] = ['>', '1000'];
  70. }
  71. }
  72. if (empty($area_name)) {
  73. $user = $this->auth->getUser();
  74. if ($user && $user['p_id'] != 0) $mp['p_id'] = $user['p_id'];
  75. };
  76. $mp['switch'] = 1;
  77. if (!$page) {
  78. $pages = '0,10';
  79. } else {
  80. $page = $page - 1;
  81. if ($page < 0) $page = 0;
  82. $pages = $page . ',' . $limit;
  83. }
  84. $meetingModel = new MeetingModel();
  85. $field = 'id,image,title,mongey,mianji,address,yizi';
  86. $data = $meetingModel->where($mp)->limit($pages)->field($field)->order('sort desc')->select();
  87. if ($data) {
  88. return $this->success('', $data);
  89. } else {
  90. return $this->success('暂无数据');
  91. }
  92. }
  93. /**
  94. * 会议详情
  95. * @param string $id id
  96. *
  97. */
  98. public function listInfo()
  99. {
  100. $id = $this->request->get('id');
  101. if (!isset($id) || empty($id)) return $this->error('缺少参数');
  102. $meetingModel = new MeetingModel();
  103. $data = $meetingModel->where('switch', 1)
  104. ->where('id', $id)
  105. ->order('sort desc')
  106. ->find();
  107. $count = count($data['gongzuori_shijina_ids']);
  108. $data['gongzui_start_time'] = $data['gongzuori_shijina_ids'][0];
  109. $data['gongzui_start_end'] = $data['gongzuori_shijina_ids'][$count-1];
  110. $count = count($data['xiuxiri_shijian_ids']);
  111. $data['xiuxi_start_time'] = $data['xiuxiri_shijian_ids'][0];
  112. $data['xiuxi_start_end'] = $data['xiuxiri_shijian_ids'][$count-1];
  113. $user = $this->auth->getUser();
  114. if ($user) $data['miangei_time'] = $user['edu'];
  115. if ($data) {
  116. return $this->success('', $data);
  117. } else {
  118. return $this->success('暂无数据');
  119. }
  120. }
  121. }