using Infrastructure; using Infrastructure.Attribute; using Infrastructure.Enums; using Infrastructure.Model; using Mapster; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using ARW.Admin.WebApi.Extensions; using ARW.Admin.WebApi.Filters; using ARW.Common; using ARW.Admin.WebApi.Controllers; using ARW.Model.Dto.Api.Custom.CustomerAddresses; using ARW.Service.Api.IBusinessService.Custom.CustomerAddresses; using ARW.Model.Models.Business.Custom.CustomerAddresses; using ARW.Model.Vo.Api.Custom.CustomerAddresses; using Microsoft.AspNetCore.Authorization; using Geocoding; using ARW.Admin.WebApi.Framework; namespace ARW.WebApi.Controllers.Api.Custom.CustomerAddresses { /// /// 客户收货地址控制器Api /// /// @author admin /// @date 2023-06-09 /// [Verify] [Route("api/[controller]")] public class CustomerAddressApiController : BaseController { private readonly ICustomerAddressServiceApi _CustomerAddressServiceApi; /// /// 依赖注入 /// /// 客户收货地址客户收货地址Api服务 public CustomerAddressApiController(ICustomerAddressServiceApi CustomerAddressServiceApi) { _CustomerAddressServiceApi = CustomerAddressServiceApi; } /// /// 获取客户收货地址列表(Api) /// /// 查询参数 /// [HttpGet("getCustomerAddressList")] public async Task GetCustomerAddressListApi([FromQuery] CustomerAddressQueryDtoApi parm) { var user = JwtUtil.GetLoginUser(App.HttpContext); parm.CustomerAddressCustomerGuid = user.UserId; var res = await _CustomerAddressServiceApi.GetCustomerAddressListApi(parm); return SUCCESS(res); } /// /// 获取CustomerAddress详情(Api) /// /// 查询参数 /// [HttpGet("getCustomerAddressDetails")] public async Task GetCustomerAddressDetails([FromQuery] CustomerAddressDtoApi parm) { if (parm == null) throw new CustomException("参数错误!"); var res = await _CustomerAddressServiceApi.GetCustomerAddressDetails(parm); if (res != "[]") { res = res.Remove(0, 1); res = res.Substring(0, res.Length - 1); var data = res.FromJSON(); return SUCCESS(data); } else { return SUCCESS(res); } } } }