From 05d32271f646149609d8b42016e11cf95d8d5a84 Mon Sep 17 00:00:00 2001
From: liaoxujun@qq.com <liaoxujun@qq.com>
Date: 星期三, 10 四月 2024 11:18:05 +0800
Subject: [PATCH]  修改供应商价格显示

---
 CoreCms.Net.Web.WebApi/Controllers/GoodController.cs |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/CoreCms.Net.Web.WebApi/Controllers/GoodController.cs b/CoreCms.Net.Web.WebApi/Controllers/GoodController.cs
index 39a360f..420f867 100644
--- a/CoreCms.Net.Web.WebApi/Controllers/GoodController.cs
+++ b/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)

--
Gitblit v1.9.1