85 lines
2.8 KiB
C#
85 lines
2.8 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// 客户收货地址控制器Api
|
|
///
|
|
/// @author admin
|
|
/// @date 2023-06-09
|
|
/// </summary>
|
|
[Verify]
|
|
[Route("api/[controller]")]
|
|
public class CustomerAddressApiController : BaseController
|
|
{
|
|
private readonly ICustomerAddressServiceApi _CustomerAddressServiceApi;
|
|
|
|
/// <summary>
|
|
/// 依赖注入
|
|
/// </summary>
|
|
/// <param name="CustomerAddressServiceApi">客户收货地址客户收货地址Api服务</param>
|
|
public CustomerAddressApiController(ICustomerAddressServiceApi CustomerAddressServiceApi)
|
|
{
|
|
_CustomerAddressServiceApi = CustomerAddressServiceApi;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取客户收货地址列表(Api)
|
|
/// </summary>
|
|
/// <param name="parm">查询参数</param>
|
|
/// <returns></returns>
|
|
[HttpGet("getCustomerAddressList")]
|
|
public async Task<IActionResult> GetCustomerAddressListApi([FromQuery] CustomerAddressQueryDtoApi parm)
|
|
{
|
|
var user = JwtUtil.GetLoginUser(App.HttpContext);
|
|
parm.CustomerAddressCustomerGuid = user.UserId;
|
|
var res = await _CustomerAddressServiceApi.GetCustomerAddressListApi(parm);
|
|
return SUCCESS(res);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取CustomerAddress详情(Api)
|
|
/// </summary>
|
|
/// <param name="parm">查询参数</param>
|
|
/// <returns></returns>
|
|
[HttpGet("getCustomerAddressDetails")]
|
|
public async Task<IActionResult> 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<CustomerAddressApiDetailsVo>();
|
|
return SUCCESS(data);
|
|
}
|
|
else
|
|
{
|
|
return SUCCESS(res);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|