public function appoint3() { if ($_GET) { $id = I('get.id', 0); if ($id) { $Teacher = M('teacher'); $where['account_id'] = $id; $teacher_result = $Teacher->where($where)->find(); $Option = M('option'); $option_result = $Option->select(); if ($teacher_result && $option_result) { $this->_data['html'] = set_week(); $this->_data['appoint'] = $teacher_result; $this->_data['url'] = U('save_appoint'); $this->_data['appoint']['time_per_day'] = $option_result[0]['value']; //每天最多预约次数 $this->_data['appoint']['number_per_appoint'] = $option_result[1]['value']; //每次预约最多能选择的时间段 $this->_data['appoint']['number_per_month'] = $option_result[2]['value']; //每个月最多预约次数 //var_dump($this->_data); //die(); $this->assign($this->_data); $this->display(); } else { $this->redirect('index', '', 0); } } else { $this->redirect('index', '', 0); } } }
/** * 修改预约 */ public function appoint_change() { $this->is_user(); $this->_data['title'] = '修改预约'; if ($_POST && $_POST['appoint_id']) { $where['appoint_id'] = $_POST['appoint_id']; $data['time'] = $_POST['time']; $Appoint = M('appoint'); $appoint_result = $Appoint->data($data)->where($where)->save(); if ($appoint_result !== false) { $res['status'] = 0; $res['content'] = 'success'; $this->ajaxReturn($res); } else { $res['status'] = -1; $res['content'] = 'fail'; $this->ajaxReturn($res); } } else { $appoint_id = I('get.appoint_id', 0); $result = []; foreach ($this->_data['user']['appoint_list'] as $k => $v) { if ($v['appoint_id'] == $appoint_id) { $Teacher = M('teacher'); $where['account_id'] = $v['teacher_id']; $teacher_info = $Teacher->where($where)->find(); $result['appoint']['appoint_id'] = $appoint_id; $result['appoint']['user_id'] = $v['user_id']; $result['appoint']['teacher_id'] = $v['teacher_id']; $result['appoint']['time'] = $v['time']; $result['appoint']['save_time'] = $v['save_time']; $result['appoint']['status'] = $v['status']; $result['teacher']['avatar'] = $teacher_info['avatar']; $result['teacher']['gender'] = $teacher_info['gender']; $result['teacher']['email'] = $teacher_info['email']; $result['teacher']['city'] = $teacher_info['city']; $result['teacher']['name'] = $teacher_info['name']; $result['teacher']['service_type'] = $teacher_info['service_type']; $result['teacher']['free_time'] = $teacher_info['free_time']; $result['teacher']['certificate'] = $teacher_info['certificate']; $result['teacher']['introduction'] = $teacher_info['introduction']; break; } } $this->_data['appoint_info'] = $result; $this->_data['html'] = set_week(); $this->_data['url'] = U('appoint_change'); $this->assign($this->_data); $this->display(); } }