Merge branch 'master' of https://git.itguild.info/ItGuild/igfs
This commit is contained in:
commit
41671c2cd1
@ -97,4 +97,20 @@ class ModuleShopRestController extends RestController
|
|||||||
$this->renderApi($res);
|
$this->renderApi($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function actionInstall(int $id): void
|
||||||
|
{
|
||||||
|
$model = $this->model->where("id", $id)->first();
|
||||||
|
|
||||||
|
header('Content-type: application/zip');
|
||||||
|
header('Content-Disposition: attachment; filename="' . $model->slug . '.igm"');
|
||||||
|
header('Content-Length: ' . filesize(ROOT_DIR . $model->path_to_archive));
|
||||||
|
|
||||||
|
// Debug::dd(filesize(ROOT_DIR . $model->path_to_archive));
|
||||||
|
readfile(ROOT_DIR . $model->path_to_archive);
|
||||||
|
|
||||||
|
|
||||||
|
$model->installations++;
|
||||||
|
$model->save();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -23,6 +23,7 @@ App::$collector->group(["prefix" => "api"], function (CgRouteCollector $router){
|
|||||||
App::$collector->group(['before' => 'bearer'], function (CgRouteCollector $router){
|
App::$collector->group(['before' => 'bearer'], function (CgRouteCollector $router){
|
||||||
App::$collector->group(["prefix" => "module_shop"], function (CgRouteCollector $router){
|
App::$collector->group(["prefix" => "module_shop"], function (CgRouteCollector $router){
|
||||||
App::$collector->get('/gb_slug', [\app\modules\module_shop\controllers\ModuleShopRestController::class, 'actionIndexGroupBySlug']);
|
App::$collector->get('/gb_slug', [\app\modules\module_shop\controllers\ModuleShopRestController::class, 'actionIndexGroupBySlug']);
|
||||||
|
App::$collector->get('/install/{id}', [\app\modules\module_shop\controllers\ModuleShopRestController::class, 'actionInstall']);
|
||||||
});
|
});
|
||||||
$router->rest("module_shop", [\app\modules\module_shop\controllers\ModuleShopRestController::class]);
|
$router->rest("module_shop", [\app\modules\module_shop\controllers\ModuleShopRestController::class]);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user