代码生成记录
This commit is contained in:
@@ -9,6 +9,8 @@ use Exception;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
class CodeGenerationService
|
||||
@@ -72,6 +74,45 @@ class CodeGenerationService
|
||||
$this->utils = UtilsService::getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取代码生成记录列表
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function list(): array
|
||||
{
|
||||
// ds(json_encode());
|
||||
$page = request()->get('page', 1);
|
||||
$pageSize = request()->get('pageSize', 20);
|
||||
$title = request()->get('title', '');
|
||||
|
||||
$query = CodeGenerationModel::where('deleted_at', 0);
|
||||
|
||||
// 如果有标题搜索条件
|
||||
if (!empty($title)) {
|
||||
$query->where('title', 'like', '%' . $title . '%');
|
||||
}
|
||||
|
||||
$result = $query->orderBy('id', 'desc')
|
||||
->paginate($pageSize, ['id', 'title', 'file_name', 'params', 'created_at', 'updated_at'], 'page', $page)
|
||||
->toArray();
|
||||
|
||||
foreach ($result['data'] as &$item) {
|
||||
$item['params'] = json_decode($item['params'], true);
|
||||
}
|
||||
|
||||
// /www/sites/nl-admin-api/index/nl-admin-api/storage/app/public/zip/code-generation/企业信息-69290eaaac899.zip
|
||||
// www\sites\nl-admin-api\index\nl-admin-api\storage\app\public\zip\code-generation\企业信息-69290eaaac899.zip
|
||||
return [
|
||||
'page' => $result['current_page'],
|
||||
'size' => $result['per_page'],
|
||||
'page_count' => $result['last_page'],
|
||||
'total' => $result['total'],
|
||||
'items' => $result['data'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取实例
|
||||
* @return null|static
|
||||
|
||||
Reference in New Issue
Block a user