|
@@ -1,15 +1,17 @@
|
|
|
<?php
|
|
<?php
|
|
|
|
|
+
|
|
|
declare(strict_types=1);
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace SixShop\System\Command;
|
|
namespace SixShop\System\Command;
|
|
|
|
|
|
|
|
-use function SixShop\Core\extension_path;
|
|
|
|
|
use think\console\Command;
|
|
use think\console\Command;
|
|
|
use think\console\Input;
|
|
use think\console\Input;
|
|
|
use think\console\input\Argument;
|
|
use think\console\input\Argument;
|
|
|
use think\console\input\Option;
|
|
use think\console\input\Option;
|
|
|
use think\console\Output;
|
|
use think\console\Output;
|
|
|
|
|
|
|
|
|
|
+use function SixShop\Core\extension_path;
|
|
|
|
|
+
|
|
|
class ExtensionScaffoldMakeCommand extends Command
|
|
class ExtensionScaffoldMakeCommand extends Command
|
|
|
{
|
|
{
|
|
|
protected function configure(): void
|
|
protected function configure(): void
|
|
@@ -99,8 +101,12 @@ class ExtensionScaffoldMakeCommand extends Command
|
|
|
$planFiles[] = "$base/src/Controller/Admin/ItemController.php";
|
|
$planFiles[] = "$base/src/Controller/Admin/ItemController.php";
|
|
|
$planFiles[] = "$base/src/Controller/Admin/UploadController.php";
|
|
$planFiles[] = "$base/src/Controller/Admin/UploadController.php";
|
|
|
}
|
|
}
|
|
|
- if ($withService) $planFiles[] = "$base/src/Service/{$studly}Service.php";
|
|
|
|
|
- if ($withEntity) $planFiles[] = "$base/src/Entity/{$studly}.php";
|
|
|
|
|
|
|
+ if ($withService) {
|
|
|
|
|
+ $planFiles[] = "$base/src/Service/{$studly}Service.php";
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($withEntity) {
|
|
|
|
|
+ $planFiles[] = "$base/src/Entity/{$studly}.php";
|
|
|
|
|
+ }
|
|
|
if ($withMigration) {
|
|
if ($withMigration) {
|
|
|
$planFiles[] = "$base/config/install.sql";
|
|
$planFiles[] = "$base/config/install.sql";
|
|
|
$planFiles[] = "$base/config/uninstall.sql";
|
|
$planFiles[] = "$base/config/uninstall.sql";
|
|
@@ -118,7 +124,9 @@ class ExtensionScaffoldMakeCommand extends Command
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- foreach ($dirs as $d) @mkdir($d, 0777, true);
|
|
|
|
|
|
|
+ foreach ($dirs as $d) {
|
|
|
|
|
+ @mkdir($d, 0777, true);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// info.php
|
|
// info.php
|
|
|
// 生成完整 info.php(参考 guimi)
|
|
// 生成完整 info.php(参考 guimi)
|
|
@@ -256,8 +264,12 @@ Route::get('dashboard/stats', [DashboardController::class, 'stats'])->middleware
|
|
|
// 通用上传
|
|
// 通用上传
|
|
|
Route::post('upload', [UploadController::class, 'handle'])->middleware(['auth']);
|
|
Route::post('upload', [UploadController::class, 'handle'])->middleware(['auth']);
|
|
|
PHP, $module, $module, $module);
|
|
PHP, $module, $module, $module);
|
|
|
- if ($withApi) file_put_contents("$base/route/api.php", $apiRoute);
|
|
|
|
|
- if ($withAdmin) file_put_contents("$base/route/admin.php", $adminRoute);
|
|
|
|
|
|
|
+ if ($withApi) {
|
|
|
|
|
+ file_put_contents("$base/route/api.php", $apiRoute);
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($withAdmin) {
|
|
|
|
|
+ file_put_contents("$base/route/admin.php", $adminRoute);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 控制器样板
|
|
// 控制器样板
|
|
|
if ($withApi) {
|
|
if ($withApi) {
|
|
@@ -529,7 +541,9 @@ TS, $module, $module);
|
|
|
|
|
|
|
|
// 提示
|
|
// 提示
|
|
|
$output->writeln("<info>扩展骨架已生成:</info> $base");
|
|
$output->writeln("<info>扩展骨架已生成:</info> $base");
|
|
|
- if ($withFrontend) $output->writeln("<comment>前端模板:</comment> frontend/admin/src/views/{$module}");
|
|
|
|
|
|
|
+ if ($withFrontend) {
|
|
|
|
|
+ $output->writeln("<comment>前端模板:</comment> frontend/admin/src/views/{$module}");
|
|
|
|
|
+ }
|
|
|
$output->writeln("<comment>下一步:</comment> 1) 根据业务完善 Service/Entity 2) 配置路由与菜单 3) 如需 FFI 执行 {$module}/build.sh");
|
|
$output->writeln("<comment>下一步:</comment> 1) 根据业务完善 Service/Entity 2) 配置路由与菜单 3) 如需 FFI 执行 {$module}/build.sh");
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|