【新增】新增全局优惠展示接口,前端商品详情增加全局优惠显示入口。

This commit is contained in:
jianweie code
2023-11-10 02:16:40 +08:00
parent 685a9a39f1
commit 9f03934127
9 changed files with 576 additions and 5 deletions

View File

@@ -0,0 +1,67 @@
using System.Linq;
using CoreCms.Net.Auth.HttpContextUser;
using CoreCms.Net.Caching.AutoMate.RedisCache;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using CoreCms.Net.Configuration;
namespace CoreCms.Net.Web.WebApi.Controllers
{
/// <summary>
/// 促销活动接口
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class PromotionController : ControllerBase
{
private readonly ICoreCmsPromotionServices _promotionServices;
private readonly IRedisOperationRepository _redisOperationRepository;
private readonly IHttpContextUser _user;
private readonly IUnitOfWork _unionOfWork;
/// <summary>
/// 构造函数
/// </summary>
public PromotionController(ICoreCmsPromotionServices promotionServices, IRedisOperationRepository redisOperationRepository, IHttpContextUser user, IUnitOfWork unionOfWork)
{
_promotionServices = promotionServices;
_redisOperationRepository = redisOperationRepository;
_user = user;
_unionOfWork = unionOfWork;
}
//公共接口====================================================================================================
#region ==================================================
/// <summary>
/// 获取全局促销列表
/// </summary>
/// <returns></returns>
[HttpPost]
//[Authorize]
public async Task<WebApiCallBack> GetPromotionList([FromBody] FMIntId entity)
{
var jm = new WebApiCallBack() { msg = "获取失败" };
var list = await _promotionServices.GetPromotionList(entity.id);
jm.status = true;
jm.data = list;
jm.msg = "获取成功";
return jm;
}
#endregion
//验证接口====================================================================================================
}
}