header('appid'); if (empty($appid)) { return response()->json([ 'code' => -1, 'msg' => '商户信息缺失', 'data' => [], 'status' => 500, ]); } //检查代理商 $agent_id = Agent::query()->where(['appid' => $appid, 'status' => 1])->value('id'); if (empty($agent_id)) { return response()->json([ 'code' => -1, 'msg' => '商户不存在或已被禁用', 'data' => [], 'status' => 403, ]); } Cache::put($appid, $agent_id); return $next($request); } }