Explorar o código

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

- 删除所有控制器中的MacroPageMiddleware中间件引用
- 移除MacroPageMiddleware类定义
- 在Core\Request中新增pageAndLimit方法实现分页参数获取
- 统一分页参数验证规则:页码>=1,每页数量1-200
- 更新路由配置移除MacroPageMiddleware中间件绑定
- 修改MakerBundle模板和测试用例适配新分页方式
runphp hai 3 meses
pai
achega
3f8f1ddccd
Modificáronse 1 ficheiros con 0 adicións e 24 borrados
  1. 0 24
      src/Middleware/MacroPageMiddleware.php

+ 0 - 24
src/Middleware/MacroPageMiddleware.php

@@ -1,24 +0,0 @@
-<?php
-declare(strict_types=1);
-
-namespace SixShop\System\Middleware;
-
-use Closure;
-use SixShop\Core\Request;
-use think\Exception;
-use think\Response;
-
-class MacroPageMiddleware
-{
-    public function handle(Request $request, Closure $next): Response
-    {
-        $request->macro('pageAndLimit', function (): array {
-            $page = $this->get('page/d', 1);
-            $limit = $this->get('limit/d', $this->get('per_page/d', 10));
-            throw_if($page < 1, Exception::class, '页码不能小于1');
-            throw_if($limit < 1 || $limit > 200, Exception::class, '每页数量必须在1-200之间');
-            return ['page' => $page, 'list_rows' => $limit];
-        });
-        return $next($request);
-    }
-}