generated from mirzaev/pot
Compare commits
No commits in common. "stable" and "1.1.3" have entirely different histories.
|
@ -1,12 +1,6 @@
|
||||||
# parser_from_interneturok
|
# parser_from_interneturok
|
||||||
Chat-robot Telegram for parsing homeworks by subject name, grade and number of the week
|
Chat-robot Telegram for parsing homeworks by subject name, grade and number of the week
|
||||||
|
|
||||||
## Funny story of development
|
|
||||||
The customer of this project **refused to pay** the second half of the payment for the work and wanted to steal my code.<br>
|
|
||||||
<br>
|
|
||||||
I managed to delete all the code from the server, then i changed passwords on all **40 accounts** that were planned to be used in this chat-robot.<br>
|
|
||||||
Thus **i destroyed the entire mini-business** of this customer.
|
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
1. [PHP 8.4](https://www.php.net/releases/8.4/en.php)
|
1. [PHP 8.4](https://www.php.net/releases/8.4/en.php)
|
||||||
2. [Composer](https://getcomposer.org/) (php package manager)
|
2. [Composer](https://getcomposer.org/) (php package manager)
|
||||||
|
|
|
@ -70,17 +70,6 @@ final class interneturok extends core
|
||||||
*/
|
*/
|
||||||
public const string USER = 'https://api-gw.interneturok.ru/api/v2/homeschool/current_user';
|
public const string USER = 'https://api-gw.interneturok.ru/api/v2/homeschool/current_user';
|
||||||
|
|
||||||
/**
|
|
||||||
* TARIFFS
|
|
||||||
*
|
|
||||||
* Method: GET
|
|
||||||
* Authrorization: Bearer
|
|
||||||
*
|
|
||||||
* @var const string TARIFFS The user tariffs API URL
|
|
||||||
*/
|
|
||||||
public const string TARIFFS = 'https://api-gw.interneturok.ru/api/v2/schedules/users/current/tariffs';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SCHEDULES
|
* SCHEDULES
|
||||||
*
|
*
|
||||||
|
@ -483,32 +472,10 @@ final class interneturok extends core
|
||||||
// Initializing the user data
|
// Initializing the user data
|
||||||
$user = json_decode((string) $response->getBody())?->data?->homeschool?->response?->user;
|
$user = json_decode((string) $response->getBody())?->data?->homeschool?->response?->user;
|
||||||
|
|
||||||
if (!empty($user)) {
|
if ($user->grade + 1 === $grade) {
|
||||||
// Initialized the user data
|
// Matched the account grade with the grade
|
||||||
|
|
||||||
// Initializing the request to the user data API
|
// Initialiint the user identifier
|
||||||
$request = new request(
|
|
||||||
'GET',
|
|
||||||
static::TARIFFS,
|
|
||||||
[
|
|
||||||
'Authorization' => "Bearer $this->token"
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
return $this->browser->sendAsync($request)
|
|
||||||
->then(function ($response) use ($grade, $week, $user) {
|
|
||||||
// Sended the request and received the response
|
|
||||||
|
|
||||||
// Initializing the tariffs data
|
|
||||||
$tariffs = json_decode((string) $response->getBody())?->data?->tariffs?->response;
|
|
||||||
|
|
||||||
foreach ($tariffs as $tariff) {
|
|
||||||
// Iterating over tariffs
|
|
||||||
|
|
||||||
if ($tariff->grade === $grade) {
|
|
||||||
// Matched the tariff grade with the target grade
|
|
||||||
|
|
||||||
// Initializing the user identifier
|
|
||||||
$identifier = $user?->id;
|
$identifier = $user?->id;
|
||||||
|
|
||||||
if (!empty($identifier)) {
|
if (!empty($identifier)) {
|
||||||
|
@ -623,13 +590,8 @@ final class interneturok extends core
|
||||||
// Exit (fail)
|
// Exit (fail)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
// Exit (fail)
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
// Not initialized the user data
|
// Not matched the account grade with the grade
|
||||||
|
|
||||||
// Exit (fail)
|
// Exit (fail)
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue