2025-05-13 10:39:21 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\core;
|
|
|
|
|
|
|
|
|
|
use App\BaseApp\BaseController;
|
|
|
|
|
use App\Service\core\CodeGenerationService;
|
|
|
|
|
use App\Service\LoginService;
|
|
|
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
|
|
|
|
|
|
class CodeGenerationController extends BaseController
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
parent::__construct();
|
|
|
|
|
$this->service = CodeGenerationService::getInstance();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function generation()
|
|
|
|
|
{
|
2025-05-13 13:16:59 +08:00
|
|
|
$this->insertField = [
|
|
|
|
|
'class_name',
|
|
|
|
|
'class_comment',
|
|
|
|
|
'sort',
|
|
|
|
|
'icon',
|
|
|
|
|
'pid',
|
|
|
|
|
'field',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
$params = $this->checkRequiredFields(request()->post());
|
|
|
|
|
|
|
|
|
|
return jok(
|
|
|
|
|
$this->service->generate($params),
|
|
|
|
|
'生成成功!'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function download()
|
|
|
|
|
{
|
|
|
|
|
// $id = request()->post('id');
|
|
|
|
|
$id = request()->get('id');
|
|
|
|
|
if (!$id) {
|
|
|
|
|
return jerr('参数错误!');
|
|
|
|
|
}
|
|
|
|
|
return $this->service->download($id);
|
2025-05-13 10:39:21 +08:00
|
|
|
}
|
|
|
|
|
|
2025-05-13 16:35:18 +08:00
|
|
|
public function downloadInfo()
|
|
|
|
|
{
|
|
|
|
|
// $id = request()->post('id');
|
|
|
|
|
$id = request()->get('id');
|
|
|
|
|
if (!$id) {
|
|
|
|
|
return jerr('参数错误!');
|
|
|
|
|
}
|
|
|
|
|
return jok(
|
|
|
|
|
$this->service->downloadInfo($id)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-13 10:39:21 +08:00
|
|
|
}
|