public function time() { $week = \Hnust\input('week/d'); $gid = \Hnust\input('group/d'); $list = \Hnust\input('list'); //判断周次 if ($week < 1 || $week > 20) { $this->msg = '周次有误,请重新选择'; $this->code = Config::RETURN_ERROR; return; } $student = array(); //群组中获取 if ($gid) { $group = new Group(); $result = $group->getMember($gid); if ($result) { foreach ($result as $item) { $student[] = $item['sid']; } } } //输入框中获取 $list = trim($list); if ($list) { $list = explode("\n", $list); if ($list) { $student = array_merge($student, $list); } } $student = array_unique($student); //判断学号 if (empty($student)) { $this->msg = '学号不能为空,请选择群组或者输入学号'; $this->code = Config::RETURN_ERROR; return; } //正常 $schedule = new \Hnust\Analyse\Schedule('1301010101'); $result = $schedule->getFreeTime($student, $week); $this->data = $result['data']; $this->info = array('week' => $week, 'list' => $list, 'error' => $result['error']); }