97 lines
2.8 KiB
C#
97 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.GoodsManager.Goodss;
|
|
using ARW.Service.Api.IBusinessService.GoodsManager.Goodss;
|
|
using ARW.Model.Models.Business.GoodsManager.Goodss;
|
|
using ARW.Model.Vo.Api.GoodsManager.Goodss;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Geocoding;
|
|
using ARW.Service.Api.IBusinessService.GoodsManager.GoodsCategorys;
|
|
using ARW.Admin.WebApi.Framework;
|
|
|
|
namespace ARW.WebApi.Controllers.Api.GoodsManager.Goodss
|
|
{
|
|
/// <summary>
|
|
/// 商品控制器Api
|
|
///
|
|
/// @author lwh
|
|
/// @date 2023-07-09
|
|
/// </summary>
|
|
//[Verify]
|
|
[Route("api/[controller]")]
|
|
public class GoodsApiController : BaseController
|
|
{
|
|
private readonly IGoodsServiceApi _GoodsServiceApi;
|
|
|
|
|
|
/// <summary>
|
|
/// 依赖注入
|
|
/// </summary>
|
|
/// <param name="GoodsServiceApi">商品商品Api服务</param>
|
|
public GoodsApiController(IGoodsServiceApi GoodsServiceApi)
|
|
{
|
|
_GoodsServiceApi = GoodsServiceApi;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取商品列表(Api)
|
|
/// </summary>
|
|
/// <param name="parm">查询参数</param>
|
|
/// <returns></returns>z
|
|
[HttpGet("getGoodsList")]
|
|
public async Task<IActionResult> GetGoodsListApi([FromQuery] GoodsQueryDtoApi parm)
|
|
{
|
|
var res = await _GoodsServiceApi.GetGoodsListApi(parm);
|
|
return SUCCESS(res);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取商品运费(Api)
|
|
/// </summary>
|
|
/// <param name="parm">查询参数</param>
|
|
/// <returns></returns>
|
|
[HttpPost("getGoodsFreight")]
|
|
public async Task<IActionResult> GetGoodsFreight([FromBody] GoodsFreightDto parm)
|
|
{
|
|
var res = await _GoodsServiceApi.GetGoodsFreight(parm);
|
|
return SUCCESS(res);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取Goods详情(Api)
|
|
/// </summary>
|
|
/// <param name="parm">查询参数</param>
|
|
/// <returns></returns>
|
|
[HttpGet("getGoodsDetails")]
|
|
public async Task<IActionResult> GetGoodsDetails([FromQuery] GoodsDtoApi parm)
|
|
{
|
|
//if (parm == null) throw new CustomException("参数错误!");
|
|
var user = JwtUtil.GetLoginUser(App.HttpContext);
|
|
|
|
var res = await _GoodsServiceApi.GetGoodsDetails(parm, user.UserId);
|
|
|
|
if (res != "[]")
|
|
{
|
|
var data = res.FromJSON<GoodsApiDetailsVo>();
|
|
return SUCCESS(data);
|
|
}
|
|
else
|
|
{
|
|
return SUCCESS(res);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|