修改代码

增加云商品数据
This commit is contained in:
chfei committed 2026-10-14 11:53:36 +08:00
1 parent 2f406c840f
commit db4f030c17
58 files changed
+1550 -120

No files matched your search

+16 -16
View File
@@ -7,21 +7,21 @@ using System.Text.Json.Serialization;
namespace Store.Api.Controllers
{
[ApiController]
[ApiVersionNeutral]
[Route("wxxd_user/[action]")]
public class UserController : ControllerBase
{
private readonly IUserRepository _userRepository;
//[ApiController]
//[ApiVersionNeutral]
//[Route("wxxd_user/[action]")]
//public class UserController : ControllerBase
//{
// private readonly IUserRepository _userRepository;
public UserController(IUserRepository userRepository)
{
_userRepository = userRepository;
}
[HttpGet]
public string GetUser()
{
return JsonSerializer.Serialize(_userRepository.Select.First());
}
}
// public UserController(IUserRepository userRepository)
// {
// _userRepository = userRepository;
// }
// [HttpGet]
// public string GetUser()
// {
// return JsonSerializer.Serialize(_userRepository.Select.First());
// }
//}
}
@@ -1,34 +0,0 @@
using Asp.Versioning;
using MAX.Framework.Dtos;
using Microsoft.AspNetCore.Mvc;
using Store.Api;
using System.ComponentModel;
namespace Store.Api.Controllers
{
[ApiController]
[Description("测试温度")]
[ApiVersion("1.0")]
[Route("api/v{version:apiVersion}/[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries =
[
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
];
[HttpGet(Name = "GetWeatherForecast")]
public IEnumerable<WeatherForecast> Get()
{
IEnumerable<WeatherForecast> data = Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
return data;
}
}
}
@@ -5,29 +5,29 @@ using Store.Api;
namespace Store.Api.Controllers.v2
{
[ApiController]
[ApiVersion("2.0")]
[Route("api/v{version:apiVersion}/[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries =
[
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
];
//[ApiController]
//[ApiVersion("2.0")]
//[Route("api/v{version:apiVersion}/[controller]")]
//public class WeatherForecastController : ControllerBase
//{
// private static readonly string[] Summaries =
// [
// "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
// ];
[HttpGet(Name = "GetWeatherForecastV2")]
public ApiResult<IEnumerable<WeatherForecastV2>> Get()
{
IEnumerable<WeatherForecastV2> data = Enumerable.Range(1, 10).Select(index => new WeatherForecastV2
{
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
TemperatureC = Random.Shared.Next(-20, 55),
FeelsLikeC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
// [HttpGet(Name = "GetWeatherForecastV2")]
// public ApiResult<IEnumerable<WeatherForecastV2>> Get()
// {
// IEnumerable<WeatherForecastV2> data = Enumerable.Range(1, 10).Select(index => new WeatherForecastV2
// {
// Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
// TemperatureC = Random.Shared.Next(-20, 55),
// FeelsLikeC = Random.Shared.Next(-20, 55),
// Summary = Summaries[Random.Shared.Next(Summaries.Length)]
// })
// .ToArray();
return ApiResult<IEnumerable<WeatherForecastV2>>.Success(data);
}
}
// return ApiResult<IEnumerable<WeatherForecastV2>>.Success(data);
// }
//}
}
+2 -1
View File
@@ -19,7 +19,8 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Models\CloudProduct\Store.Modules.CloudProduct.csproj" />
<ProjectReference Include="..\Modules\CloudProduct\Store.CloudProduct.csproj" />
<ProjectReference Include="..\Modules\Store.Users\Store.Users.csproj" />
<ProjectReference Include="..\Store.Framework\Store.Framework.csproj" />
</ItemGroup>
-13
View File
@@ -1,13 +0,0 @@
namespace Store.Api
{
public class WeatherForecast
{
public DateOnly Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string? Summary { get; set; }
}
}
-15
View File
@@ -1,15 +0,0 @@
namespace Store.Api
{
public class WeatherForecastV2
{
public DateOnly Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public int FeelsLikeC { get; set; }
public string? Summary { get; set; }
}
}