some
This commit is contained in:
parent
c23b84bcea
commit
04bd134e3e
@ -10,14 +10,12 @@ use kernel\Flash;
|
||||
use kernel\helpers\Debug;
|
||||
use kernel\helpers\Files;
|
||||
use kernel\helpers\RESTClient;
|
||||
use kernel\helpers\SMTP;
|
||||
use kernel\Mailing;
|
||||
use kernel\modules\module_shop_client\services\ModuleShopClientService;
|
||||
use kernel\Request;
|
||||
use kernel\services\AdminThemeService;
|
||||
use kernel\services\KernelService;
|
||||
use kernel\services\ModuleService;
|
||||
use kernel\services\ModuleShopService;
|
||||
use kernel\services\TokenService;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
|
||||
class ModuleShopClientController extends AdminController
|
||||
@ -26,6 +24,7 @@ class ModuleShopClientController extends AdminController
|
||||
protected Client $client;
|
||||
protected ModuleService $moduleService;
|
||||
protected KernelService $kernelService;
|
||||
protected ModuleShopClientService $moduleShopClientService;
|
||||
|
||||
protected function init(): void
|
||||
{
|
||||
@ -35,6 +34,7 @@ class ModuleShopClientController extends AdminController
|
||||
$this->client = new Client();
|
||||
$this->moduleService = new ModuleService();
|
||||
$this->kernelService = new KernelService();
|
||||
$this->moduleShopClientService = new ModuleShopClientService();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -49,6 +49,8 @@ class ModuleShopClientController extends AdminController
|
||||
$filters = $request->get();
|
||||
|
||||
$per_page = 8;
|
||||
|
||||
// $this->moduleShopClientService->getModulesInfo($_ENV['MODULE_SHOP_URL'] . '/api/module_shop/gb_slug')
|
||||
$modules = RESTClient::request($_ENV['MODULE_SHOP_URL'] . '/api/module_shop/gb_slug');
|
||||
$modules = json_decode($modules->getBody()->getContents(), true);
|
||||
if ($filters) {
|
||||
|
@ -6,11 +6,17 @@ use kernel\helpers\RESTClient;
|
||||
|
||||
class ModuleShopClientService
|
||||
{
|
||||
public function getModulesInfo(string $url)
|
||||
public function getModulesInfo(string $url, int $perPage, int $pageNumber): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
// $modules_info = RESTClient::request($url);
|
||||
// $modules_info = json_decode($modules_info->getBody()->getContents(), true);
|
||||
// $module_count = count($modules_info);
|
||||
// $modules_info = array_slice($modules_info, $per_page * ($page_number - 1), $per_page);
|
||||
$modules_info = RESTClient::request($url);
|
||||
$modules_info = json_decode($modules_info->getBody()->getContents(), true);
|
||||
return array_slice($modules_info, $perPage * ($pageNumber - 1), $perPage);
|
||||
}
|
||||
|
||||
public function getModulesInfoWithFilters(string $url, int $perPage, int $pageNumber): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
$modules_info = RESTClient::request($url);
|
||||
$modules_info = json_decode($modules_info->getBody()->getContents(), true);
|
||||
return array_slice($modules_info, $perPage * ($pageNumber - 1), $perPage);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user