// +---------------------------------------------------------------------- declare (strict_types=1); namespace app\api\middleware; use cores\Request; /** * 中间件:当前商城ID */ class Store { /** * 前置中间件 * @param Request $request * @param \Closure $next * @return mixed */ public function handle(Request $request, \Closure $next) { $storeId = (int)$request->header('storeId', '0'); $request->setStoreId($storeId); return $next($request); } }