install modulu from shop

This commit is contained in:
Билай Станислав 2024-11-08 14:47:59 +03:00
parent 9a152885d8
commit 6cf35d5638

View File

@ -34,7 +34,7 @@ class ModuleShopClientController extends AdminController
$per_page = 8;
$token = $_ENV['MODULE_SHOP_TOKEN'];
$modules_info = $this->client->request('GET', $_ENV['MODULE_SHOP_URL'] . '/module_shop/gb_slug', [
$modules_info = $this->client->request('GET', $_ENV['MODULE_SHOP_URL'] . '/api/module_shop/gb_slug', [
'headers' => [
'Authorization' => 'Bearer ' . $token,
]
@ -56,8 +56,8 @@ class ModuleShopClientController extends AdminController
*/
public function actionView(int $id): void
{
$token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.W10.POQZmGB7EZIayINtYhzu5r1rdgZhF9qPJpaQkl_g6pU';
$module_info = $this->client->request('GET', 'http://igfs.loc/api/module_shop/' . $id, [
$token = $_ENV['MODULE_SHOP_TOKEN'];
$module_info = $this->client->request('GET', $_ENV['MODULE_SHOP_URL'] . '/api/module_shop/' . $id, [
'headers' => [
'Authorization' => 'Bearer ' . $token,
]
@ -69,19 +69,38 @@ class ModuleShopClientController extends AdminController
/**
* @throws GuzzleException
*/
public function actionInstall(): void
#[NoReturn] public function actionInstall(): void
{
$request = new Request();
$id = $request->get("id");
$token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.W10.POQZmGB7EZIayINtYhzu5r1rdgZhF9qPJpaQkl_g6pU';
$module_info = $this->client->request('GET', 'http://igfs.loc/api/module_shop/' . $id, [
$id = $request->get('id');
$token = $_ENV['MODULE_SHOP_TOKEN'];
Debug::prn(123);
$module = $this->client->request('GET', $_ENV['MODULE_SHOP_URL'] . '/api/module_shop/install/' . $id, [
'headers' => [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/itguild',
'sink' => RESOURCES_DIR . '/tmp/ms/some.itguild'
]
]);
$module_info = json_decode($module_info->getBody()->getContents(), true);
Debug::dd($module_info['path_to_archive']);
$this->moduleService->installModule($module_info['path_to_archive']);
$module = json_decode($module->getBody()->getContents(), true);
// Debug::dd(123);
$this->moduleService->installModule(RESOURCES_DIR . '/tmp/ms/some.igm');
$this->redirect('/admin/module_shop_client', 302);
// $request = new Request();
// $id = $request->get("id");
// $token = $_ENV['MODULE_SHOP_TOKEN'];
// $module_info = $this->client->request('GET', $_ENV['MODULE_SHOP_URL'] . '/api/module_shop/' . $id, [
// 'headers' => [
// 'Authorization' => 'Bearer ' . $token,
// ]
// ]);
// $module_info = json_decode($module_info->getBody()->getContents(), true);
// Debug::dd($_ENV['MODULE_SHOP_URL'] . $module_info['path_to_archive']);
// $this->moduleService->installModule(RESOURCES_DIR . '/tmp/ms/some.igm');
// $this->redirect('/admin/module_shop_client', 302);
}