Переглянути джерело

refactor(core): 移除MacroPageMiddleware并重构分页逻辑

- 删除所有控制器中的MacroPageMiddleware中间件引用
- 移除MacroPageMiddleware类定义
- 在Core\Request中新增pageAndLimit方法实现分页参数获取
- 统一分页参数验证规则:页码>=1,每页数量1-200
- 更新路由配置移除MacroPageMiddleware中间件绑定
- 修改MakerBundle模板和测试用例适配新分页方式
runphp 3 місяців тому
батько
коміт
cdce23ed95

+ 0 - 1
CHANGELOG.md

@@ -45,7 +45,6 @@ This is the first complete release of the SixShop Maker Bundle with full functio
 #### Controller Generation
 - **Dual Architecture**: Separate API and Admin controller generation
 - **Modern Request Handling**: Uses `SixShop\Core\Request` with dependency injection
-- **Middleware Integration**: MacroPageMiddleware support for admin controllers  
 - **Response Helpers**: Integration with `page_response()` and `success_response()` functions
 - **User Authentication**: Built-in `$request->userID` pattern for user context
 - **Parameter Processing**: Proper handling of GET, POST, PUT request data

+ 0 - 1
QUALITY_REPORT.md

@@ -54,7 +54,6 @@ The SixShop Maker Bundle is a comprehensive, production-ready code generation to
 ### ✅ Controller Generation
 - **Dual Architecture**: Separate API and Admin controllers
 - **Modern Request Handling**: SixShop\Core\Request with dependency injection
-- **Middleware Integration**: MacroPageMiddleware support for admin controllers
 - **Response Helpers**: page_response() and success_response() functions
 - **User Authentication**: Built-in $request->userID pattern
 - **Parameter Processing**: Proper GET/POST/PUT parameter handling

+ 1 - 4
templates/src/Controller/Admin/Controller.php.tpl.php

@@ -6,7 +6,7 @@ namespace <?= $namespace ?>Controller\Admin;
 use <?= $namespace ?>Model\<?= $modelName ?>;
 use <?= $namespace ?>Entity\<?= $entityName ?>;
 use SixShop\Core\Request;
-use SixShop\System\Middleware\MacroPageMiddleware;
+
 use think\Response;
 use think\Route;
 use function SixShop\Core\page_response;
@@ -20,9 +20,6 @@ use function SixShop\Core\success_response;
  */
 class <?= $controllerName ?>{
 
-    protected array $middlewares = [
-        MacroPageMiddleware::class
-    ];
     /**
      * Display a listing of the resource
      * GET /{resource}

+ 1 - 4
tests/Unit/Generator/ControllerGeneratorTest.php

@@ -141,10 +141,7 @@ class ControllerGeneratorTest extends TestCase
         
         // Test class name
         $this->assertStringContainsString('class ProductController', $content);
-        
-        // Test middleware usage
-        $this->assertStringContainsString('use SixShop\Core\MacroPageMiddleware;', $content);
-        
+
         // Test entity usage
         $this->assertStringContainsString('use TestExtension\Entity\ProductEntity;', $content);