From 7a3a4f8012a72f80d8dd62064a76655c803da864 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期三, 29 五月 2024 12:42:45 +0800
Subject: [PATCH] Merge branch 'master' of http://47.108.235.38:8080/r/baifenbaishop

---
 CoreCms.Net.Services/Cart/CoreCmsCartServices.cs |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs b/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs
index fd19fc0..706bf9e 100644
--- a/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs
+++ b/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs
@@ -120,6 +120,7 @@
         /// <param name="userId"></param>
         /// <param name="numType"></param>
         /// <param name="type"></param>
+        ///  <param name="isCustomizable"></param>
         /// <returns></returns>
         public async Task<WebApiCallBack> SetCartNum(int id, int nums, int userId, int numType, int type = 1)
         {
@@ -145,7 +146,7 @@
                 jm.msg = "鑾峰彇璐墿杞︽暟鎹け璐�";
                 return jm;
             }
-            var outData = await Add(userId, cartModel.productId, nums, numType, type);
+            var outData = await Add(userId, cartModel.productId, nums, numType, type,isCustomizable:cartModel.isCustomizable);
             jm.status = outData.status;
             jm.msg = jm.status ? GlobalConstVars.SetDataSuccess : GlobalConstVars.SetDataFailure;
             jm.otherData = outData;
@@ -195,8 +196,9 @@
         /// <param name="numType">鏁伴噺绫诲瀷/1鏄洿鎺ュ鍔�/2鏄祴鍊�</param>
         /// <param name="cartTypes">1鏅�氳喘鐗╄繕鏄�2鍥㈣喘绉掓潃3鍥㈣喘妯″紡4绉掓潃妯″紡6鐮嶄环妯″紡7璧犲搧</param>
         /// <param name="objectId">鍏宠仈瀵硅薄绫诲瀷</param>
+        /// <param name="isCustomizable">鍏宠仈瀵硅薄绫诲瀷</param>
         /// <returns></returns>
-        public async Task<WebApiCallBack> Add(int userId, int productId, int nums, int numType, int cartTypes = 1, int objectId = 0)
+        public async Task<WebApiCallBack> Add(int userId, int productId, int nums, int numType, int cartTypes = 1, int objectId = 0,bool isCustomizable = false)
         {
             var jm = new WebApiCallBack();
 
@@ -222,6 +224,11 @@
             if (products == null)
             {
                 jm.msg = "鑾峰彇璐у搧淇℃伅澶辫触";
+                return jm;
+            }
+            if(isCustomizable==true&&products.isCustomizable!=true)
+            {
+                jm.msg = "璇ヨ揣鐗╀笉鏀寔瀹氬埗";
                 return jm;
             }
             //鍒ゆ柇鏄惁涓嬫灦
@@ -314,7 +321,9 @@
                     productId = productId,
                     nums = nums,
                     type = cartTypes,
-                    objectId = objectId
+                    objectId = objectId,
+                    //鏀寔瀹氬埗
+                    isCustomizable= isCustomizable,
                 };
                 var outId = await _dal.InsertAsync(catInfo);
                 jm.status = outId > 0;
@@ -354,6 +363,7 @@
         /// <param name="userId">鐢ㄦ埛搴忓垪</param>
         /// <param name="nums">鍔犲叆璐墿杞︽暟閲�</param>
         /// <param name="ruleId">瑙勫垯搴忓垪</param>
+        ///  <param name="ruleId">璐у搧鏄惁瀹氬埗</param>
         public async Task<WebApiCallBack> AddCartHavePinTuan(int productId, int userId = 0, int nums = 1, int ruleId = 0)
         {
             var jm = new WebApiCallBack();
@@ -512,6 +522,7 @@
                 cartProducts.type = item.type;
                 cartProducts.weight = goodsWeight;
                 cartProducts.products = productInfo;
+                cartProducts.isCustomizable = item.isCustomizable;
                 //濡傛灉浼犺繃鏉ヤ簡璐墿杞︽暟鎹紝灏辩畻鎸囧畾鐨勮喘鐗╄溅鐨勬暟鎹紝鍚﹀垯锛屽氨绠楀叏閮ㄨ喘鐗╄溅鐨勬暟鎹�
                 if (ids != null && ids.Any() && ids.Contains(item.id))
                 {
@@ -631,6 +642,13 @@
                 }
                 //鍗曟潯鍟嗗搧鎬讳环
                 item.products.amount = Math.Round(item.nums * (decimal)item.products.price, 2);
+                //瀹氬埗鍟嗗搧娣诲姞瀹氬埗浠锋牸
+                if (item.isCustomizable)
+                //鏄畾鍒跺晢鍝�
+                {
+                    item.products.amount += _bfbfComAPIService.CommandCustomizable(item.nums);
+                    item.CustomizableMoney = _bfbfComAPIService.CommandCustomizable(item.nums);
+                }
 
                 if (item.isSelect)
                 {

--
Gitblit v1.9.1