From 445d14becca6b5251814934343d7a6394ada6009 Mon Sep 17 00:00:00 2001
From: 小飞侠 <8277136+liaoxujun@user.noreply.gitee.com>
Date: 星期五, 17 十月 2025 16:55:19 +0800
Subject: [PATCH] no message
---
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