You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using Elight.Entity;
|
|
|
|
|
using Elight.Utility;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
|
|
|
|
|
namespace _24Hour.Controllers
|
|
|
|
|
{
|
|
|
|
|
[Authorize]
|
|
|
|
|
[ApiController]
|
|
|
|
|
[Route("api/WeatherForecast")]
|
|
|
|
|
public class WeatherForecastController : ControllerBase
|
|
|
|
|
{
|
|
|
|
|
private readonly SqlSugarClient _db;
|
|
|
|
|
App_Sys_UserModel _userdata = new App_Sys_UserModel();//<EFBFBD><EFBFBD>ǰ<EFBFBD>û<EFBFBD>
|
|
|
|
|
private static readonly string[] Summaries = new[]
|
|
|
|
|
{
|
|
|
|
|
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private readonly ILogger<WeatherForecastController> _logger;
|
|
|
|
|
|
|
|
|
|
public WeatherForecastController(ILogger<WeatherForecastController> logger, SqlSugarClient db,User user)
|
|
|
|
|
{
|
|
|
|
|
_logger = logger;
|
|
|
|
|
_db = db;
|
|
|
|
|
_userdata = user.Userdata();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet(Name = "GetWeatherForecast")]
|
|
|
|
|
public IEnumerable<WeatherForecast> Get()
|
|
|
|
|
{
|
|
|
|
|
var ss = _userdata;
|
|
|
|
|
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
|
|
|
|
{
|
|
|
|
|
Date = DateTime.Now.AddDays(index),
|
|
|
|
|
TemperatureC = Random.Shared.Next(-20, 55),
|
|
|
|
|
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
|
|
|
|
})
|
|
|
|
|
.ToArray();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|