diff --git a/src/ClassCourseTable.php b/src/ClassCourseTable.php index 35c52cc..fd2c890 100644 --- a/src/ClassCourseTable.php +++ b/src/ClassCourseTable.php @@ -99,8 +99,9 @@ public function getProfessionsByCollege(string $collegeCode = '', string $grade * @param string $weekEnd 结束周(值1~30) * @param string $dayOfWeekStart 开始星期几(值1~7) * @param string $dayOfWeekEnd 结束星期几(值1~7) - * @param string $serialNoStart 开始节数 - * @param string $serialNoEnd 结束节数 + * @param string $serialNoStart 开始节数(暂不生效) + * @param string $serialNoEnd 结束节数(暂不生效) + * @param int $timeout 请求超时时间(秒) * @return array * @throws Exception */ @@ -116,7 +117,8 @@ public function classCourse( string $dayOfWeekStart = '', string $dayOfWeekEnd = '', string $serialNoStart = '', - string $serialNoEnd = '' + string $serialNoEnd = '', + int $timeout = 30 ): array { $postPara = [ @@ -131,12 +133,12 @@ public function classCourse( 'zc2' => $weekEnd, 'skxq1' => $dayOfWeekStart, 'skxq2' => $dayOfWeekEnd, - 'jc1' => $serialNoStart, - 'jc2' => $serialNoEnd + // 'jc1' => $serialNoStart, + // 'jc2' => $serialNoEnd ]; $post = http_build_query($postPara); $referer = $this->edusysUrl . '/jsxsd/kbcx/kbxx_xzb'; - $html = $this->httpPost('/jsxsd/kbcx/kbxx_xzb_ifr', $post, $this->cookie, $referer); + $html = $this->httpPost('/jsxsd/kbcx/kbxx_xzb_ifr', $post, $this->cookie, $referer, $timeout); $vaildHtml = $this->checkCookieByHtml($html['data']); if ($vaildHtml !== true) throw new Exception($vaildHtml['data']); if ($html['code'] !== self::CODE_SUCCESS) throw new Exception('获取失败'); diff --git a/src/Edusys.php b/src/Edusys.php index 1b94a61..01a967b 100644 --- a/src/Edusys.php +++ b/src/Edusys.php @@ -264,6 +264,7 @@ public function getProfessions(string $collegeCode = '', string $grade = ''): ar * @param string $dayOfWeekEnd 结束星期几(值1~7) * @param string $serialNoStart 开始节数 * @param string $serialNoEnd 结束节数 + * @param int $timeout 请求超时时间(秒) * @return array * @throws Exception */ @@ -279,7 +280,8 @@ public function classCourse( string $dayOfWeekStart = '', string $dayOfWeekEnd = '', string $serialNoStart = '', - string $serialNoEnd = '' + string $serialNoEnd = '', + int $timeout = 30 ): array { if (empty($this->usercode) || empty($this->cookie)) throw new Exception('账号未登录'); @@ -296,7 +298,8 @@ public function classCourse( $dayOfWeekStart, $dayOfWeekEnd, $serialNoStart, - $serialNoEnd + $serialNoEnd, + $timeout ); } @@ -339,7 +342,8 @@ public function teacherCourse( string $dayOfWeekStart = '', string $dayOfWeekEnd = '', string $serialNoStart = '', - string $serialNoEnd = '' + string $serialNoEnd = '', + int $timeout = 30 ): array { if (empty($this->usercode) || empty($this->cookie)) throw new Exception('账号未登录'); @@ -355,7 +359,8 @@ public function teacherCourse( $dayOfWeekStart, $dayOfWeekEnd, $serialNoStart, - $serialNoEnd + $serialNoEnd, + $timeout ); } diff --git a/src/TeacherCourseTable.php b/src/TeacherCourseTable.php index 5c53982..ce8156b 100644 --- a/src/TeacherCourseTable.php +++ b/src/TeacherCourseTable.php @@ -78,6 +78,7 @@ public function formatOptions(string $html): array * @param string $dayOfWeekEnd 结束星期几(值1~7) * @param string $serialNoStart 开始节数 * @param string $serialNoEnd 结束节数 + * @param int $timeout 请求超时时间(秒) * @return array * @throws Exception */ @@ -92,7 +93,8 @@ public function teacherCourse( string $dayOfWeekStart = '', string $dayOfWeekEnd = '', string $serialNoStart = '', - string $serialNoEnd = '' + string $serialNoEnd = '', + int $timeout = 30 ): array { $postPara = [ @@ -112,7 +114,7 @@ public function teacherCourse( $post = http_build_query($postPara); $referer = $this->edusysUrl . '/jsxsd/kbcx/kbxx_teacher'; - $html = $this->httpPost('/jsxsd/kbcx/kbxx_teacher_ifr', $post, $this->cookie, $referer); + $html = $this->httpPost('/jsxsd/kbcx/kbxx_teacher_ifr', $post, $this->cookie, $referer, $timeout); $vaildHtml = $this->checkCookieByHtml($html['data']); if ($vaildHtml !== true) throw new Exception($vaildHtml['data']); if ($html['code'] !== self::CODE_SUCCESS) throw new Exception('获取失败');