57 lines
1.7 KiB
PHP
57 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace kernel\modules\module_shop_client\services;
|
|
|
|
use GuzzleHttp\Client;
|
|
use Itguild\Tables\ListJsonTable;
|
|
use kernel\services\ModuleService;
|
|
|
|
class ModuleShopClientService extends ModuleService
|
|
{
|
|
|
|
public static function getModuleShopClientInfo()
|
|
{
|
|
$client = new Client();
|
|
$token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.W10.POQZmGB7EZIayINtYhzu5r1rdgZhF9qPJpaQkl_g6pU';
|
|
$res = $client->request('GET', 'http://igfs.loc/api/module_shop/gb_slug', [
|
|
'headers' => [
|
|
'Authorization' => 'Bearer ' . $token,
|
|
]
|
|
]);
|
|
|
|
|
|
return json_decode($res->getBody()->getContents());
|
|
}
|
|
|
|
/**
|
|
* @throws \Exception
|
|
*/
|
|
// public static function getModuleShopClientTable(): ListJsonTable
|
|
// {
|
|
// $modules_info = json_decode(ModuleShopClientService::getModuleShopClientInfo());
|
|
//
|
|
// $meta = [];
|
|
// $meta['columns'] = [
|
|
// "name" => "Название",
|
|
// "author" => "Автор",
|
|
// "version" => "Версия",
|
|
// "description" => "Описание",
|
|
// "installations" => 'Установки',
|
|
// "views" => 'Просмотры'
|
|
// ];
|
|
// $meta['params'] = ["class" => "table table-bordered"];
|
|
// $meta['perPage'] = 3;
|
|
// $meta['baseUrl'] = "/admin/module_shop_client";
|
|
// $meta['currentPage'] = 1;
|
|
// $meta['total'] = count($modules_info);
|
|
//
|
|
// $info_to_table['meta'] = $meta;
|
|
// $info_to_table['data'] = $modules_info;
|
|
//
|
|
// $table = new ListJsonTable(json_encode($info_to_table, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
|
|
//
|
|
// $table->create();
|
|
// return $table;
|
|
// }
|
|
|
|
} |