username@email.com
2024-03-25 99e2324eea7af7dd8da898277abd6f2cbb32e3f2
购物车接口
5个文件已修改
36 ■■■■ 已修改文件
CoreCms.Net.IServices/Cart/ICoreCmsCartServices.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CoreCms.Net.Model/CoreCms.Net.Model.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CoreCms.Net.Model/FromBody/FMCart.cs 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CoreCms.Net.Services/Cart/CoreCmsCartServices.cs 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CoreCms.Net.Web.WebApi/Controllers/CartController.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CoreCms.Net.IServices/Cart/ICoreCmsCartServices.cs
@@ -72,8 +72,9 @@
        /// <param name="ids">已选择货号</param>
        /// <param name="type">购物车类型/同订单类型</param>
        /// <param name="objectId">关联非订单类型数据序列</param>
        /// <param name="goodsId">goodsId</param>
        /// <returns></returns>
        Task<WebApiCallBack> GetCartDtoData(int userId, int[] ids = null, int type = 1, int objectId = 0);
        Task<WebApiCallBack> GetCartDtoData(int userId, int[] ids = null, int type = 1, int objectId = 0, int goodsId = 0);
        /// <summary>
@@ -90,7 +91,7 @@
        /// <param name="objectId">关联非普通订单营销类型序列</param>
        /// <returns></returns>
        Task<WebApiCallBack> GetCartInfos(int userId, int[] ids, int orderType, int areaId, int point,
            string couponCode, int deliveryType = (int)GlobalEnumVars.OrderReceiptType.Logistics, int userShipId = 0, int objectId = 0);
            string couponCode, int deliveryType = (int)GlobalEnumVars.OrderReceiptType.Logistics, int userShipId = 0, int objectId = 0, int goodsId = 0);
        /// <summary>
CoreCms.Net.Model/CoreCms.Net.Model.xml
@@ -9558,6 +9558,11 @@
            关联非普通订单对象序列
            </summary>
        </member>
        <member name="P:CoreCms.Net.Model.FromBody.FMCartGetList.goodsId">
            <summary>
            商品数据
            </summary>
        </member>
        <member name="T:CoreCms.Net.Model.FromBody.FMDoSaveCumulativeCheckInRules">
            <summary>
            保存累计签到规则
CoreCms.Net.Model/FromBody/FMCart.cs
@@ -97,7 +97,10 @@
        /// </summary>
        public int objectId { get; set; } = 0;
        /// <summary>
        /// 商品数据
        /// </summary>
        public int goodsId { get; set; } = 0;
    }
CoreCms.Net.Services/Cart/CoreCmsCartServices.cs
@@ -426,8 +426,9 @@
        /// <param name="ids">已选择货号</param>
        /// <param name="type">购物车类型/同订单类型</param>
        /// <param name="objectId">关联非订单类型数据序列</param>
        /// <param name="goodsId">goodsId</param>
        /// <returns></returns>
        public async Task<WebApiCallBack> GetCartDtoData(int userId, int[] ids = null, int type = 1, int objectId = 0)
        public async Task<WebApiCallBack> GetCartDtoData(int userId, int[] ids = null, int type = 1, int objectId = 0, int goodsId = 0)
        {
            var jm = new WebApiCallBack() { methodDescription = "获取购物车原始列表(未核算)" };
@@ -447,6 +448,17 @@
            {
                carts = await _dal.QueryListByClauseAsync(p => p.userId == userId && p.type == type, p => p.id, OrderByType.Asc);
            }
            if (goodsId>0)
            {
                var products = await  _productsServices.GetProducts(goodsId);
                int[] ss =  products.Select(x => x.id).ToArray();
                carts = carts.Where(p => ss.Contains(p.productId)).ToList();
            }
            var cartDto = new CartDto { userId = userId, type = type };
            foreach (var item in carts)
@@ -568,11 +580,11 @@
        /// <param name="userShipId">用户收货地址</param>
        /// <param name="objectId">关联非普通订单营销类型序列</param>
        /// <returns></returns>
        public async Task<WebApiCallBack> GetCartInfos(int userId, int[] ids, int orderType, int areaId, int point, string couponCode, int deliveryType = (int)GlobalEnumVars.OrderReceiptType.Logistics, int userShipId = 0, int objectId = 0)
        public async Task<WebApiCallBack> GetCartInfos(int userId, int[] ids, int orderType, int areaId, int point, string couponCode, int deliveryType = (int)GlobalEnumVars.OrderReceiptType.Logistics, int userShipId = 0, int objectId = 0,  int goodsId = 0)
        {
            var jm = new WebApiCallBack() { methodDescription = "获取处理后的购物车信息" };
            var cartDto = new CartDto(); //必须初始化
            var cartDtoData = await GetCartDtoData(userId, ids, orderType, objectId);
            var cartDtoData = await GetCartDtoData(userId, ids, orderType, objectId, goodsId);
            if (!cartDtoData.status)
            {
                jm.msg = "1";
CoreCms.Net.Web.WebApi/Controllers/CartController.cs
@@ -73,9 +73,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;
        }