70 lines
1.9 KiB
C#
70 lines
1.9 KiB
C#
![]() |
using Microsoft.AspNetCore.Authorization;
|
|||
|
using Microsoft.AspNetCore.Http;
|
|||
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using VOL.Business.IServices;
|
|||
|
using VOL.Business.IServices.School;
|
|||
|
using VOL.Business.Services.School;
|
|||
|
using VOL.Core.Filters;
|
|||
|
using VOL.Core.ManageUser;
|
|||
|
using VOL.Core.Utilities;
|
|||
|
using VOL.Model;
|
|||
|
using VOL.Model.School.Request;
|
|||
|
|
|||
|
namespace VOL.WebApi.Controllers.Business
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 省市区
|
|||
|
/// </summary>
|
|||
|
[Route("api/[controller]")]
|
|||
|
[ApiController]
|
|||
|
[ApiExplorerSettings(GroupName = "v3")]
|
|||
|
[TypeFilter(typeof(CustomApiResponseFilter))]
|
|||
|
[AllowAnonymous]
|
|||
|
public class LocationController : ControllerBase
|
|||
|
{
|
|||
|
#region 初始化
|
|||
|
|
|||
|
private readonly ILocationService _locationService;
|
|||
|
public LocationController(
|
|||
|
ILocationService locationService)
|
|||
|
{
|
|||
|
_locationService = locationService;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 省份
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
[HttpGet(nameof(GetProvinceList))]
|
|||
|
public async Task<List<ProvinceModel>> GetProvinceList()
|
|||
|
{
|
|||
|
return await _locationService.GetProvinceList();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 城市
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
[HttpGet(nameof(GetCityList))]
|
|||
|
public async Task<List<CityModel>> GetCityList(string provinceCode)
|
|||
|
{
|
|||
|
return await _locationService.GetCityList(provinceCode);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 区县
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
[HttpGet(nameof(GetDistrictList))]
|
|||
|
public async Task<List<DistrictModel>> GetDistrictList(string cityCode)
|
|||
|
{
|
|||
|
return await _locationService.GetDistrictList(cityCode);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|