调整地区数据缓存
This commit is contained in:
@@ -54,22 +54,6 @@ namespace Atomx.Admin.Controllers
|
||||
_localizer = localizer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("select/{id}")]
|
||||
public IActionResult Select(long id)
|
||||
{
|
||||
var list = new List<KeyValue>();
|
||||
var query = from p in _dbContext.Areas
|
||||
where p.ParentId == id && p.Enabled
|
||||
select p;
|
||||
list = query.OrderByDescending(p => p.DisplayOrder).Select(p => new KeyValue() { Key = p.Id.ToString(), Value = p.Name }).ToList();
|
||||
|
||||
return new JsonResult(new ApiResult<List<KeyValue>>().IsSuccess(list));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据查询
|
||||
/// </summary>
|
||||
@@ -78,7 +62,7 @@ namespace Atomx.Admin.Controllers
|
||||
/// <param name="size"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("search")]
|
||||
public IActionResult AddressList(AreaSearch search, int page, int size = 20)
|
||||
public IActionResult Search(AreaSearch search, int page, int size = 20)
|
||||
{
|
||||
if (page < 1)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Atomx.Admin.Client.Models;
|
||||
using Atomx.Admin.Services;
|
||||
using Atomx.Common.Constants;
|
||||
using Atomx.Common.Entities;
|
||||
using Atomx.Common.Enums;
|
||||
using Atomx.Common.Models;
|
||||
|
||||
@@ -12,6 +12,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Atomx.Admin.Controllers
|
||||
{
|
||||
@@ -50,6 +51,21 @@ namespace Atomx.Admin.Controllers
|
||||
_localizer = localizer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据查询
|
||||
/// </summary>
|
||||
/// <param name="search"></param>
|
||||
/// <param name="page"></param>
|
||||
/// <param name="size"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("tree/{countryId:long}")]
|
||||
public async Task<IActionResult> GetTree(long countryId, int page, int size = 20)
|
||||
{
|
||||
var list = await _cacheService.GetAreaTree(countryId);
|
||||
|
||||
return new JsonResult(new ApiResult<List<KeyValueTree>>().IsSuccess(list));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据查询
|
||||
/// </summary>
|
||||
@@ -58,7 +74,7 @@ namespace Atomx.Admin.Controllers
|
||||
/// <param name="size"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("select/{countryId:long}")]
|
||||
public IActionResult AddressList(long countryId, int page, int size = 20)
|
||||
public IActionResult Select(long countryId, int page, int size = 20)
|
||||
{
|
||||
var list = new List<KeyValue>();
|
||||
var query = from p in _dbContext.StateProvinces
|
||||
@@ -77,7 +93,7 @@ namespace Atomx.Admin.Controllers
|
||||
/// <param name="size"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("search")]
|
||||
public IActionResult AddressList(StateProvinceSearch search, int page, int size = 20)
|
||||
public IActionResult Search(StateProvinceSearch search, int page, int size = 20)
|
||||
{
|
||||
if (page < 1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user