From 5f4384bdab4697cc0a678fb17e55603a91a4750b Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期五, 12 四月 2024 08:44:54 +0800
Subject: [PATCH] Merge branch 'master' of http://47.108.235.38:8080/r/baifenbaishop

---
 CoreCms.Net.Services/Shop/CoreCmsPagesServices.cs |   63 +++++++++++++++++++++++++++++--
 1 files changed, 58 insertions(+), 5 deletions(-)

diff --git a/CoreCms.Net.Services/Shop/CoreCmsPagesServices.cs b/CoreCms.Net.Services/Shop/CoreCmsPagesServices.cs
index c7a4a3d..c8c2147 100644
--- a/CoreCms.Net.Services/Shop/CoreCmsPagesServices.cs
+++ b/CoreCms.Net.Services/Shop/CoreCmsPagesServices.cs
@@ -12,11 +12,13 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Threading.Tasks;
+using CoreCms.Net.Auth.HttpContextUser;
 using CoreCms.Net.Configuration;
 using CoreCms.Net.DTO.ComponentsDTO;
 using CoreCms.Net.IRepository;
 using CoreCms.Net.IRepository.UnitOfWork;
 using CoreCms.Net.IServices;
+using CoreCms.Net.IServices.baifenbingfa;
 using CoreCms.Net.Loging;
 using CoreCms.Net.Model.Entities;
 using CoreCms.Net.Model.Entities.Expression;
@@ -53,12 +55,25 @@
         private readonly ICoreCmsPinTuanRuleServices _pinTuanRuleServices;
         private readonly ICoreCmsServicesServices _servicesServices;
         private readonly ICoreCmsGoodsCategoryExtendServices _goodsCategoryExtendServices;
-
-
+        private readonly IHttpContextUser _contextUser;
+        private readonly IBfbfComAPIService _bfbfComAPIService;
         private readonly IUnitOfWork _unitOfWork;
         public CoreCmsPagesServices(IUnitOfWork unitOfWork
             , ICoreCmsPagesRepository dal
-            , ICoreCmsPagesItemsRepository pagesItemsRepository, ICoreCmsPromotionServices promotionServices, ICoreCmsNoticeServices noticeServices, ICoreCmsGoodsCategoryServices goodsCategoryServices, ICoreCmsSettingServices settingServices, ICoreCmsGoodsServices goodsServices, ICoreCmsArticleServices articleServices, ICoreCmsPromotionConditionServices promotionConditionServices, ICoreCmsPinTuanRuleServices pinTuanRuleServices, ICoreCmsServicesServices servicesServices, ICoreCmsArticleTypeServices articleTypeServices, ICoreCmsGoodsCategoryExtendServices goodsCategoryExtendServices)
+            , ICoreCmsPagesItemsRepository pagesItemsRepository,
+            ICoreCmsPromotionServices promotionServices,
+            ICoreCmsNoticeServices noticeServices, 
+            ICoreCmsGoodsCategoryServices goodsCategoryServices,
+            ICoreCmsSettingServices settingServices, 
+            ICoreCmsGoodsServices goodsServices, 
+            ICoreCmsArticleServices articleServices,
+            ICoreCmsPromotionConditionServices promotionConditionServices,
+            ICoreCmsPinTuanRuleServices pinTuanRuleServices, 
+            ICoreCmsServicesServices servicesServices, 
+            ICoreCmsArticleTypeServices articleTypeServices, 
+            ICoreCmsGoodsCategoryExtendServices goodsCategoryExtendServices,
+            IHttpContextUser httpContextUser,
+                 IBfbfComAPIService bfbfComAPIService)
         {
             this._dal = dal;
             _pagesItemsRepository = pagesItemsRepository;
@@ -75,6 +90,8 @@
             _goodsCategoryExtendServices = goodsCategoryExtendServices;
             base.BaseDal = dal;
             _unitOfWork = unitOfWork;
+            _contextUser= httpContextUser;
+            _bfbfComAPIService = bfbfComAPIService;
         }
 
 
@@ -138,7 +155,8 @@
         /// <returns></returns>
         public async Task<WebApiCallBack> GetPageConfig(string code)
         {
-
+          var userID=   _contextUser.ID;
+            
             var jm = new WebApiCallBack();
 
             var wherePage = PredicateBuilder.True<CoreCmsPages>();
@@ -265,6 +283,7 @@
                         break;
                     case "goodTabBar":
                         {
+                            bool isDic = await _bfbfComAPIService.IsDictionary(_contextUser.ID);
                             var parameters = (JObject)JsonConvert.DeserializeObject(item.parameters);
                             if (parameters != null && parameters.ContainsKey("list"))
                             {
@@ -305,7 +324,17 @@
                                         limit = limit > 0 ? limit : 10;
 
                                         var goods = await _goodsServices.QueryListByComponentsAsync(where, limit, p => p.createTime, OrderByType.Desc, true, true, 60);
-
+                                        if(goods!=null)
+                                        {
+                                            //鐧惧垎鍏垫硶缁忛攢鍟嗕慨鏀逛环鏍�
+                                            if(isDic)
+                                            {
+                                                foreach (var gd in goods)
+                                                {
+                                                    gd.price = gd.distributionPrice;
+                                                }
+                                            }
+                                        }
                                         if (goods != null && goods.Any())
                                         {
                                             var result = JArray.FromObject(goods);
@@ -431,6 +460,18 @@
                                 limit = limit > 0 ? limit : 10;
 
                                 var goods = await _goodsServices.QueryListByComponentsAsync(where, limit, " sort asc,id asc ", true, true, 60);
+                                if (goods != null)
+                                {
+                                    bool isDic = await _bfbfComAPIService.IsDictionary(_contextUser.ID);
+                                    //鐧惧垎鍏垫硶缁忛攢鍟嗕慨鏀逛环鏍�
+                                    if (isDic)
+                                    {
+                                        foreach (var gd in goods)
+                                        {
+                                            gd.price = gd.distributionPrice;
+                                        }
+                                    }
+                                }
                                 if (goods != null && goods.Any())
                                 {
                                     var result = JArray.FromObject(goods);
@@ -477,6 +518,18 @@
                                     count = goodids.Count;
                                 }
                                 var goods = await _goodsServices.QueryListByComponentsAsync(where, count, orderBy, true, true, 60);
+                                if (goods != null)
+                                {
+                                    bool isDic = await _bfbfComAPIService.IsDictionary(_contextUser.ID);
+                                    //鐧惧垎鍏垫硶缁忛攢鍟嗕慨鏀逛环鏍�
+                                    if (isDic)
+                                    {
+                                        foreach (var gd in goods)
+                                        {
+                                            gd.price = gd.distributionPrice;
+                                        }
+                                    }
+                                }
                                 if (goods != null && goods.Any())
                                 {
                                     var result = JArray.FromObject(goods);

--
Gitblit v1.9.1