liaoxujun@qq.com
2024-04-10 05d32271f646149609d8b42016e11cf95d8d5a84
CoreCms.Net.Web.WebApi/Controllers/GoodController.cs
@@ -19,6 +19,7 @@
using CoreCms.Net.Configuration;
using CoreCms.Net.DTO.ComponentsDTO;
using CoreCms.Net.IServices;
using CoreCms.Net.IServices.baifenbingfa;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
@@ -63,6 +64,7 @@
        private ICoreCmsAgentGradeServices _agentGradeServices;
        private ICoreCmsGoodsCategoryExtendServices _goodsCategoryExtendServices;
        private readonly ICoreCmsAreaServices _coreCmsAreaServices;
        private readonly IBfbfComAPIService _bfbfComAPIService;
        /// <summary>
        /// 构造函数
@@ -83,7 +85,8 @@
            ICoreCmsAgentProductsServices agentProductsServices, 
            ICoreCmsAgentGradeServices agentGradeServices, 
            ICoreCmsGoodsCategoryExtendServices goodsCategoryExtendServices,
            ICoreCmsAreaServices areaServices
            ICoreCmsAreaServices areaServices,
            IBfbfComAPIService bfbfComAPIService
            )
        {
@@ -104,6 +107,7 @@
            _agentGradeServices = agentGradeServices;
            _goodsCategoryExtendServices = goodsCategoryExtendServices;
            _coreCmsAreaServices = areaServices;
            _bfbfComAPIService = bfbfComAPIService;
        }
        //公共接口====================================================================================================
@@ -165,6 +169,13 @@
            var jm = new WebApiCallBack();
            var where = PredicateBuilder.True<GoodListDTO>();
            //是否是经销商
            bool isDic = false;
            if (_user.ID > 0)
            {
                isDic = await _bfbfComAPIService.IsDictionary(_user.ID);
            };
            var className = string.Empty;
            if (!string.IsNullOrWhiteSpace(entity.where))
@@ -261,6 +272,7 @@
            //获取数据
            var list = await _goodsServices.QueryPageByDTOAsync(where, entity.page, entity.limit, true);
            //获取品牌
            var brands = await _brandServices.QueryListByClauseAsync(p => p.isShow == true, p => p.sort, OrderByType.Desc, true, true);
@@ -274,6 +286,12 @@
                  
                    item.area+= (await _coreCmsAreaServices.GetAreaString(code)+"");
                }
                //调整经销商价格 百分兵法
                if(isDic)
                {
                    item.price = item.distributionPrice;
                }
            }
            //返回数据
            jm.status = true;
@@ -607,12 +625,17 @@
            }
            var model = await _goodsServices.GetGoodsDetail(entity.id, userId, false, "goods", 0, entity.data.ObjectToBool());
            if (model == null)
            {
                jm.msg = "商品获取失败";
                return jm;
            }
            if (await _bfbfComAPIService.IsDictionary(user.id))
            {
                //百分兵法经销商
                model.product.price = model.product.distributionPrice;
            }
            var codelist = model.areaCode?.Split(",");
            model.area = "";
            if(codelist!=null)