using Microsoft.AspNetCore.Mvc; using Parking_spaces.Authorization; using Parking_spaces.Helpers; using System.Net.Http.Headers; namespace Parking_spaces.Controllers { public class Park_spacesController : Controller { private readonly HttpClient _httpClient; public Park_spacesController(HttpClient httpClient, IConfiguration configuration) { _httpClient = httpClient; } //[Authorize] /* public async Task Parking_spaces_total_table(string id) { if (id != null) { // 获取身份验证令牌 string token = id; // 设置 HttpClient 的默认请求头 _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(token); // 构建 API 请求的 URL string apiUrl = "http://140.125.20.183:7710/Users/token"; // 调用需要身份验证的 API HttpResponseMessage response = await _httpClient.GetAsync(apiUrl); if (response.ReasonPhrase == "OK") { ViewBag.token_check = "true"; ViewBag.token = token; return View(); } else { ViewBag.token_check = "false"; return View(); } } else { ViewBag.token_check = "false"; return View(); //return RedirectToAction("Login", "Home"); } }*/ public IActionResult Parking_spaces_total_table() { return View(); } //[Authorize] public IActionResult Single_parking_spaces_detail(string id) { ViewBag.name = id; return View(); } public IActionResult Single_parking_spaces_map(string id) { ViewBag.name = id; return View(); } public IActionResult Parking_spaces_history(string id) { return View(); } } }