123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <?php
- namespace app\api\controller;
- use app\common\controller\Api;
- use app\common\model\MeetingModel;
- use app\common\model\OfficeModel;
- use app\common\model\Park;
- /**
- * 会议室管理
- */
- class Meeting extends Api
- {
- protected $noNeedLogin = ['lists', 'parkLists', 'listInfo', 'qustion', 'qustionInfo', 'buildInfo', 'protable', 'cityLists', 'NoticeInfo', 'GgInfo'];
- protected $noNeedRight = ['*'];
- /**
- * 会议室列表
- * @param string $page 页数
- * @param string $limit 条数
- * @param string $area_name 条数
- * @param string $area_id 地区id
- * @param string $num 座位
- * @param string $money 租金
- */
- public function lists()
- {
- $page = $this->request->get('page');
- $limit = $this->request->get('limit');
- $area_name = $this->request->get('area_name');
- $area_id = $this->request->get('area_id');
- $num = $this->request->get('num');
- $money = $this->request->get('money');
- $mp = [];
- if (isset($area_id) && !empty($area_id)) $mp['c_id'] = $area_id;
- if (isset($area_name) && !empty($area_name)) {
- $name = Park::where('name','like','%'.$area_name.'%')->column('id');
- $idStr = implode(',',$name);
- if (!empty($idStr)) {
- $mp['p_id'] = ['in',$idStr];
- } else {
- $mp['p_id'] = 0;
- }
- };
- if (isset($num) && !empty($num)) {
- if ($num == 2) {
- $mp['yizi_count'] = ['between', '0,10'];
- } else if ($num == 3) {
- $mp['yizi_count'] = ['between', '10,30'];
- } else if ($num == 4) {
- $mp['yizi_count'] = ['between', '30,50'];
- } else if ($num == 5) {
- $mp['yizi_count'] = ['between', '50,100'];
- } else if ($num == 6) {
- $mp['yizi_count'] = ['between', '100,200'];
- } else if ($num == 7) {
- $mp['yizi_count'] = ['between', '200,300'];
- } else if ($num == 8) {
- $mp['yizi_count'] = ['>', '300'];
- }
- }
- if (isset($money) && !empty($money)) {
- if ($money == 2) {
- $mp['money_num'] = ['between', '0,100'];
- } else if ($money == 3) {
- $mp['money_num'] = ['between', '100,200'];
- } else if ($num == 4) {
- $mp['money_num'] = ['between', '200,500'];
- } else if ($money == 5) {
- $mp['money_num'] = ['between', '500,1000'];
- } else if ($money == 6) {
- $mp['money_num'] = ['>', '1000'];
- }
- }
- if (empty($area_name)) {
- $user = $this->auth->getUser();
- if ($user && $user['p_id'] != 0) $mp['p_id'] = $user['p_id'];
- };
- $mp['switch'] = 1;
- if (!$page) {
- $pages = '0,10';
- } else {
- $page = $page - 1;
- if ($page < 0) $page = 0;
- $pages = $page . ',' . $limit;
- }
- $meetingModel = new MeetingModel();
- $field = 'id,image,title,mongey,mianji,address,yizi';
- $data = $meetingModel->where($mp)->limit($pages)->field($field)->order('sort desc')->select();
- if ($data) {
- return $this->success('', $data);
- } else {
- return $this->success('暂无数据');
- }
- }
- /**
- * 会议详情
- * @param string $id id
- *
- */
- public function listInfo()
- {
- $id = $this->request->get('id');
- if (!isset($id) || empty($id)) return $this->error('缺少参数');
- $meetingModel = new MeetingModel();
- $data = $meetingModel->where('switch', 1)
- ->where('id', $id)
- ->order('sort desc')
- ->find();
- $count = count($data['gongzuori_shijina_ids']);
- $data['gongzui_start_time'] = $data['gongzuori_shijina_ids'][0];
- $data['gongzui_start_end'] = $data['gongzuori_shijina_ids'][$count-1];
- $count = count($data['xiuxiri_shijian_ids']);
- $data['xiuxi_start_time'] = $data['xiuxiri_shijian_ids'][0];
- $data['xiuxi_start_end'] = $data['xiuxiri_shijian_ids'][$count-1];
- $user = $this->auth->getUser();
- if ($user) $data['miangei_time'] = $user['edu'];
- if ($data) {
- return $this->success('', $data);
- } else {
- return $this->success('暂无数据');
- }
- }
- }
|