generated from mirzaev/pot
production mode
This commit is contained in:
parent
05a9a51a0d
commit
830ba25b8d
|
@ -175,151 +175,151 @@ final class interneturok extends core
|
||||||
if (!empty($accounts)) {
|
if (!empty($accounts)) {
|
||||||
// Initialized accounts
|
// Initialized accounts
|
||||||
|
|
||||||
/* if (shuffle($accounts)) { */
|
if (shuffle($accounts)) {
|
||||||
// Shuffled accounts
|
// Shuffled accounts
|
||||||
|
|
||||||
foreach ($accounts as $account) {
|
foreach ($accounts as $account) {
|
||||||
// Iterating over accounts
|
// Iterating over accounts
|
||||||
|
|
||||||
// Waiting for processing the request
|
|
||||||
sleep($waiting);
|
|
||||||
|
|
||||||
if ($this->authentication($account)->wait()) {
|
|
||||||
// Authenticated the account
|
|
||||||
|
|
||||||
// Writing into the output buffer
|
|
||||||
echo 'Аутентифицирован: ' . $account['mail'] . "\n";
|
|
||||||
|
|
||||||
// Waiting for processing the request
|
// Waiting for processing the request
|
||||||
sleep($waiting);
|
sleep($waiting);
|
||||||
|
|
||||||
// Initializing the user journal
|
if ($this->authentication($account)->wait()) {
|
||||||
$journal = $this->journal(grade: $grade)->wait();
|
// Authenticated the account
|
||||||
|
|
||||||
if (!empty($journal)) {
|
|
||||||
// Initialized the user journal
|
|
||||||
|
|
||||||
// Writing into the output buffer
|
// Writing into the output buffer
|
||||||
echo "Инициализирован журнал\n";
|
echo 'Аутентифицирован: ' . $account['mail'] . "\n";
|
||||||
|
|
||||||
// Initializing the actual date
|
// Waiting for processing the request
|
||||||
$date = new datetime();
|
sleep($waiting);
|
||||||
|
|
||||||
// Initializing the homeworks database
|
// Initializing the user journal
|
||||||
$model = new homework();
|
$journal = $this->journal(grade: $grade)->wait();
|
||||||
|
|
||||||
// Initializing the schedule subject events
|
if (!empty($journal)) {
|
||||||
$schedule = $journal?->schedule_events;
|
// Initialized the user journal
|
||||||
|
|
||||||
foreach ($schedule as $_subject) {
|
// Writing into the output buffer
|
||||||
// Iterating over scheduled subject events
|
echo "Инициализирован журнал\n";
|
||||||
|
|
||||||
if ($_subject->subject?->name === $subject->value) {
|
// Initializing the actual date
|
||||||
// Found the target suject
|
$date = new datetime();
|
||||||
|
|
||||||
foreach ($_subject->events as $event) {
|
// Initializing the homeworks database
|
||||||
// Iterating over the target subject events
|
$model = new homework();
|
||||||
|
|
||||||
// Normalizing the event variable (events can be more than one)
|
// Initializing the schedule subject events
|
||||||
$event = $event[0] ?? null;
|
$schedule = $journal?->schedule_events;
|
||||||
|
|
||||||
if (!empty($event)) {
|
foreach ($schedule as $_subject) {
|
||||||
// Initialized the target subject event (the homework exists)
|
// Iterating over scheduled subject events
|
||||||
|
|
||||||
if (new datetime($event->date) <= $date && new datetime($event->date)->modify('+6 days') >= $date) {
|
if ($_subject->subject?->name === $subject->value) {
|
||||||
// Found the current event
|
// Found the target suject
|
||||||
|
|
||||||
if ($event->subject?->name === $subject->value && $event->subject->grade === $grade) {
|
foreach ($_subject->events as $event) {
|
||||||
// Found the target subject
|
// Iterating over the target subject events
|
||||||
|
|
||||||
// Writing into the output buffer
|
// Normalizing the event variable (events can be more than one)
|
||||||
echo "Найден школьный предмет: $subject->value для $grade класса (с " . new datetime($event->date)->format('d.m') . ' по ' . new datetime($event->date)->modify('+6 days')->format('d.m') . ")\n";
|
$event = $event[0] ?? null;
|
||||||
|
|
||||||
// Initializing the unblock time
|
if (!empty($event)) {
|
||||||
$unblock = svoboda::timestamp() - 31536000;
|
// Initialized the target subject event (the homework exists)
|
||||||
|
|
||||||
foreach ($event->homeworks as $homework) {
|
if (new datetime($event->date) <= $date && new datetime($event->date)->modify('+6 days') >= $date) {
|
||||||
// Iterating over scheduled event homeworks
|
// Found the current event
|
||||||
|
|
||||||
if ($homework->status === 'checked' && $homework->mark === 5) {
|
if ($event->subject?->name === $subject->value && $event->subject->grade === $grade) {
|
||||||
// Homework checked and completed for a grade of 5
|
// Found the target subject
|
||||||
|
|
||||||
// Checking for the block record
|
// Writing into the output buffer
|
||||||
$blocked = $model->database->read(
|
echo "Найден школьный предмет: $subject->value для $grade класса (с " . new datetime($event->date)->format('d.m') . ' по ' . new datetime($event->date)->modify('+6 days')->format('d.m') . ")\n";
|
||||||
filter: fn(record $record) => $record->identifier === $homework->item_id && $record->created > $unblock,
|
|
||||||
amount: 1
|
|
||||||
)[0] ?? null;
|
|
||||||
|
|
||||||
if ($blocked instanceof record) {
|
// Initializing the unblock time
|
||||||
// The account homework has been downloaded for 1 year
|
$unblock = svoboda::timestamp() - 31536000;
|
||||||
|
|
||||||
continue 3;
|
foreach ($event->homeworks as $homework) {
|
||||||
} else {
|
// Iterating over scheduled event homeworks
|
||||||
// The account homework has not been downloaded for 1 year
|
|
||||||
|
|
||||||
// Writing into the output buffer
|
if ($homework->status === 'checked' && $homework->mark === 5) {
|
||||||
echo "Найдено домашнее задание: $homework->item_id с оценкой $homework->mark\n";
|
// Homework checked and completed for a grade of 5
|
||||||
|
|
||||||
// Waiting for processing the request
|
// Checking for the block record
|
||||||
sleep($waiting);
|
$blocked = $model->database->read(
|
||||||
|
filter: fn(record $record) => $record->identifier === $homework->item_id && $record->created > $unblock,
|
||||||
|
amount: 1
|
||||||
|
)[0] ?? null;
|
||||||
|
|
||||||
// Initializing the homework files
|
if ($blocked instanceof record) {
|
||||||
$files = $this->homework(lesson: $event->lesson->id, homework: $homework->item_id)->wait();
|
// The account homework has been downloaded for 1 year
|
||||||
|
|
||||||
if (!empty($files)) {
|
continue 3;
|
||||||
// Initialized the homework files
|
} else {
|
||||||
|
// The account homework has not been downloaded for 1 year
|
||||||
|
|
||||||
// Writing into the output buffer
|
// Writing into the output buffer
|
||||||
echo "Получено домашнее задание\n";
|
echo "Найдено домашнее задание: $homework->item_id с оценкой $homework->mark\n";
|
||||||
|
|
||||||
// Blocking the homework downloading for 1 year
|
// Waiting for processing the request
|
||||||
$blocked = $model->create(identifier: $homework->item_id);
|
sleep($waiting);
|
||||||
|
|
||||||
if ($blocked !== false) {
|
// Initializing the homework files
|
||||||
// The homework was blocked for 1 year
|
$files = $this->homework(lesson: $event->lesson->id, homework: $homework->item_id)->wait();
|
||||||
|
|
||||||
// Writing into the output buffer
|
if (!empty($files)) {
|
||||||
echo "Заблокировано на 1 год домашнее задание\n";
|
// Initialized the homework files
|
||||||
|
|
||||||
// Exit (success)
|
// Writing into the output buffer
|
||||||
return $files;
|
echo "Получено домашнее задание\n";
|
||||||
|
|
||||||
|
// Blocking the homework downloading for 1 year
|
||||||
|
$blocked = $model->create(identifier: $homework->item_id);
|
||||||
|
|
||||||
|
if ($blocked !== false) {
|
||||||
|
// The homework was blocked for 1 year
|
||||||
|
|
||||||
|
// Writing into the output buffer
|
||||||
|
echo "Заблокировано на 1 год домашнее задание\n";
|
||||||
|
|
||||||
|
// Exit (success)
|
||||||
|
return $files;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Stopping processing events and starting processing the next account
|
// Stopping processing events and starting processing the next account
|
||||||
break 2;
|
break 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Stopping processing events and starting processing the next account
|
// Stopping processing events and starting processing the next account
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Not initialized the user journal
|
||||||
|
|
||||||
|
// Writing into the output buffer
|
||||||
|
echo "Аккаунт не подходит под требования\n";
|
||||||
|
|
||||||
|
// Proceed to processing the next account
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Not initialized the user journal
|
// Not authenticated the account
|
||||||
|
|
||||||
// Writing into the output buffer
|
// Writing into the output buffer
|
||||||
echo "Аккаунт не подходит под требования\n";
|
echo "Не аутентифицирован\n";
|
||||||
|
|
||||||
// Proceed to processing the next account
|
// Proceed to processing the next account
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// Not authenticated the account
|
|
||||||
|
|
||||||
// Writing into the output buffer
|
|
||||||
echo "Не аутентифицирован\n";
|
|
||||||
|
|
||||||
// Proceed to processing the next account
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* } */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exit (fail)
|
// Exit (fail)
|
||||||
|
@ -642,124 +642,29 @@ final class interneturok extends core
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->browser->sendAsync($request)
|
return $this->browser->sendAsync($request)
|
||||||
->then(function ($response) use ($homework) {
|
->then(
|
||||||
// Sended the request and received the response
|
function ($response) use ($homework) {
|
||||||
|
// Sended the request and received the response
|
||||||
|
|
||||||
// Initializing the lesson
|
// Initializing the lesson
|
||||||
$lesson = json_decode((string) $response->getBody())?->data?->homeschool?->response;
|
$lesson = json_decode((string) $response->getBody())?->data?->homeschool?->response;
|
||||||
|
|
||||||
foreach ($lesson->items as $section) {
|
foreach ($lesson->items as $section) {
|
||||||
// Iterating over the lesson sections
|
// Iterating over the lesson sections
|
||||||
|
|
||||||
if ($section->id === $homework && $section->item_type === 'homework' && $section->homework_kind === 'homework_base') {
|
if ($section->id === $homework && $section->item_type === 'homework' && $section->homework_kind === 'homework_base') {
|
||||||
// Found the base homework section
|
// Found the base homework section
|
||||||
|
|
||||||
// Initializng the test identifier (string)
|
// Initializng the test identifier (string)
|
||||||
$test = $section->homework_attributes?->parsed_content?->evo_test_id ?? null;
|
$test = $section->homework_attributes?->parsed_content?->evo_test_id ?? null;
|
||||||
|
|
||||||
if (!empty($test)) {
|
if (!empty($test)) {
|
||||||
// Initialized the test identifier
|
// Initialized the test identifier
|
||||||
|
|
||||||
// Initializing the request to the test data API
|
|
||||||
$request = new request(
|
|
||||||
'GET',
|
|
||||||
static::TESTS . "/$test/result",
|
|
||||||
[
|
|
||||||
'Authorization' => "Bearer $this->token"
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
return $this->browser->sendAsync($request)
|
|
||||||
->then(function ($response) use ($homework) {
|
|
||||||
// Sended the request and received the response
|
|
||||||
|
|
||||||
// Initializing the test result
|
|
||||||
$result = json_decode((string) $response->getBody())?->data?->tests?->response?->data;
|
|
||||||
|
|
||||||
if (!empty($result)) {
|
|
||||||
// Initialized the test result
|
|
||||||
|
|
||||||
// Initializing paths to the homework storage folder
|
|
||||||
$storage = STORAGE . DIRECTORY_SEPARATOR . 'homeworks' . DIRECTORY_SEPARATOR . $homework;
|
|
||||||
|
|
||||||
// Initializing the homework storage folder
|
|
||||||
if (!file_exists($storage)) mkdir($storage, 0775, true);
|
|
||||||
|
|
||||||
// Initializing the excel document
|
|
||||||
$excel = excel::create(['Домашнее задание']);
|
|
||||||
|
|
||||||
// Initializing the excel document sheet
|
|
||||||
$sheet = $excel->sheet();
|
|
||||||
|
|
||||||
// Writing settings of the excel document sheet
|
|
||||||
$sheet->setColWidths(['A' => 10, 'B' => 80, 'C' => 50]);
|
|
||||||
|
|
||||||
// Writing title
|
|
||||||
$sheet->writeRow(
|
|
||||||
['Номер', 'Задание', 'Ответ'],
|
|
||||||
[
|
|
||||||
'font' => [
|
|
||||||
'style' => 'bold'
|
|
||||||
],
|
|
||||||
'text-align' => 'center',
|
|
||||||
'vertical-align' => 'center',
|
|
||||||
'border' => 'thin',
|
|
||||||
'height' => 24,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($result->test?->questions as $question) {
|
|
||||||
// Iterating over questions
|
|
||||||
|
|
||||||
foreach ($question->answer_results as $answer) {
|
|
||||||
// Iterating over question answers
|
|
||||||
|
|
||||||
if ($answer->is_correct) {
|
|
||||||
// The answer is correct
|
|
||||||
|
|
||||||
if (!empty($answer->section)) {
|
|
||||||
// Several sections for answers (expected)
|
|
||||||
|
|
||||||
// Writing questions and answers
|
|
||||||
$sheet->writeRow([$question->test_question_position, $question->name, $answer->section->name . ' - ' . $answer->value]);
|
|
||||||
} else {
|
|
||||||
// One single answer (expected)
|
|
||||||
|
|
||||||
// Writing questions and answers
|
|
||||||
$sheet->writeRow([$question->test_question_position, $question->name, $answer->value]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initializing path to the excel document file
|
|
||||||
$path = $storage . DIRECTORY_SEPARATOR . 'homework.xlsx';
|
|
||||||
|
|
||||||
// Writing the excel document file to the storage
|
|
||||||
$excel->save($path);
|
|
||||||
|
|
||||||
// Exit (success)
|
|
||||||
return [$path];
|
|
||||||
} else {
|
|
||||||
// Not initialized the test result
|
|
||||||
|
|
||||||
// Exit (fail)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
})->wait();
|
|
||||||
} else {
|
|
||||||
// Not initialized the test identifier
|
|
||||||
|
|
||||||
// Initializing the attachment identifier
|
|
||||||
$attachment = $section->result?->id;
|
|
||||||
|
|
||||||
if (!empty($attachment)) {
|
|
||||||
// Initialized the attachment identifier
|
|
||||||
|
|
||||||
// Initializing the request to the test data API
|
// Initializing the request to the test data API
|
||||||
$request = new request(
|
$request = new request(
|
||||||
'GET',
|
'GET',
|
||||||
static::ATTACHMENTS . "?attachable_id=$attachment&attachable_type=Result::Homework",
|
static::TESTS . "/$test/result",
|
||||||
[
|
[
|
||||||
'Authorization' => "Bearer $this->token"
|
'Authorization' => "Bearer $this->token"
|
||||||
]
|
]
|
||||||
|
@ -769,71 +674,168 @@ final class interneturok extends core
|
||||||
->then(function ($response) use ($homework) {
|
->then(function ($response) use ($homework) {
|
||||||
// Sended the request and received the response
|
// Sended the request and received the response
|
||||||
|
|
||||||
// Initializing attachments
|
// Initializing the test result
|
||||||
$attachments = json_decode((string) $response->getBody())?->data?->homeschool?->response?->attachments;
|
$result = json_decode((string) $response->getBody())?->data?->tests?->response?->data;
|
||||||
|
|
||||||
if (!empty($attachments)) {
|
if (!empty($result)) {
|
||||||
// Initialized attachmetns
|
// Initialized the test result
|
||||||
|
|
||||||
// Initializing paths to the homework attachments storage folder
|
// Initializing paths to the homework storage folder
|
||||||
$storage = STORAGE . DIRECTORY_SEPARATOR . 'homeworks' . DIRECTORY_SEPARATOR . $homework . DIRECTORY_SEPARATOR . 'attachments';
|
$storage = STORAGE . DIRECTORY_SEPARATOR . 'homeworks' . DIRECTORY_SEPARATOR . $homework;
|
||||||
|
|
||||||
// Initializing the homework attachments storage folder
|
// Initializing the homework storage folder
|
||||||
if (!file_exists($storage)) mkdir($storage, 0775, true);
|
if (!file_exists($storage)) mkdir($storage, 0775, true);
|
||||||
|
|
||||||
// Declaring the buffer of files
|
// Initializing the excel document
|
||||||
$files = [];
|
$excel = excel::create(['Домашнее задание']);
|
||||||
|
|
||||||
foreach ($attachments as $attachment) {
|
// Initializing the excel document sheet
|
||||||
// Iteration over attachments
|
$sheet = $excel->sheet();
|
||||||
|
|
||||||
if ($attachment->uploader_role === 'student' && $attachment->attachable_type === 'Result::Homework') {
|
// Writing settings of the excel document sheet
|
||||||
// Found the homework attachment
|
$sheet->setColWidths(['A' => 10, 'B' => 80, 'C' => 50]);
|
||||||
|
|
||||||
// Initializing path to the downloaded file
|
// Writing title
|
||||||
$path = $storage . DIRECTORY_SEPARATOR . $attachment->attach_path;
|
$sheet->writeRow(
|
||||||
|
['Номер', 'Задание', 'Ответ'],
|
||||||
|
[
|
||||||
|
'font' => [
|
||||||
|
'style' => 'bold'
|
||||||
|
],
|
||||||
|
'text-align' => 'center',
|
||||||
|
'vertical-align' => 'center',
|
||||||
|
'border' => 'thin',
|
||||||
|
'height' => 24,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
// Downloading the file
|
foreach ($result->test?->questions as $question) {
|
||||||
$this->browser->request('GET', $attachment->attach, ['sink' => $path]);
|
// Iterating over questions
|
||||||
|
|
||||||
// Writing path to the downloaded file into the buffer of files
|
foreach ($question->answer_results as $answer) {
|
||||||
$files[] = $path;
|
// Iterating over question answers
|
||||||
|
|
||||||
|
if ($answer->is_correct) {
|
||||||
|
// The answer is correct
|
||||||
|
|
||||||
|
if (!empty($answer->section)) {
|
||||||
|
// Several sections for answers (expected)
|
||||||
|
|
||||||
|
// Writing questions and answers
|
||||||
|
$sheet->writeRow([$question->test_question_position, $question->name, $answer->section->name . ' - ' . $answer->value]);
|
||||||
|
} else {
|
||||||
|
// One single answer (expected)
|
||||||
|
|
||||||
|
// Writing questions and answers
|
||||||
|
$sheet->writeRow([$question->test_question_position, $question->name, $answer->value]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initializing path to the excel document file
|
||||||
|
$path = $storage . DIRECTORY_SEPARATOR . 'homework.xlsx';
|
||||||
|
|
||||||
|
// Writing the excel document file to the storage
|
||||||
|
$excel->save($path);
|
||||||
|
|
||||||
// Exit (success)
|
// Exit (success)
|
||||||
return $files;
|
return [$path];
|
||||||
} else {
|
} else {
|
||||||
// Not initialized attachments
|
// Not initialized the test result
|
||||||
|
|
||||||
// Exit (fail)
|
// Exit (fail)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
})->wait();
|
})->wait();
|
||||||
} else {
|
} else {
|
||||||
// Not initialized the attachment identifier
|
// Not initialized the test identifier
|
||||||
|
|
||||||
// Exit (fail)
|
// Initializing the attachment identifier
|
||||||
return false;
|
$attachment = $section->result?->id;
|
||||||
|
|
||||||
|
if (!empty($attachment)) {
|
||||||
|
// Initialized the attachment identifier
|
||||||
|
|
||||||
|
// Initializing the request to the test data API
|
||||||
|
$request = new request(
|
||||||
|
'GET',
|
||||||
|
static::ATTACHMENTS . "?attachable_id=$attachment&attachable_type=Result::Homework",
|
||||||
|
[
|
||||||
|
'Authorization' => "Bearer $this->token"
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
return $this->browser->sendAsync($request)
|
||||||
|
->then(function ($response) use ($homework) {
|
||||||
|
// Sended the request and received the response
|
||||||
|
|
||||||
|
// Initializing attachments
|
||||||
|
$attachments = json_decode((string) $response->getBody())?->data?->homeschool?->response?->attachments;
|
||||||
|
|
||||||
|
if (!empty($attachments)) {
|
||||||
|
// Initialized attachmetns
|
||||||
|
|
||||||
|
// Initializing paths to the homework attachments storage folder
|
||||||
|
$storage = STORAGE . DIRECTORY_SEPARATOR . 'homeworks' . DIRECTORY_SEPARATOR . $homework . DIRECTORY_SEPARATOR . 'attachments';
|
||||||
|
|
||||||
|
// Initializing the homework attachments storage folder
|
||||||
|
if (!file_exists($storage)) mkdir($storage, 0775, true);
|
||||||
|
|
||||||
|
// Declaring the buffer of files
|
||||||
|
$files = [];
|
||||||
|
|
||||||
|
foreach ($attachments as $attachment) {
|
||||||
|
// Iteration over attachments
|
||||||
|
|
||||||
|
if ($attachment->uploader_role === 'student' && $attachment->attachable_type === 'Result::Homework') {
|
||||||
|
// Found the homework attachment
|
||||||
|
|
||||||
|
// Initializing path to the downloaded file
|
||||||
|
$path = $storage . DIRECTORY_SEPARATOR . $attachment->attach_path;
|
||||||
|
|
||||||
|
// Downloading the file
|
||||||
|
$this->browser->request('GET', $attachment->attach, ['sink' => $path]);
|
||||||
|
|
||||||
|
// Writing path to the downloaded file into the buffer of files
|
||||||
|
$files[] = $path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exit (success)
|
||||||
|
return $files;
|
||||||
|
} else {
|
||||||
|
// Not initialized attachments
|
||||||
|
|
||||||
|
// Exit (fail)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})->wait();
|
||||||
|
} else {
|
||||||
|
// Not initialized the attachment identifier
|
||||||
|
|
||||||
|
// Exit (fail)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Exit (fail)
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
function ($response) use ($homework) {
|
|
||||||
if ($response->getStatusCode() === 402) {
|
|
||||||
// Fail (received the "Payment Required" status code)
|
|
||||||
|
|
||||||
// Writing into the output buffer
|
|
||||||
echo "Не удалось скачать домашнее задание $homework потому, что не оплачен тариф\n";
|
|
||||||
|
|
||||||
// Exit (fail)
|
// Exit (fail)
|
||||||
return false;
|
return false;
|
||||||
|
},
|
||||||
|
function ($response) use ($homework) {
|
||||||
|
if ($response->getStatusCode() === 402) {
|
||||||
|
// Fail (received the "Payment Required" status code)
|
||||||
|
|
||||||
|
// Writing into the output buffer
|
||||||
|
echo "Не удалось скачать домашнее задание $homework потому, что не оплачен тариф\n";
|
||||||
|
|
||||||
|
// Exit (fail)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exit (fail)
|
// Exit (fail)
|
||||||
|
|
|
@ -206,7 +206,7 @@ final class parser extends core
|
||||||
$parser = new interneturok();
|
$parser = new interneturok();
|
||||||
|
|
||||||
// Parsing homework files
|
// Parsing homework files
|
||||||
$files = $parser->parse(subject: $subject, grade: $grade, waiting: 0);
|
$files = $parser->parse(subject: $subject, grade: $grade, waiting: 3);
|
||||||
|
|
||||||
if (!empty($files)) {
|
if (!empty($files)) {
|
||||||
// Initialized homework files
|
// Initialized homework files
|
||||||
|
|
Loading…
Reference in New Issue