From 0b83494673585b75584e96d68fd047cf0d22c7e3 Mon Sep 17 00:00:00 2001
From: 移动系统liao <liaoxujun@qq.com>
Date: 星期二, 21 五月 2024 14:44:52 +0800
Subject: [PATCH] no message
---
CoreCms.Net.Services/Cart/CoreCmsCartServices.cs | 58 ++++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 48 insertions(+), 10 deletions(-)
diff --git a/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs b/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs
index beef4e2..fd19fc0 100644
--- a/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs
+++ b/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs
@@ -1,10 +1,10 @@
/***********************************************************************
- * Project: CoreCms
- * ProjectName: 鏍稿績鍐呭绠$悊绯荤粺
- * Web: https://www.corecms.net
- * Author: 澶х伆鐏�
- * Email: jianweie@163.com
- * CreateTime: 2021/1/31 21:45:10
+ * Project: baifenBinfa
+ * ProjectName: 鐧惧垎鍏垫硶绠$悊绯荤粺
+ * Web: http://chuanyin.com
+ * Author:
+ * Email:
+ * CreateTime: 202403/02
* Description: 鏆傛棤
***********************************************************************/
@@ -12,10 +12,12 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using CoreCms.Net.Auth.HttpContextUser;
using CoreCms.Net.Configuration;
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;
@@ -57,6 +59,8 @@
private readonly ICoreCmsSolitaireServices _solitaireServices;
private readonly ICoreCmsUserShipServices _userShipServices;
private readonly ICoreCmsStoreServices _storeServices;
+ private readonly IBfbfComAPIService _bfbfComAPIService;
+ private readonly IHttpContextUser _user;
public CoreCmsCartServices(
ICoreCmsCartRepository dal
@@ -69,7 +73,17 @@
, ICoreCmsUserServices userServices
, ICoreCmsSettingServices settingServices
, ICoreCmsProductsServices productsServices
- , ICoreCmsPinTuanGoodsServices pinTuanGoodsServices, ICoreCmsPromotionConditionServices promotionConditionServices, ICoreCmsGoodsServices goodsServices, ICoreCmsGoodsCategoryServices goodsCategoryServices, ICoreCmsPromotionResultServices promotionResultServices, ICoreCmsPinTuanRecordServices pinTuanRecordServices, ICoreCmsSolitaireServices solitaireServices, ICoreCmsUserShipServices userShipServices, ICoreCmsStoreServices storeServices)
+ , ICoreCmsPinTuanGoodsServices pinTuanGoodsServices
+ , IBfbfComAPIService bfbfComAPIService
+ ,ICoreCmsPromotionConditionServices promotionConditionServices
+ , ICoreCmsGoodsServices goodsServices
+ , ICoreCmsGoodsCategoryServices goodsCategoryServices
+ , ICoreCmsPromotionResultServices promotionResultServices
+ , ICoreCmsPinTuanRecordServices pinTuanRecordServices
+ , ICoreCmsSolitaireServices solitaireServices
+ , ICoreCmsUserShipServices userShipServices
+ , ICoreCmsStoreServices storeServices
+ ,IHttpContextUser user)
{
this._dal = dal;
base.BaseDal = dal;
@@ -92,6 +106,8 @@
_solitaireServices = solitaireServices;
_userShipServices = userShipServices;
_storeServices = storeServices;
+ _bfbfComAPIService = bfbfComAPIService;
+ _user = user;
}
#region 璁剧疆璐墿杞﹀晢鍝佹暟閲�====================================================
@@ -426,8 +442,9 @@
/// <param name="ids">宸查�夋嫨璐у彿</param>
/// <param name="type">璐墿杞︾被鍨�/鍚岃鍗曠被鍨�</param>
/// <param name="objectId">鍏宠仈闈炶鍗曠被鍨嬫暟鎹簭鍒�</param>
+ /// <param name="goodsId">goodsId</param>
/// <returns></returns>
- public async Task<WebApiCallBack> GetCartDtoData(int userId, int[] ids = null, int type = 1, int objectId = 0)
+ public async Task<WebApiCallBack> GetCartDtoData(int userId, int[] ids = null, int type = 1, int objectId = 0, int goodsId = 0)
{
var jm = new WebApiCallBack() { methodDescription = "鑾峰彇璐墿杞﹀師濮嬪垪琛�(鏈牳绠�)" };
@@ -447,6 +464,17 @@
{
carts = await _dal.QueryListByClauseAsync(p => p.userId == userId && p.type == type, p => p.id, OrderByType.Asc);
}
+
+ if (goodsId>0)
+ {
+ var products = await _productsServices.GetProducts(goodsId);
+ int[] ss = products.Select(x => x.id).ToArray();
+
+ carts = carts.Where(p => ss.Contains(p.productId)).ToList();
+
+ }
+
+
var cartDto = new CartDto { userId = userId, type = type };
foreach (var item in carts)
@@ -503,6 +531,16 @@
{
case (int)GlobalEnumVars.OrderType.Common:
//鏍囧噯妯″紡涓嶉渶瑕佷慨鏀硅鍗曟暟鎹拰鍟嗗搧鏁版嵁
+ {
+ if(await _bfbfComAPIService.IsDictionary(_user.ID))
+ {
+ foreach (var item in cartDto.list)
+ {
+ item.products.price=item.products.distributionPrice;
+
+ }
+ }
+ }
break;
case (int)GlobalEnumVars.OrderType.PinTuan:
//鎷煎洟妯″紡璧版嫾鍥环锛屽幓淇敼鍟嗗搧浠锋牸
@@ -568,11 +606,11 @@
/// <param name="userShipId">鐢ㄦ埛鏀惰揣鍦板潃</param>
/// <param name="objectId">鍏宠仈闈炴櫘閫氳鍗曡惀閿�绫诲瀷搴忓垪</param>
/// <returns></returns>
- public async Task<WebApiCallBack> GetCartInfos(int userId, int[] ids, int orderType, int areaId, int point, string couponCode, int deliveryType = (int)GlobalEnumVars.OrderReceiptType.Logistics, int userShipId = 0, int objectId = 0)
+ public async Task<WebApiCallBack> GetCartInfos(int userId, int[] ids, int orderType, int areaId, int point, string couponCode, int deliveryType = (int)GlobalEnumVars.OrderReceiptType.Logistics, int userShipId = 0, int objectId = 0, int goodsId = 0)
{
var jm = new WebApiCallBack() { methodDescription = "鑾峰彇澶勭悊鍚庣殑璐墿杞︿俊鎭�" };
var cartDto = new CartDto(); //蹇呴』鍒濆鍖�
- var cartDtoData = await GetCartDtoData(userId, ids, orderType, objectId);
+ var cartDtoData = await GetCartDtoData(userId, ids, orderType, objectId, goodsId);
if (!cartDtoData.status)
{
jm.msg = "1";
--
Gitblit v1.9.1