移动系统liao
2025-02-17 557c2711a3e103ebc3d0492344eca9730d5e92b2
CoreCms.Net.Web.WebApi/Controllers/CartController.cs
@@ -1,10 +1,10 @@
/***********************************************************************
 *            Project: CoreCms
 *        ProjectName: 核心内容管理系统
 *                Web: https://www.corecms.net
 *             Author: 大灰灰
 *              Email: jianweie@163.com
 *         CreateTime: 2021/1/31 21:45:10
 *            Project: baifenBinfa
 *        ProjectName: 百分兵法管理系统
 *                Web: http://chuanyin.com
 *             Author:
 *              Email:
 *         CreateTime: 202403/02
 *        Description: 暂无
 ***********************************************************************/
@@ -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;
        }
@@ -73,9 +89,8 @@
        public async Task<WebApiCallBack> GetList([FromBody] FMCartGetList entity)
        {
            var ids = CommonHelper.StringToIntArray(entity.ids);
            //获取数据
            var jm = await _cartServices.GetCartInfos(_user.ID, ids, entity.type, entity.areaId, entity.point, entity.couponCode, entity.receiptType, entity.userShipId, entity.objectId);
            var jm = await _cartServices.GetCartInfos(_user.ID, ids, entity.type, entity.areaId, entity.point, entity.couponCode, entity.receiptType, entity.userShipId, entity.objectId, entity.goodsId);
            return jm;
        }