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.
 
 

83 lines
2.5 KiB

using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
using Znyc.Cloudcar.Admin.AspNetCore.Entitys;
using Znyc.Cloudcar.Admin.AspNetCore.Mvc;
using Znyc.Cloudcar.Admin.Commons.Entitys;
using Znyc.Cloudcar.Admin.Commons.Log;
using Znyc.Cloudcar.Admin.Security.IServices;
namespace Znyc.Cloudcar.Admin.WebApi.Controllers
{
/// <summary>
/// 省市区地区管理
/// </summary>
[ApiController]
[Route("api/Security/[controller]")]
public class
RegionController
{
private readonly IRegionService _regionService;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="regionService"></param>
public RegionController(IRegionService regionService)
{
_regionService = regionService;
}
/// <summary>
/// 省市区
/// </summary>
/// <returns></returns>
[HttpGet("GetAllRegionList")]
[FunctionAuthorize("")]
public async Task<CommonResult> GetAllRegionList()
{
CommonResult result = new CommonResult();
try
{
System.Collections.Generic.List<Security.Dtos.RegionOutputDto> list = await _regionService.GetAllRegionList();
result.Success = true;
result.ErrCode = ErrCode.successCode;
result.ResData = list;
}
catch (Exception ex)
{
Log4NetHelper.Error("获取省市区缓存异常", ex);
result.ErrMsg = ErrCode.err40110;
result.ErrCode = "40110";
}
return result;
}
/// <summary>
/// 同步地区缓存
/// </summary>
/// <returns></returns>
[HttpGet("AsyncRegionCache")]
[FunctionAuthorize("")]
public async Task<CommonResult> AsyncRegionCache()
{
CommonResult result = new CommonResult();
try
{
System.Collections.Generic.List<Security.Dtos.RegionOutputDto> list = await _regionService.AsyncRegionCache();
result.Success = true;
result.ErrCode = ErrCode.successCode;
result.ResData = list;
}
catch (Exception ex)
{
Log4NetHelper.Error("同步地区缓存异常", ex);
result.ErrMsg = ErrCode.err40110;
result.ErrCode = "40110";
}
return result;
}
}
}