feat: Refactor MainController and related tasks to follow Porto architecture
- Moved logic from MainController to dedicated action and task classes. - Introduced GetMainPageDataAction, GetEducationsDataTask, GetRecentPostsTask, GetUpcomingEventsTask, and GetPageDataTask for better separation of concerns. - Updated routes to use the new MainController from the Main container. - Deprecated the old MainController with a clear message for future removal. - Updated caching mechanisms to use the new task classes. - Adjusted environment variable access to use config() instead of env() for better practice. - Added new MainPageResource for structured data response. - Updated .gitignore to exclude QWEN.md. - Added Jenkins service to docker-compose for CI/CD integration.
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Main\Actions;
|
||||
|
||||
use App\Containers\Main\Tasks\GetEducationsDataTask;
|
||||
use App\Containers\Main\Tasks\GetRecentPostsTask;
|
||||
use App\Containers\Main\Tasks\GetUpcomingEventsTask;
|
||||
use App\Containers\Main\Tasks\GetPageDataTask;
|
||||
|
||||
class GetMainPageDataAction
|
||||
{
|
||||
public function __construct(
|
||||
private readonly GetEducationsDataTask $getEducationsDataTask,
|
||||
private readonly GetRecentPostsTask $getRecentPostsTask,
|
||||
private readonly GetUpcomingEventsTask $getUpcomingEventsTask,
|
||||
private readonly GetPageDataTask $getPageDataTask,
|
||||
) {}
|
||||
|
||||
public function run(): array
|
||||
{
|
||||
$educations = $this->getEducationsDataTask->run();
|
||||
$posts = $this->getRecentPostsTask->run();
|
||||
$events = $this->getUpcomingEventsTask->run();
|
||||
$page = $this->getPageDataTask->run();
|
||||
|
||||
$seo = $page->seo ?? null;
|
||||
|
||||
return [
|
||||
'educations' => $educations,
|
||||
'posts' => $posts,
|
||||
'events' => $events,
|
||||
'seo' => $seo
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Main\Tasks;
|
||||
|
||||
use App\Containers\AdditionalEducation\Models\AdditionalEducation;
|
||||
use App\Containers\AdditionalEducation\Models\AdditionalEducationCategory;
|
||||
use App\Containers\Education\Models\AdmissionCampaign;
|
||||
use App\Ship\Enums\Education\LevelEducational;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class GetEducationsDataTask
|
||||
{
|
||||
public function run(): array
|
||||
{
|
||||
return Cache::remember('educations_data', now()->addHour(), function () {
|
||||
return $this->getEducationsData();
|
||||
});
|
||||
}
|
||||
|
||||
private function getEducationsData(): array
|
||||
{
|
||||
return [
|
||||
'admission_campaign' => $this->getAdmissionCampaign(),
|
||||
'additional_education' => [
|
||||
'educations_count' => AdditionalEducation::where('is_active', true)->count(),
|
||||
'categories_count' => AdditionalEducationCategory::where('is_active', true)->count(),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
private function getAdmissionCampaign(): array
|
||||
{
|
||||
$info = AdmissionCampaign::first()->info ?? [];
|
||||
|
||||
return collect($info)->reduce(function ($carry, $a) {
|
||||
$lvl = LevelEducational::from((int)$a['edu_name'])->name;
|
||||
$carry[$lvl] = [
|
||||
'total_programs' => $a['total_programs'],
|
||||
'places' => [
|
||||
'och_count' => $a['och_count'],
|
||||
'zaoch_count' => $a['zaoch_count'],
|
||||
'budget_places' => $a['budget_places'],
|
||||
'non_budget_places' => $a['non_budget_places']
|
||||
],
|
||||
];
|
||||
return $carry;
|
||||
}, []);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Main\Tasks;
|
||||
|
||||
use App\Containers\AppStructure\Models\Page;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class GetPageDataTask
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$path = route('index', null, false);
|
||||
|
||||
return Cache::remember('page_' . $path, now()->addHour(), function () use ($path) {
|
||||
return Page::where('path', $path)->first();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Main\Tasks;
|
||||
|
||||
use App\Containers\Article\Enums\PostStatus;
|
||||
use App\Containers\Article\Models\Post;
|
||||
use App\Containers\Widget\UI\API\Transformers\PostThumbnailResource;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class GetRecentPostsTask
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
return Cache::remember('posts_recent', now()->addHour(), function () {
|
||||
return $this->getRecentPosts();
|
||||
});
|
||||
}
|
||||
|
||||
private function getRecentPosts()
|
||||
{
|
||||
return PostThumbnailResource::collection(
|
||||
Post::select('title', 'slug', 'authors', 'preview_text', 'category_id', 'preview', 'search_data', 'publish_at', 'created_at')
|
||||
->with('category')
|
||||
->where('publish_at', '<', Carbon::now())
|
||||
->where('status', '=', PostStatus::PUBLISHED)
|
||||
->orderBy('publish_at', 'desc')
|
||||
->limit(3)
|
||||
->get()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Main\Tasks;
|
||||
|
||||
use App\Containers\Event\Models\Event;
|
||||
use App\Containers\Event\UI\WEB\Transformers\EventThumbnailResource;
|
||||
use DateTime;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class GetUpcomingEventsTask
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
return Cache::remember('upcoming_events', now()->addHour(), function () {
|
||||
return $this->getUpcomingEvents();
|
||||
});
|
||||
}
|
||||
|
||||
private function getUpcomingEvents()
|
||||
{
|
||||
$event_date_start = (new DateTime())->format('Y-m-d');
|
||||
|
||||
return EventThumbnailResource::collection(
|
||||
Event::select('title', 'slug', 'event_date_start', 'event_time_start' , 'address', 'is_online', 'category_id')
|
||||
->where('event_date_start', '>=', $event_date_start)
|
||||
->orderBy('event_date_start', 'asc')
|
||||
->limit(3)
|
||||
->get()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Main\UI\WEB\Controllers;
|
||||
|
||||
use App\Containers\Main\Actions\GetMainPageDataAction;
|
||||
use App\Ship\Controllers\Controller;
|
||||
use Inertia\Inertia;
|
||||
|
||||
class MainController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private readonly GetMainPageDataAction $getMainPageDataAction
|
||||
) {}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data = $this->getMainPageDataAction->run();
|
||||
|
||||
return Inertia::render('Main', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Main\UI\WEB\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class MainPageResource extends JsonResource
|
||||
{
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'educations' => $this->educations,
|
||||
'posts' => $this->posts,
|
||||
'events' => $this->events,
|
||||
'seo' => $this->seo,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -2,110 +2,16 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Containers\AdditionalEducation\Models\AdditionalEducation;
|
||||
use App\Containers\AdditionalEducation\Models\AdditionalEducationCategory;
|
||||
use App\Containers\AppStructure\Models\Page;
|
||||
use App\Containers\Article\Enums\PostStatus;
|
||||
use App\Containers\Article\Models\Post;
|
||||
use App\Containers\Education\Models\AdmissionCampaign;
|
||||
use App\Containers\Event\Models\Event;
|
||||
use App\Containers\Event\UI\WEB\Transformers\EventThumbnailResource;
|
||||
use App\Containers\Widget\UI\API\Transformers\PostThumbnailResource;
|
||||
use App\Ship\Enums\Education\LevelEducational;
|
||||
use Carbon\Carbon;
|
||||
use DateTime;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Inertia\Inertia;
|
||||
|
||||
/**
|
||||
* @deprecated Use App\Containers\Main\UI\WEB\Controllers\MainController instead
|
||||
* This controller is deprecated and will be removed in future versions.
|
||||
* All logic has been moved to the Main container following Porto architecture.
|
||||
*/
|
||||
class MainController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
// Кешируем данные на 60 минут (можно изменить время по необходимости)
|
||||
// $admissionCampaign = Cache::remember('admission_campaign', now()->addHour(), function () {
|
||||
// return $this->getAdmissionCampaign();
|
||||
// });
|
||||
|
||||
// $educations = Cache::remember('educations_data', now()->addHour(), function () {
|
||||
// return $this->getEducationsData();
|
||||
// });
|
||||
|
||||
$educations = $this->getEducationsData();
|
||||
|
||||
$posts = Cache::remember('posts_recent', now()->addHour(), function () {
|
||||
return $this->getRecentPosts();
|
||||
});
|
||||
|
||||
// $events = Cache::remember('upcoming_events', now()->addHour(), function () {
|
||||
// return $this->getUpcomingEvents();
|
||||
// });
|
||||
|
||||
$events = $this->getUpcomingEvents();
|
||||
|
||||
$path = route('index', null, false);
|
||||
$page = Cache::remember('page_' . $path, now()->addHour(), function () use ($path) {
|
||||
return Page::where('path', $path)->first();
|
||||
});
|
||||
|
||||
$seo = $page->seo ?? null;
|
||||
|
||||
return Inertia::render('Main', compact('posts', 'events', 'educations', 'seo'));
|
||||
}
|
||||
|
||||
private function getAdmissionCampaign()
|
||||
{
|
||||
$info = AdmissionCampaign::first()->info ?? [];
|
||||
|
||||
return collect($info)->reduce(function ($carry, $a) {
|
||||
$lvl = LevelEducational::from((int)$a['edu_name'])->name;
|
||||
$carry[$lvl] = [
|
||||
'total_programs' => $a['total_programs'],
|
||||
'places' => [
|
||||
'och_count' => $a['och_count'],
|
||||
'zaoch_count' => $a['zaoch_count'],
|
||||
'budget_places' => $a['budget_places'],
|
||||
'non_budget_places' => $a['non_budget_places']
|
||||
],
|
||||
];
|
||||
return $carry;
|
||||
}, []);
|
||||
}
|
||||
|
||||
private function getEducationsData()
|
||||
{
|
||||
return [
|
||||
'admission_campaign' => $this->getAdmissionCampaign(),
|
||||
'additional_education' => [
|
||||
'educations_count' => AdditionalEducation::where('is_active', true)->count(),
|
||||
'categories_count' => AdditionalEducationCategory::where('is_active', true)->count(),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
private function getRecentPosts()
|
||||
{
|
||||
return PostThumbnailResource::collection(
|
||||
Post::select('title', 'slug', 'authors', 'preview_text', 'category_id', 'preview', 'search_data', 'publish_at', 'created_at')
|
||||
->with('category')
|
||||
->where('publish_at', '<', Carbon::now())
|
||||
->where('status', '=', PostStatus::PUBLISHED)
|
||||
->orderBy('publish_at', 'desc')
|
||||
->limit(3)
|
||||
->get()
|
||||
);
|
||||
}
|
||||
|
||||
private function getUpcomingEvents()
|
||||
{
|
||||
$event_date_start = (new DateTime())->format('Y-m-d');
|
||||
|
||||
return EventThumbnailResource::collection(
|
||||
Event::select('title', 'slug', 'event_date_start', 'event_time_start' , 'address', 'is_online', 'category_id')
|
||||
->where('event_date_start', '>=', $event_date_start)
|
||||
->orderBy('event_date_start', 'asc')
|
||||
->limit(3)
|
||||
->get()
|
||||
);
|
||||
// This method is deprecated. Use App\Containers\Main\UI\WEB\Controllers\MainController instead.
|
||||
abort(500, 'MainController in Http namespace is deprecated. Use the containerized version.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class CreateVkPostJob implements ShouldQueue
|
||||
$this->videos = $videos;
|
||||
$this->documents = $documents;
|
||||
$this->publish_date = $publish_date;
|
||||
$this->public_id = env('PUBLIC_ID');
|
||||
$this->public_id = config('services.vk.public_id');
|
||||
}
|
||||
|
||||
public function handle()
|
||||
@@ -382,7 +382,7 @@ class CreateVkPostJob implements ShouldQueue
|
||||
// Добавим проверку
|
||||
if(!isset($album['id'])) return [];
|
||||
|
||||
$uploadServer = (new VkAlbumService($vk))->getServerForUploadImages($album['id'], env('PUBLIC_ID'));
|
||||
$uploadServer = (new VkAlbumService($vk))->getServerForUploadImages($album['id'], config('PUBLIC_ID'));
|
||||
foreach (array_chunk($images, 4) as $images_slice) {
|
||||
$images_data = (new VkAlbumService($vk))->uploadImagesToUploadServer($uploadServer['upload_url'], $images_slice);
|
||||
(new VkAlbumService($vk))->saveImagesToUploadServer(
|
||||
|
||||
@@ -32,13 +32,13 @@ class ImportApiDataPost implements ShouldQueue
|
||||
{
|
||||
try {
|
||||
// Получаем первую страницу данных
|
||||
$response = Http::get(env('TRANSFER_PROXY_URL') . '/api/posts')->object();
|
||||
$response = Http::get(config('TRANSFER_PROXY_URL') . '/api/posts')->object();
|
||||
$last_page = $response->last_page;
|
||||
Log::info('Last page: ' . $last_page);
|
||||
|
||||
// Проходим по всем страницам
|
||||
for ($page = 1; $page <= $last_page; $page++) {
|
||||
$response = Http::get(env('TRANSFER_PROXY_URL') . "/api/posts?page=$page")->object();
|
||||
$response = Http::get(config('TRANSFER_PROXY_URL') . "/api/posts?page=$page")->object();
|
||||
$results = $response->data;
|
||||
|
||||
// Обрабатываем каждую запись
|
||||
|
||||
@@ -41,7 +41,7 @@ class UpdateVkPostJob implements ShouldQueue
|
||||
$this->videos = $videos;
|
||||
$this->documents = $documents;
|
||||
$this->publish_date = $publish_date;
|
||||
$this->public_id = env('PUBLIC_ID');
|
||||
$this->public_id = config('services.vk.public_id');
|
||||
}
|
||||
|
||||
public function handle()
|
||||
@@ -324,7 +324,7 @@ class UpdateVkPostJob implements ShouldQueue
|
||||
$vk = new VKApiClient();
|
||||
|
||||
$album = (new VkAlbumService($vk))->createAlbum($title);
|
||||
$uploadServer = (new VkAlbumService($vk))->getServerForUploadImages($album['id'], env('PUBLIC_ID'));
|
||||
$uploadServer = (new VkAlbumService($vk))->getServerForUploadImages($album['id'], config('PUBLIC_ID'));
|
||||
foreach (array_chunk($images, 4) as $images_slice) {
|
||||
$images_data = (new VkAlbumService($vk))->uploadImagesToUploadServer($uploadServer['upload_url'], $images_slice);
|
||||
(new VkAlbumService($vk))->saveImagesToUploadServer(
|
||||
|
||||
@@ -9,7 +9,7 @@ abstract class AbstractCacheService
|
||||
public function clearCacheByPrefix(string $prefix): void
|
||||
{
|
||||
// Получаем префикс из .env
|
||||
$redisPrefix = env('REDIS_PREFIX', 'ntspi');
|
||||
$redisPrefix = config('database.redis.options.prefix', 'ntspi');
|
||||
|
||||
// Получаем ключи, соответствующие префиксу
|
||||
$keys = Redis::keys($prefix);
|
||||
|
||||
@@ -21,8 +21,8 @@ class VkAlbumService
|
||||
public function __construct(VKApiClient $vk) {
|
||||
$this->vk = $vk;
|
||||
$this->vkAuthService = new VkAuthService();
|
||||
$this->serviceToken = env('SERVICE_ACCESS_VK_KEY');
|
||||
$this->publicId = env('PUBLIC_ID');
|
||||
$this->serviceToken = config('services.vk.service_key');
|
||||
$this->publicId = config('services.vk.public_id');
|
||||
}
|
||||
|
||||
public function getServerForUploadImages($album_id, $group_id)
|
||||
@@ -109,7 +109,7 @@ class VkAlbumService
|
||||
$postFields = [
|
||||
'album_id' => $albumId,
|
||||
'server' => $server,
|
||||
'group_id' => env('PUBLIC_ID'),
|
||||
'group_id' => config('services.vk.public_id'),
|
||||
'photos_list' => $photosList, // Преобразуем массив в JSON-строку
|
||||
'hash' => $hash,
|
||||
'access_token' => $this->vkAuthService->getToken()->access_token,
|
||||
|
||||
@@ -33,30 +33,6 @@ class VkAuthService
|
||||
}
|
||||
}
|
||||
|
||||
// public function redirectToProvider()
|
||||
// {
|
||||
// $state = bin2hex(random_bytes(16)); // Генерация случайной строки состояния
|
||||
// session(['vk_state' => $state]); //
|
||||
//
|
||||
// $code_verifier = $this->generateCodeVerifier();
|
||||
// $code_challenge = $this->generateCodeChallenge($code_verifier);
|
||||
//
|
||||
// session(['vk_code_verifier' => $code_verifier]);
|
||||
//
|
||||
//
|
||||
// $url = 'https://id.vk.ru/authorize?' . http_build_query([
|
||||
// 'response_type' => 'code',
|
||||
// 'client_id' => env('VK_APP_ID'),
|
||||
// 'redirect_uri' => env('VK_REDIRECT_URI'),
|
||||
// 'state' => $state,
|
||||
// 'scope' => 'photos wall video docs',
|
||||
// 'code_challenge' => $code_challenge,
|
||||
// 'code_challenge_method' => 's256',
|
||||
// ]);
|
||||
//
|
||||
// return redirect($url);
|
||||
// }
|
||||
|
||||
public function redirectToProvider()
|
||||
{
|
||||
$state = bin2hex(random_bytes(16)); // Генерирует случайную строку состояния (state) для защиты от CSRF-атак.
|
||||
@@ -69,8 +45,8 @@ class VkAuthService
|
||||
|
||||
$url = 'https://id.vk.ru/authorize?' . http_build_query([ // Формирует URL для перенаправления на страницу авторизации VK ID с параметрами:
|
||||
'response_type' => 'code', // Указывает, что нужен код авторизации.
|
||||
'client_id' => env('VK_APP_ID'), // ID приложения VK из переменных окружения.
|
||||
'redirect_uri' => env('VK_REDIRECT_URI'), // URI для перенаправления после авторизации.
|
||||
'client_id' => config('services.vk.app_id'), // ID приложения VK из переменных окружения.
|
||||
'redirect_uri' => config('services.vk.redirect_uri'), // URI для перенаправления после авторизации.
|
||||
'state' => $state, // Передает строку состояния для проверки.
|
||||
'scope' => 'photos wall video docs', // Запрашивает доступ к фото, стене, видео и документам.
|
||||
'code_challenge' => $code_challenge, // Передает code_challenge для PKCE.
|
||||
@@ -115,9 +91,9 @@ class VkAuthService
|
||||
return Http::asForm()->post('https://id.vk.ru/oauth2/auth', [
|
||||
'grant_type' => 'authorization_code',
|
||||
'code_verifier' => $codeVerifier,
|
||||
'redirect_uri' => env('VK_REDIRECT_URI_AFTER_AUTH'),
|
||||
'redirect_uri' => config('services.vk.'),
|
||||
'code' => $request->code,
|
||||
'client_id' => env('VK_APP_ID'),
|
||||
'client_id' => config('services.vk.app_id'),
|
||||
'device_id' => $request->device_id,
|
||||
'state' => $request->state,
|
||||
'scope' => 'photos wall video docs',
|
||||
@@ -129,7 +105,7 @@ class VkAuthService
|
||||
$response = Http::asForm()->post('https://id.vk.ru/oauth2/auth', [
|
||||
'grant_type' => 'refresh_token',
|
||||
'refresh_token' => $refresh_token,
|
||||
'client_id' => env('VK_APP_ID'),
|
||||
'client_id' => config('services.vk.app_id'),
|
||||
'device_id' => $device_id,
|
||||
'state' => $state,
|
||||
'scope' => 'photos wall video docs',
|
||||
|
||||
@@ -19,7 +19,7 @@ class VkService
|
||||
$vk = new VKApiClient();
|
||||
$this->wallService = new VkWallService($vk);
|
||||
$this->albumService = new VkAlbumService($vk);
|
||||
$this->public_id = env('PUBLIC_ID');
|
||||
$this->public_id = config('services.vk.public_id');
|
||||
$this->vkAuthService = new VkAuthService();
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ class VkService
|
||||
public function createAlbum(string $title, $images)
|
||||
{
|
||||
$album = $this->albumService->createAlbum($title);
|
||||
$uploadServer = $this->albumService->getServerForUploadImages($album['id'], env('PUBLIC_ID'));
|
||||
$uploadServer = $this->albumService->getServerForUploadImages($album['id'], config('services.vk.public_id'));
|
||||
foreach (array_chunk($images, 4) as $images_slice) {
|
||||
$images_data = $this->albumService->uploadImagesToUploadServer($uploadServer['upload_url'], $images_slice);
|
||||
$this->albumService->saveImagesToUploadServer(
|
||||
@@ -142,7 +142,7 @@ class VkService
|
||||
return $baseUrl . $img;
|
||||
}, $images);
|
||||
|
||||
$photos = $this->uploadWallPhotos($imagePaths, env('PUBLIC_ID'));
|
||||
$photos = $this->uploadWallPhotos($imagePaths, config('services.vk.public_id'));
|
||||
|
||||
return implode(',', array_map(function($photo) {
|
||||
return "photo{$photo['owner_id']}_{$photo['id']}";
|
||||
@@ -158,7 +158,7 @@ class VkService
|
||||
$videoPaths = array_map(function($vid) use ($baseUrl) {
|
||||
return $baseUrl . $vid;
|
||||
}, $videos);
|
||||
return $this->uploadVideos($videoPaths, env('PUBLIC_ID')); // Возвращает массив, например: ['video123_456', 'video789_012']
|
||||
return $this->uploadVideos($videoPaths, config('services.vk.public_id')); // Возвращает массив, например: ['video123_456', 'video789_012']
|
||||
}
|
||||
|
||||
private function uploadVideos(array $videoPaths, ?int $groupId = null): array
|
||||
|
||||
@@ -20,10 +20,10 @@ class VkWallService
|
||||
|
||||
public function __construct(VKApiClient $vk) {
|
||||
$this->vk = $vk;
|
||||
$this->wallToken = env('WALL_ACCESS_VK_TOKEN');
|
||||
$this->serviceToken = env('SERVICE_ACCESS_VK_KEY');
|
||||
$this->publicId = env('PUBLIC_ID');
|
||||
$this->publicDomain = env('PUBLIC_DOMAIN');
|
||||
$this->wallToken = config('services.vk.wall_token');
|
||||
$this->serviceToken = config('services.vk.service_key');
|
||||
$this->publicId = config('services.vk.public_id');
|
||||
$this->publicDomain = config('services.vk.public_id');
|
||||
$this->vkAuthService = new VkAuthService();
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ class VkWallService
|
||||
|
||||
public function generateAttachmentsParams(string $attachmentType, int $attachmentId)
|
||||
{
|
||||
$pubic_id = env('PUBLIC_ID');
|
||||
$pubic_id = config('services.vk.public_id');
|
||||
switch ($attachmentType) {
|
||||
case 'album': {
|
||||
return "album-{$pubic_id}_{$attachmentId}";
|
||||
|
||||
@@ -28,7 +28,7 @@ class AdmissionPlanService
|
||||
try {
|
||||
$response = $this->callAPI(
|
||||
"https://db-nica.ru/api/v1/campaigns",
|
||||
env('VICON_TOKEN')
|
||||
config('services.vicon.token')
|
||||
);
|
||||
if (!is_array($response)) {
|
||||
Log::warning('Unexpected response type in getCampaigns', [
|
||||
@@ -52,7 +52,7 @@ class AdmissionPlanService
|
||||
try {
|
||||
$response = $this->callAPI(
|
||||
"https://db-nica.ru/api/v1/planPriema/$campaign_levels_code",
|
||||
env('VICON_TOKEN')
|
||||
config('services.vicon.token')
|
||||
);
|
||||
|
||||
if (!is_object($response)) {
|
||||
|
||||
@@ -40,31 +40,31 @@ class DirectionStudyService
|
||||
|
||||
public function getNaprs(int $edu_level): object
|
||||
{
|
||||
$data = $this->callAPI("https://db-nica.ru/api/v1/naprs?perPage=200&filter_edu_level=$edu_level", env('VICON_TOKEN'));
|
||||
$data = $this->callAPI("https://db-nica.ru/api/v1/naprs?perPage=200&filter_edu_level=$edu_level", config('services.vicon.token'));
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getNapr(string $uuid): object
|
||||
{
|
||||
$data = $this->callAPI("https://db-nica.ru/api/v1/napr/$uuid", env('VICON_TOKEN'));
|
||||
$data = $this->callAPI("https://db-nica.ru/api/v1/napr/$uuid", config('services.vicon.token'));
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getPrograms(int $edu_level): object
|
||||
{
|
||||
$data = $this->callAPI("https://db-nica.ru/api/v1/programs?filter_edu_level=$edu_level&perPage=200", env('VICON_TOKEN'));
|
||||
$data = $this->callAPI("https://db-nica.ru/api/v1/programs?filter_edu_level=$edu_level&perPage=200", config('services.vicon.token'));
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getProgram(string $uuid): object
|
||||
{
|
||||
$data = $this->callAPI("https://db-nica.ru/api/v1/program/$uuid", env('VICON_TOKEN'));
|
||||
$data = $this->callAPI("https://db-nica.ru/api/v1/program/$uuid", config('services.vicon.token'));
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getProgramDocs(string $uuid): object
|
||||
{
|
||||
$data = $this->callAPI("https://db-nica.ru/api/v1/program/$uuid/edu-docs?perPage=200", env('VICON_TOKEN'));
|
||||
$data = $this->callAPI("https://db-nica.ru/api/v1/program/$uuid/edu-docs?perPage=200", config('services.vicon.token'));
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,13 +27,13 @@ class EducationalProgramService
|
||||
|
||||
public function getPrograms(int $edu_level) : object
|
||||
{
|
||||
$data = $this->callAPI("https://db-nica.ru/api/v1/programs?filter_edu_level=$edu_level&perPage=200", env('VICON_TOKEN'));
|
||||
$data = $this->callAPI("https://db-nica.ru/api/v1/programs?filter_edu_level=$edu_level&perPage=200", config('services.vicon.token'));
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getProgram(string $uuid) : object
|
||||
{
|
||||
$data = $this->callAPI("https://db-nica.ru/api/v1/program/$uuid", env('VICON_TOKEN'));
|
||||
$data = $this->callAPI("https://db-nica.ru/api/v1/program/$uuid", config('services.vicon.token'));
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user