username@email.com
2024-09-09 cc170291673472d3cda8d7ea77f6bd3a3b5dbb83
CoreCms.Net.Web.WebApi/Controllers/CartController.cs
@@ -18,6 +18,7 @@
using CoreCms.Net.Configuration;
using CoreCms.Net.Model.ViewModels.DTO;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.IServices.baifenbingfa;
namespace CoreCms.Net.Web.WebApi.Controllers
{
@@ -30,15 +31,17 @@
    {
        private readonly IHttpContextUser _user;
        private readonly ICoreCmsCartServices _cartServices;
        private readonly IBfbfComAPIService _bfbfComAPIService;
        /// <summary>
        /// 构造函数
        /// </summary>
        public CartController(IHttpContextUser user, ICoreCmsCartServices cartServices)
        public CartController(IHttpContextUser user, ICoreCmsCartServices cartServices,IBfbfComAPIService bfbfComAPIService)
        {
            _user = user;
            _cartServices = cartServices;
            _bfbfComAPIService = bfbfComAPIService;
        }
        //公共接口====================================================================================================
@@ -56,7 +59,20 @@
        [Authorize]
        public async Task<WebApiCallBack> AddCart([FromBody] FMCartAdd entity)
        {
            var jm = await _cartServices.Add(_user.ID, entity.ProductId, entity.Nums, entity.type, entity.cartType, entity.objectId);
            if ((await _bfbfComAPIService.IsDictionary(_user.ID)) && ((entity.cartType != 1)&&(entity.cartType!=4)))//1是普通单,4 是秒杀
            {
                //经销商进制发起团购
                return new WebApiCallBack
                {
                    status = false,
                    msg = " 对不起 经销商不可以发起团购或者拼团"
                };
            }
            var jm = await _cartServices.Add(_user.ID, entity.ProductId, entity.Nums, entity.type, entity.cartType, entity.objectId,entity.isCustomizable);
            return jm;
        }