mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 17:53:25 +08:00
添加项目文件。
This commit is contained in:
149
CoreCms.Net.IServices/Promotion/ICoreCmsCouponServices.cs
Normal file
149
CoreCms.Net.IServices/Promotion/ICoreCmsCouponServices.cs
Normal file
@@ -0,0 +1,149 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2021/1/31 21:45:10
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CoreCms.Net.IServices
|
||||
{
|
||||
/// <summary>
|
||||
/// 优惠券表 服务工厂接口
|
||||
/// </summary>
|
||||
public interface ICoreCmsCouponServices : IBaseServices<CoreCmsCoupon>
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据优惠券编码取优惠券的信息,并判断是否可用
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="check"></param>
|
||||
Task<WebApiCallBack> CodeToInfo(string[] code, bool check = false);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除核销多个优惠券
|
||||
/// </summary>
|
||||
/// <param name="couponCode">优惠券码</param>
|
||||
/// <param name="orderId">使用序列</param>
|
||||
/// <returns></returns>
|
||||
Task<WebApiCallBack> UsedMultipleCoupon(string[] couponCode, string orderId);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取 我的优惠券
|
||||
/// </summary>
|
||||
/// <param name="userId">用户序列</param>
|
||||
/// <param name="promotionId">促销序列</param>
|
||||
/// <param name="display">优惠券状态编码</param>
|
||||
/// <param name="page">页码</param>
|
||||
/// <param name="limit">数量</param>
|
||||
/// <returns></returns>
|
||||
Task<WebApiCallBack> GetMyCoupon(int userId, int promotionId = 0, string display = "all", int page = 1,
|
||||
int limit = 10);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 用户领取优惠券 插入数据
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="promotionId"></param>
|
||||
/// <param name="promotion"></param>
|
||||
/// <returns></returns>
|
||||
Task<WebApiCallBack> AddData(int userId, int promotionId, CoreCmsPromotion promotion);
|
||||
|
||||
/// <summary>
|
||||
/// 通过优惠券号领取优惠券
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="couponCode"></param>
|
||||
/// <returns></returns>
|
||||
Task<WebApiCallBack> ReceiveCoupon(int userId, string couponCode);
|
||||
|
||||
/// <summary>
|
||||
/// 生成优惠券code 方法
|
||||
/// </summary>
|
||||
/// <param name="noOfCodes">定义一个int类型的参数 用来确定生成多少个优惠码</param>
|
||||
/// <param name="excludeCodesArray">定义一个exclude_codes_array类型的数组</param>
|
||||
/// <param name="codeLength">定义一个code_length的参数来确定优惠码的长度</param>
|
||||
/// <returns></returns>
|
||||
List<string> GeneratePromotionCode(int noOfCodes = 1, List<string> excludeCodesArray = null,
|
||||
int codeLength = 10);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据条件查询分页数据及导航数据
|
||||
/// </summary>
|
||||
/// <param name="predicate">判断集合</param>
|
||||
/// <param name="orderByType">排序方式</param>
|
||||
/// <param name="pageIndex">当前页面索引</param>
|
||||
/// <param name="pageSize">分布大小</param>
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="isToPage">是否分页</param>
|
||||
/// <returns></returns>
|
||||
Task<IPageList<CoreCmsCoupon>> QueryPageMapperAsync(
|
||||
Expression<Func<CoreCmsCoupon, bool>> predicate,
|
||||
Expression<Func<CoreCmsCoupon, object>> orderByExpression, OrderByType orderByType, bool isToPage = false,
|
||||
int pageIndex = 1,
|
||||
int pageSize = 20);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重写数据并获取相关
|
||||
/// </summary>
|
||||
/// <param name="predicate">判断集合</param>
|
||||
/// <param name="orderByType">排序方式</param>
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<CoreCmsCoupon>> QueryWithAboutAsync(Expression<Func<CoreCmsCoupon, bool>> predicate);
|
||||
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
/// </summary>
|
||||
/// <param name="predicate">判断集合</param>
|
||||
/// <param name="orderByType">排序方式</param>
|
||||
/// <param name="pageIndex">当前页面索引</param>
|
||||
/// <param name="pageSize">分布大小</param>
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
new Task<IPageList<CoreCmsCoupon>> QueryPageAsync(
|
||||
Expression<Func<CoreCmsCoupon, bool>> predicate,
|
||||
Expression<Func<CoreCmsCoupon, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取 我的优惠券可用数量
|
||||
/// </summary>
|
||||
/// <param name="userId">用户序列</param>
|
||||
Task<int> GetMyCouponCount(int userId);
|
||||
|
||||
|
||||
#region 优惠券返还
|
||||
|
||||
/// <summary>
|
||||
/// 优惠券返还
|
||||
/// </summary>
|
||||
/// <param name="couponCodes">优惠券数组</param>
|
||||
Task<WebApiCallBack> CancelReturnCoupon(string couponCodes);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2021/1/31 21:45:10
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.DTO;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace CoreCms.Net.IServices
|
||||
{
|
||||
/// <summary>
|
||||
/// 促销条件表 服务工厂接口
|
||||
/// </summary>
|
||||
public interface ICoreCmsPromotionConditionServices : IBaseServices<CoreCmsPromotionCondition>
|
||||
{
|
||||
/// <summary>
|
||||
/// 检查是否满足条件
|
||||
/// </summary>
|
||||
/// <param name="conditionInfo"></param>
|
||||
/// <param name="cart"></param>
|
||||
/// <param name="promotionInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> check(CoreCmsPromotionCondition conditionInfo, CartDto cart, CoreCmsPromotion promotionInfo);
|
||||
|
||||
/// <summary>
|
||||
/// 在促销结果中,如果是商品促销结果,调用此方法,判断商品是否符合需求
|
||||
/// </summary>
|
||||
/// <param name="promotionId"></param>
|
||||
/// <param name="goodsId"></param>
|
||||
/// <param name="nums"></param>
|
||||
/// <returns></returns>
|
||||
Task<int> goods_check(int promotionId, int goodsId, int nums = 1);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 因为计算过促销条件后啊,前面有些是满足条件的,所以,他们的type是2,后面有不满足条件的时候呢,要把前面满足条件的回滚成不满足条件的
|
||||
/// </summary>
|
||||
/// <param name="cart"></param>
|
||||
/// <param name="promotionInfo"></param>
|
||||
/// <returns></returns>
|
||||
CartDto PromotionFalse(CartDto cart, CoreCmsPromotion promotionInfo);
|
||||
|
||||
/// <summary>
|
||||
/// 订单满XX金额时满足条件
|
||||
/// </summary>
|
||||
/// <param name="parameters">参数对象</param>
|
||||
/// <param name="cart"></param>
|
||||
/// <returns></returns>
|
||||
int condition_ORDER_FULL(JObject parameters, CartDto cart);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 所有商品满足条件
|
||||
/// </summary>
|
||||
/// <param name="parameters">参数对象</param>
|
||||
/// <param name="goodsId">商品序列</param>
|
||||
/// <param name="nums">数量</param>
|
||||
/// <returns></returns>
|
||||
int condition_GOODS_ALL(JObject parameters, int goodsId, int nums);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 指定某些商品满足条件
|
||||
/// </summary>
|
||||
/// <param name="parameters">参数对象</param>
|
||||
/// <param name="goodsId">商品序列</param>
|
||||
/// <param name="nums">数量</param>
|
||||
/// <returns></returns>
|
||||
int condition_GoodsIdS(JObject parameters, int goodsId, int nums);
|
||||
|
||||
/// <summary>
|
||||
/// 指定商品分类满足条件
|
||||
/// </summary>
|
||||
/// <param name="parameters">参数对象</param>
|
||||
/// <param name="goodsId">商品序列</param>
|
||||
/// <param name="nums">数量</param>
|
||||
/// <returns></returns>
|
||||
Task<int> condition_GOODS_CATS(JObject parameters, int goodsId, int nums);
|
||||
|
||||
/// <summary>
|
||||
/// 指定商品品牌满足条件
|
||||
/// </summary>
|
||||
/// <param name="parameters">参数对象</param>
|
||||
/// <param name="goodsId">商品序列</param>
|
||||
/// <param name="nums">数量</param>
|
||||
/// <returns></returns>
|
||||
Task<int> condition_GOODS_BRANDS(JObject parameters, int goodsId, int nums);
|
||||
|
||||
/// <summary>
|
||||
/// 指定用户等级满足条件
|
||||
/// </summary>
|
||||
/// <param name="parameters">参数对象</param>
|
||||
/// <param name="userId">用户序列</param>
|
||||
/// <returns></returns>
|
||||
Task<int> condition_USER_GRADE(JObject parameters, int userId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2021/1/31 21:45:10
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
|
||||
namespace CoreCms.Net.IServices
|
||||
{
|
||||
/// <summary>
|
||||
/// 促销活动记录表 服务工厂接口
|
||||
/// </summary>
|
||||
public interface ICoreCmsPromotionRecordServices : IBaseServices<CoreCmsPromotionRecord>
|
||||
{
|
||||
/// <summary>
|
||||
/// 生成订单的时候,增加信息
|
||||
/// </summary>
|
||||
/// <param name="order">订单数据</param>
|
||||
/// <param name="items">货品列表</param>
|
||||
/// <param name="groupId">秒杀团购序列</param>
|
||||
/// <param name="orderType">购物车类型</param>
|
||||
/// <returns></returns>
|
||||
Task<WebApiCallBack> OrderAdd(CoreCmsOrder order, List<CoreCmsOrderItem> items, int groupId, int orderType);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2021/1/31 21:45:10
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.DTO;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace CoreCms.Net.IServices
|
||||
{
|
||||
/// <summary>
|
||||
/// 促销结果表 服务工厂接口
|
||||
/// </summary>
|
||||
public interface ICoreCmsPromotionResultServices : IBaseServices<CoreCmsPromotionResult>
|
||||
{
|
||||
/// <summary>
|
||||
/// 去计算结果
|
||||
/// </summary>
|
||||
/// <param name="resultInfo"></param>
|
||||
/// <param name="cart"></param>
|
||||
/// <param name="promotionInfo"></param>
|
||||
Task<bool> toResult(CoreCmsPromotionResult resultInfo, CartDto cart, CoreCmsPromotion promotionInfo);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 订单减固定金额
|
||||
/// </summary>
|
||||
/// <param name="parameters"></param>
|
||||
/// <param name="cart"></param>
|
||||
/// <param name="promotionInfo"></param>
|
||||
/// <returns></returns>
|
||||
bool result_ORDER_REDUCE(JObject parameters, CartDto cart, CoreCmsPromotion promotionInfo);
|
||||
|
||||
/// <summary>
|
||||
/// 订单打X折
|
||||
/// </summary>
|
||||
/// <param name="parameters"></param>
|
||||
/// <param name="cart"></param>
|
||||
/// <param name="promotionInfo"></param>
|
||||
/// <returns></returns>
|
||||
bool result_ORDER_DISCOUNT(JObject parameters, CartDto cart, CoreCmsPromotion promotionInfo);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 指定商品减固定金额
|
||||
/// </summary>
|
||||
/// <param name="parameters"></param>
|
||||
/// <param name="cartProducts"></param>
|
||||
/// <param name="promotionInfo"></param>
|
||||
/// <returns></returns>
|
||||
decimal result_GOODS_REDUCE(JObject parameters, CartProducts cartProducts, CoreCmsPromotion promotionInfo);
|
||||
|
||||
/// <summary>
|
||||
/// 指定商品打X折
|
||||
/// </summary>
|
||||
/// <param name="parameters"></param>
|
||||
/// <param name="cartProducts"></param>
|
||||
/// <param name="promotionInfo"></param>
|
||||
/// <returns></returns>
|
||||
decimal result_GOODS_DISCOUNT(JObject parameters, CartProducts cartProducts, CoreCmsPromotion promotionInfo);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 商品一口价
|
||||
/// </summary>
|
||||
/// <param name="parameters"></param>
|
||||
/// <param name="cartProducts"></param>
|
||||
/// <param name="promotionInfo"></param>
|
||||
/// <returns></returns>
|
||||
decimal result_GOODS_ONE_PRICE(JObject parameters, CartProducts cartProducts, CoreCmsPromotion promotionInfo);
|
||||
}
|
||||
}
|
||||
85
CoreCms.Net.IServices/Promotion/ICoreCmsPromotionServices.cs
Normal file
85
CoreCms.Net.IServices/Promotion/ICoreCmsPromotionServices.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2021/1/31 21:45:10
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Model.ViewModels.DTO;
|
||||
|
||||
namespace CoreCms.Net.IServices
|
||||
{
|
||||
/// <summary>
|
||||
/// 促销表 服务工厂接口
|
||||
/// </summary>
|
||||
public interface ICoreCmsPromotionServices : IBaseServices<CoreCmsPromotion>
|
||||
{
|
||||
/// <summary>
|
||||
/// 购物车的数据传过来,然后去算促销
|
||||
/// </summary>
|
||||
/// <param name="cart"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
Task<CartDto> ToPromotion(CartDto cart, int type = (int) GlobalEnumVars.PromotionType.Promotion);
|
||||
|
||||
/// <summary>
|
||||
/// 购物车的数据传过来,然后去算优惠券
|
||||
/// </summary>
|
||||
/// <param name="cart"></param>
|
||||
/// <param name="promotions"></param>
|
||||
/// <returns></returns>
|
||||
Task<WebApiCallBack> ToCoupon(CartDto cart, List<CoreCmsPromotion> promotions);
|
||||
|
||||
/// <summary>
|
||||
/// 根据促销信息,去计算购物车的促销情况
|
||||
/// </summary>
|
||||
/// <param name="promotion"></param>
|
||||
/// <param name="cartModel"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> SetPromotion(CoreCmsPromotion promotion, CartDto cartModel);
|
||||
|
||||
/// <summary>
|
||||
/// 获取团购列表数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<WebApiCallBack> GetGroupList(int type, int userId, int status, int pageIndex, int pageSize);
|
||||
|
||||
/// <summary>
|
||||
/// 获取团购/秒杀商品详情
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<WebApiCallBack> GetGroupDetail(int goodId = 0, int userId = 0, string type = "group", int groupId = 0);
|
||||
|
||||
/// <summary>
|
||||
/// 获取可领取的优惠券
|
||||
/// </summary>
|
||||
/// <param name="limit">数量</param>
|
||||
/// <returns></returns>
|
||||
Task<List<CoreCmsPromotion>> ReceiveCouponList(int limit = 3);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取可领取的优惠券(分页)
|
||||
/// </summary>
|
||||
/// <param name="page">页码</param>
|
||||
/// <param name="limit">数量</param>
|
||||
/// <returns></returns>
|
||||
Task<IPageList<CoreCmsPromotion>> GetReceiveCouponList(int page = 1, int limit = 10);
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定id 的优惠券是否可以领取
|
||||
/// </summary>
|
||||
/// <param name="promotionId"></param>
|
||||
/// <returns></returns>
|
||||
Task<WebApiCallBack> ReceiveCoupon(int promotionId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user