diff --git a/CoreCms.Net.Configuration/GlobalEnumVars.cs b/CoreCms.Net.Configuration/GlobalEnumVars.cs
index c7fc3386..7c080c00 100644
--- a/CoreCms.Net.Configuration/GlobalEnumVars.cs
+++ b/CoreCms.Net.Configuration/GlobalEnumVars.cs
@@ -285,6 +285,11 @@ namespace CoreCms.Net.Configuration
///
[Description("邀请用户注册")]
PointTypeInviterUser = 9,
+ ///
+ /// 充值赠送积分
+ ///
+ [Description("充值赠送积分")]
+ PointTypeTopUp = 10,
}
///
@@ -3279,5 +3284,86 @@ namespace CoreCms.Net.Configuration
#endregion
+ #region 小程序直播
+ ///
+ /// 直播类型
+ ///
+ public enum LiveBroadCastLiveType
+ {
+ 推流 = 1,
+ 手机直播 = 0,
+ }
+
+ ///
+ /// 价格类型
+ ///
+ public enum LiveBroadCastGoodPriceType
+ {
+ ///
+ /// 一口价(只需要传入price,price2不传)
+ ///
+ 一口价 = 1,
+
+ ///
+ /// 价格区间(price字段为左边界,price2字段为右边界,price和price2必传)
+ ///
+ 价格区间 = 2,
+
+ ///
+ /// 显示折扣价(price字段为原价,price2字段为现价, price和price2必传)
+ ///
+ 显示折扣价 = 3
+ }
+
+ ///
+ /// 直播状态
+ ///
+ public enum LiveBroadCastLiveStatus
+ {
+ ///
+ /// 直播中
+ ///
+ [Description("")]
+ 直播中 = 101,
+
+ ///
+ /// 未开始
+ ///
+ [Description("")]
+ 未开始 = 102,
+
+ ///
+ /// 已结束
+ ///
+ [Description("")]
+ 已结束 = 103,
+
+ ///
+ /// 禁播
+ ///
+ [Description("")]
+ 禁播 = 104,
+
+ ///
+ /// 暂停
+ ///
+ [Description("")]
+ 暂停 = 105,
+
+ ///
+ /// 异常
+ ///
+ [Description("")]
+ 异常 = 106,
+
+ ///
+ /// 已过期
+ ///
+ [Description("")]
+ 已过期 = 107,
+ }
+
+ #endregion
+
}
}
diff --git a/CoreCms.Net.IRepository/Shop/ICoreCmsTopUpTypeRepository.cs b/CoreCms.Net.IRepository/Shop/ICoreCmsTopUpTypeRepository.cs
new file mode 100644
index 00000000..6a7f881a
--- /dev/null
+++ b/CoreCms.Net.IRepository/Shop/ICoreCmsTopUpTypeRepository.cs
@@ -0,0 +1,82 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2023/3/20 21:20:30
+ * 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.IRepository
+{
+ ///
+ /// 充值类型 工厂接口
+ ///
+ public interface ICoreCmsTopUpTypeRepository : IBaseRepository
+ {
+ #region 重写增删改查操作===========================================================
+
+ ///
+ /// 重写异步插入方法
+ ///
+ ///
+ ///
+ Task InsertAsync(CoreCmsTopUpType entity);
+
+
+ ///
+ /// 重写异步更新方法
+ ///
+ ///
+ ///
+ Task UpdateAsync(CoreCmsTopUpType entity);
+
+
+ ///
+ /// 重写删除指定ID的数据
+ ///
+ ///
+ ///
+ Task DeleteByIdAsync(object id);
+
+ #endregion
+
+ #region 获取缓存的所有数据==========================================================
+
+ ///
+ /// 获取缓存的所有数据
+ ///
+ ///
+ Task> GetCaChe();
+
+ #endregion
+
+
+ ///
+ /// 重写根据条件查询分页数据
+ ///
+ /// 判断集合
+ /// 排序方式
+ /// 当前页面索引
+ /// 分布大小
+ ///
+ /// 是否使用WITH(NOLOCK)
+ ///
+ Task> QueryPageAsync(
+ Expression> predicate,
+ Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1,
+ int pageSize = 20, bool blUseNoLock = false);
+
+ }
+}
diff --git a/CoreCms.Net.IServices/Bill/ICoreCmsBillPaymentsServices.cs b/CoreCms.Net.IServices/Bill/ICoreCmsBillPaymentsServices.cs
index 6170997a..996befb4 100644
--- a/CoreCms.Net.IServices/Bill/ICoreCmsBillPaymentsServices.cs
+++ b/CoreCms.Net.IServices/Bill/ICoreCmsBillPaymentsServices.cs
@@ -48,7 +48,7 @@ namespace CoreCms.Net.IServices
///
/// 支付,先生成支付单,然后去支付
///
- /// 来源,一般是订单号或者用户id,比如充值
+ /// 来源,一般是订单号或者用户id
/// 支付方式
/// 用户序列
/// 订单/充值/服务项目
diff --git a/CoreCms.Net.IServices/Shop/ICoreCmsTopUpTypeServices.cs b/CoreCms.Net.IServices/Shop/ICoreCmsTopUpTypeServices.cs
new file mode 100644
index 00000000..d7b61aca
--- /dev/null
+++ b/CoreCms.Net.IServices/Shop/ICoreCmsTopUpTypeServices.cs
@@ -0,0 +1,80 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2023/3/20 21:20:30
+ * 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
+{
+ ///
+ /// 充值类型 服务工厂接口
+ ///
+ public interface ICoreCmsTopUpTypeServices : IBaseServices
+ {
+ #region 重写增删改查操作===========================================================
+
+ ///
+ /// 重写异步插入方法
+ ///
+ ///
+ ///
+ Task InsertAsync(CoreCmsTopUpType entity);
+
+ ///
+ /// 重写异步更新方法
+ ///
+ ///
+ ///
+ Task UpdateAsync(CoreCmsTopUpType entity);
+
+ ///
+ /// 重写删除指定ID的数据
+ ///
+ ///
+ ///
+ Task DeleteByIdAsync(object id);
+
+ #endregion
+
+
+ #region 获取缓存的所有数据==========================================================
+
+ ///
+ /// 获取缓存的所有数据
+ ///
+ ///
+ Task> GetCaChe();
+
+ #endregion
+
+ #region 重写根据条件查询分页数据
+ ///
+ /// 重写根据条件查询分页数据
+ ///
+ /// 判断集合
+ /// 排序方式
+ /// 当前页面索引
+ /// 分布大小
+ ///
+ /// 是否使用WITH(NOLOCK)
+ ///
+ Task> QueryPageAsync(
+ Expression> predicate,
+ Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1,
+ int pageSize = 20, bool blUseNoLock = false);
+ #endregion
+ }
+}
diff --git a/CoreCms.Net.Model/CoreCms.Net.Model.xml b/CoreCms.Net.Model/CoreCms.Net.Model.xml
index 95f4e7b6..01e1b933 100644
--- a/CoreCms.Net.Model/CoreCms.Net.Model.xml
+++ b/CoreCms.Net.Model/CoreCms.Net.Model.xml
@@ -6211,6 +6211,56 @@
距离说明
+
+
+ 充值类型
+
+
+
+
+ 构造函数
+
+
+
+
+ 序列
+
+
+
+
+ 标题
+
+
+
+
+ 充值金额
+
+
+
+
+ 赠送金额
+
+
+
+
+ 赠送积分
+
+
+
+
+ 显示排序
+
+
+
+
+ 是否启用
+
+
+
+
+ 说明
+
+
接龙活动表
@@ -10622,6 +10672,11 @@
用户前端编码
+
+
+ 来源类型(对标GlobalEnumVars下的UserAccountTypes)
+
+
微信小程序登录解码数据
diff --git a/CoreCms.Net.Model/Entities/Shop/CoreCmsTopUpType.cs b/CoreCms.Net.Model/Entities/Shop/CoreCmsTopUpType.cs
new file mode 100644
index 00000000..4a4e5b16
--- /dev/null
+++ b/CoreCms.Net.Model/Entities/Shop/CoreCmsTopUpType.cs
@@ -0,0 +1,92 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2023/3/20 21:20:30
+ * Description: 暂无
+ ***********************************************************************/
+
+using System.ComponentModel.DataAnnotations;
+using SqlSugar;
+
+namespace CoreCms.Net.Model.Entities;
+
+///
+/// 充值类型
+///
+public class CoreCmsTopUpType
+{
+ ///
+ /// 构造函数
+ ///
+ public CoreCmsTopUpType()
+ {
+ }
+
+ ///
+ /// 序列
+ ///
+ [Display(Name = "序列")]
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+ [Required(ErrorMessage = "请输入{0}")]
+ public int id { get; set; }
+
+
+ ///
+ /// 标题
+ ///
+ [Display(Name = "标题")]
+ [Required(ErrorMessage = "请输入{0}")]
+ [StringLength(50, ErrorMessage = "{0}不能超过{1}字")]
+ public string title { get; set; }
+
+ ///
+ /// 充值金额
+ ///
+ [Display(Name = "充值金额")]
+ [Required(ErrorMessage = "请输入{0}")]
+ public int defaultMoney { get; set; }
+
+
+ ///
+ /// 赠送金额
+ ///
+ [Display(Name = "赠送金额")]
+ [Required(ErrorMessage = "请输入{0}")]
+ public int giftMoney { get; set; }
+
+
+ ///
+ /// 赠送积分
+ ///
+ [Display(Name = "赠送积分")]
+ [Required(ErrorMessage = "请输入{0}")]
+ public int giftPoint { get; set; }
+
+
+ ///
+ /// 显示排序
+ ///
+ [Display(Name = "显示排序")]
+ [Required(ErrorMessage = "请输入{0}")]
+ public int sortId { get; set; }
+
+
+ ///
+ /// 是否启用
+ ///
+ [Display(Name = "是否启用")]
+ [Required(ErrorMessage = "请输入{0}")]
+ public bool isEnable { get; set; }
+
+
+ ///
+ /// 说明
+ ///
+ [Display(Name = "说明")]
+ [Required(ErrorMessage = "请输入{0}")]
+ [StringLength(100, ErrorMessage = "{0}不能超过{1}字")]
+ public string description { get; set; }
+}
\ No newline at end of file
diff --git a/CoreCms.Net.Repository/Shop/CoreCmsTopUpTypeRepository.cs b/CoreCms.Net.Repository/Shop/CoreCmsTopUpTypeRepository.cs
new file mode 100644
index 00000000..8fd7480c
--- /dev/null
+++ b/CoreCms.Net.Repository/Shop/CoreCmsTopUpTypeRepository.cs
@@ -0,0 +1,180 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2023/3/20 21:20:30
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Caching.Manual;
+using CoreCms.Net.Configuration;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.IRepository;
+using CoreCms.Net.IRepository.UnitOfWork;
+using CoreCms.Net.Model.ViewModels.UI;
+using SqlSugar;
+
+namespace CoreCms.Net.Repository
+{
+ ///
+ /// 充值类型 接口实现
+ ///
+ public class CoreCmsTopUpTypeRepository : BaseRepository, ICoreCmsTopUpTypeRepository
+ {
+ private readonly IUnitOfWork _unitOfWork;
+ public CoreCmsTopUpTypeRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
+ {
+ _unitOfWork = unitOfWork;
+ }
+
+ #region 实现重写增删改查操作==========================================================
+
+ ///
+ /// 重写异步插入方法
+ ///
+ /// 实体数据
+ ///
+ public async Task InsertAsync(CoreCmsTopUpType entity)
+ {
+ var jm = new AdminUiCallBack();
+
+ var bl = await DbClient.Insertable(entity).RemoveDataCache().ExecuteReturnIdentityAsync() > 0;
+ jm.code = bl ? 0 : 1;
+ jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
+
+ return jm;
+ }
+
+ ///
+ /// 重写异步更新方法
+ ///
+ ///
+ ///
+ public async Task UpdateAsync(CoreCmsTopUpType entity)
+ {
+ var jm = new AdminUiCallBack();
+
+ var oldModel = await DbClient.Queryable().In(entity.id).SingleAsync();
+ if (oldModel == null)
+ {
+ jm.msg = "不存在此信息";
+ return jm;
+ }
+ //事物处理过程开始
+ oldModel.id = entity.id;
+ oldModel.title = entity.title;
+ oldModel.description = entity.description;
+ oldModel.defaultMoney = entity.defaultMoney;
+ oldModel.giftMoney = entity.giftMoney;
+ oldModel.giftPoint = entity.giftPoint;
+ oldModel.sortId = entity.sortId;
+ oldModel.isEnable = entity.isEnable;
+
+ //事物处理过程结束
+ var bl = await DbClient.Updateable(oldModel).RemoveDataCache().ExecuteCommandHasChangeAsync();
+ jm.code = bl ? 0 : 1;
+ jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
+
+ return jm;
+ }
+
+ ///
+ /// 重写删除指定ID的数据
+ ///
+ ///
+ ///
+ public async Task DeleteByIdAsync(object id)
+ {
+ var jm = new AdminUiCallBack();
+
+ var bl = await DbClient.Deleteable(id).ExecuteCommandHasChangeAsync();
+ jm.code = bl ? 0 : 1;
+ jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
+
+ return jm;
+ }
+
+
+ #endregion
+
+ #region 获取缓存的所有数据==========================================================
+
+ ///
+ /// 获取缓存的所有数据
+ ///
+ ///
+ public async Task> GetCaChe()
+ {
+ var list = await DbClient.Queryable().With(SqlWith.NoLock).WithCache().ToListAsync();
+ return list;
+ }
+
+ #endregion
+
+
+ #region 重写根据条件查询分页数据
+ ///
+ /// 重写根据条件查询分页数据
+ ///
+ /// 判断集合
+ /// 排序方式
+ /// 当前页面索引
+ /// 分布大小
+ ///
+ /// 是否使用WITH(NOLOCK)
+ ///
+ public async Task> QueryPageAsync(Expression> predicate,
+ Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1,
+ int pageSize = 20, bool blUseNoLock = false)
+ {
+ RefAsync totalCount = 0;
+ List page;
+ if (blUseNoLock)
+ {
+ page = await DbClient.Queryable()
+ .OrderByIF(orderByExpression != null, orderByExpression, orderByType)
+ .WhereIF(predicate != null, predicate).Select(p => new CoreCmsTopUpType
+ {
+ id = p.id,
+ title = p.title,
+ description = p.description,
+ defaultMoney = p.defaultMoney,
+ giftMoney = p.giftMoney,
+ giftPoint = p.giftPoint,
+ sortId = p.sortId,
+ isEnable = p.isEnable,
+
+ }).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
+ }
+ else
+ {
+ page = await DbClient.Queryable()
+ .OrderByIF(orderByExpression != null, orderByExpression, orderByType)
+ .WhereIF(predicate != null, predicate).Select(p => new CoreCmsTopUpType
+ {
+ id = p.id,
+ title = p.title,
+ description = p.description,
+ defaultMoney = p.defaultMoney,
+ giftMoney = p.giftMoney,
+ giftPoint = p.giftPoint,
+ sortId = p.sortId,
+ isEnable = p.isEnable,
+
+ }).ToPageListAsync(pageIndex, pageSize, totalCount);
+ }
+ var list = new PageList(page, pageIndex, pageSize, totalCount);
+ return list;
+ }
+
+ #endregion
+
+ }
+}
diff --git a/CoreCms.Net.Services/Bill/CoreCmsBillPaymentsServices.cs b/CoreCms.Net.Services/Bill/CoreCmsBillPaymentsServices.cs
index 1091e3a1..403adc51 100644
--- a/CoreCms.Net.Services/Bill/CoreCmsBillPaymentsServices.cs
+++ b/CoreCms.Net.Services/Bill/CoreCmsBillPaymentsServices.cs
@@ -58,6 +58,8 @@ namespace CoreCms.Net.Services
private readonly ICoreCmsServicesServices _servicesServices;
private readonly ICoreCmsUserServicesOrderServices _userServicesOrderServices;
private readonly ICoreCmsUserWeChatInfoServices _userWeChatInfoServices;
+ private readonly ICoreCmsTopUpTypeServices _topUpTypeServices;
+ private readonly ICoreCmsUserPointLogServices _userPointLogServices;
private readonly WeChatOptions _weChatOptions;
@@ -75,8 +77,7 @@ namespace CoreCms.Net.Services
, IServiceProvider serviceProvider, ICoreCmsServicesServices servicesServices
, ICoreCmsUserServicesOrderServices userServicesOrderServices
, ICoreCmsUserWeChatInfoServices userWeChatInfoServices
- , IOptions weChatOptions
- )
+ , IOptions weChatOptions, ICoreCmsTopUpTypeServices topUpTypeServices, ICoreCmsUserPointLogServices userPointLogServices)
{
this._dal = dal;
base.BaseDal = dal;
@@ -94,6 +95,8 @@ namespace CoreCms.Net.Services
_servicesServices = servicesServices;
_userServicesOrderServices = userServicesOrderServices;
_userWeChatInfoServices = userWeChatInfoServices;
+ _topUpTypeServices = topUpTypeServices;
+ _userPointLogServices = userPointLogServices;
_weChatOptions = weChatOptions.Value;
}
@@ -152,9 +155,17 @@ namespace CoreCms.Net.Services
//充值
else if (type == (int)GlobalEnumVars.BillPaymentsType.Recharge)
{
- if (@params != null && @params.ContainsKey("money"))
+ var typeId = Convert.ToInt16(orderId);
+ var typeModel = await _topUpTypeServices.QueryByClauseAsync(p => p.id == typeId, true);
+
+ if (typeModel != null)
{
- dto.money = @params["money"].ObjectToDecimal(0); //充值金额
+ dto.rel.Add(new Rel()
+ {
+ sourceId = orderId,
+ money = typeModel.defaultMoney
+ });
+ dto.money += typeModel.defaultMoney;
}
else
{
@@ -162,11 +173,7 @@ namespace CoreCms.Net.Services
jm.msg = "请输入正确的充值金额";
return jm;
}
- dto.rel.Add(new Rel()
- {
- sourceId = orderId,
- money = dto.money
- });
+
jm.status = true;
jm.data = dto;
}
@@ -310,23 +317,27 @@ namespace CoreCms.Net.Services
//充值
else if (type == (int)GlobalEnumVars.BillPaymentsType.Recharge)
{
- if (@params != null && @params.ContainsKey("money"))
- {
- dto.money = @params["money"].ObjectToDecimal(0); //充值金额
- }
- else
- {
- jm.status = false;
- jm.msg = "请输入正确的充值金额";
- return jm;
- }
foreach (var item in sourceStr)
{
- dto.rel.Add(new Rel()
+ var typeId = Convert.ToInt16(item);
+ var typeModel = await _topUpTypeServices.QueryByClauseAsync(p => p.id == typeId, true);
+
+ if (typeModel != null)
{
- sourceId = item,
- money = dto.money
- });
+ dto.rel.Add(new Rel()
+ {
+ sourceId = item,
+ money = typeModel.defaultMoney
+ });
+ dto.money += typeModel.defaultMoney;
+ }
+ else
+ {
+ jm.status = false;
+ jm.msg = "请输入正确的充值金额";
+ return jm;
+ }
+
}
jm.status = true;
jm.data = dto;
@@ -425,7 +436,7 @@ namespace CoreCms.Net.Services
///
/// 支付,先生成支付单,然后去支付
///
- /// 来源,一般是订单号或者用户id,比如充值
+ /// 来源,一般是订单号或者用户id
/// 支付方式
/// 用户序列
/// 订单/充值/服务订单
@@ -443,10 +454,10 @@ namespace CoreCms.Net.Services
var jm = new WebApiCallBack();
//如果支付类型为余额充值,那么资源ID就是用户ID
- if (type == (int)GlobalEnumVars.BillPaymentsType.Recharge)
- {
- sourceStr = userId.ToString();
- }
+ //if (type == (int)GlobalEnumVars.BillPaymentsType.Recharge)
+ //{
+ // sourceStr = userId.ToString();
+ //}
//判断支付方式是否开启
var paymentInfo = await _paymentsServices.QueryByClauseAsync(p => p.code == paymentCode && p.isEnable == true);
if (paymentInfo == null)
@@ -611,6 +622,12 @@ namespace CoreCms.Net.Services
jm.data = jm.code = 10059;
jm.msg = GlobalErrorCodeVars.Code10059;
+ jm.otherData = new
+ {
+ sourceStrArr,
+ sourceStr,
+ paymentRelData
+ };
return jm;
}
//取支付标题,就不往数据库里存了吧
@@ -679,8 +696,20 @@ namespace CoreCms.Net.Services
else if (billPaymentInfo.type == (int)GlobalEnumVars.BillPaymentsType.Recharge)
{
//给用户做充值
- var userId = billPaymentInfo.sourceId.ObjectToInt(0);
- await _userBalanceServices.Change(userId, (int)GlobalEnumVars.UserBalanceSourceTypes.Recharge, billPaymentInfo.money, billPaymentInfo.paymentId);
+ var topUpTypeId = billPaymentInfo.sourceId.ObjectToInt(0);
+
+ var topUpTypeModel = await _topUpTypeServices.QueryByClauseAsync(p => p.id == topUpTypeId, true);
+ if (topUpTypeModel != null)
+ {
+ var topUpMoney = topUpTypeModel.defaultMoney + topUpTypeModel.giftMoney;
+ await _userBalanceServices.Change(billPaymentInfo.userId, (int)GlobalEnumVars.UserBalanceSourceTypes.Recharge, topUpMoney, billPaymentInfo.paymentId);
+
+ if (topUpTypeModel.giftPoint > 0)
+ {
+ await _userPointLogServices.SetPoint(billPaymentInfo.userId, topUpTypeModel.giftPoint,
+ (int)GlobalEnumVars.UserPointSourceTypes.PointTypeTopUp, "充值赠送积分");
+ }
+ }
}
else if (billPaymentInfo.type == (int)GlobalEnumVars.BillPaymentsType.ServiceOrder)
{
diff --git a/CoreCms.Net.Services/Shop/CoreCmsTopUpTypeServices.cs b/CoreCms.Net.Services/Shop/CoreCmsTopUpTypeServices.cs
new file mode 100644
index 00000000..cc00c261
--- /dev/null
+++ b/CoreCms.Net.Services/Shop/CoreCmsTopUpTypeServices.cs
@@ -0,0 +1,111 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2023/3/20 21:20:30
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Configuration;
+using CoreCms.Net.IRepository;
+using CoreCms.Net.IRepository.UnitOfWork;
+using CoreCms.Net.IServices;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.Model.ViewModels.UI;
+using SqlSugar;
+
+
+namespace CoreCms.Net.Services
+{
+ ///
+ /// 充值类型 接口实现
+ ///
+ public class CoreCmsTopUpTypeServices : BaseServices, ICoreCmsTopUpTypeServices
+ {
+ private readonly ICoreCmsTopUpTypeRepository _dal;
+ private readonly IUnitOfWork _unitOfWork;
+
+ public CoreCmsTopUpTypeServices(IUnitOfWork unitOfWork, ICoreCmsTopUpTypeRepository dal)
+ {
+ this._dal = dal;
+ base.BaseDal = dal;
+ _unitOfWork = unitOfWork;
+ }
+
+ #region 实现重写增删改查操作==========================================================
+
+ ///
+ /// 重写异步插入方法
+ ///
+ /// 实体数据
+ ///
+ public async Task InsertAsync(CoreCmsTopUpType entity)
+ {
+ return await _dal.InsertAsync(entity);
+ }
+
+ ///
+ /// 重写异步更新方法方法
+ ///
+ ///
+ ///
+ public async Task UpdateAsync(CoreCmsTopUpType entity)
+ {
+ return await _dal.UpdateAsync(entity);
+ }
+
+
+ ///
+ /// 重写删除指定ID的数据
+ ///
+ ///
+ ///
+ public async Task DeleteByIdAsync(object id)
+ {
+ return await _dal.DeleteByIdAsync(id);
+ }
+
+
+ #endregion
+
+ #region 获取缓存的所有数据==========================================================
+
+ ///
+ /// 获取缓存的所有数据
+ ///
+ ///
+ public async Task> GetCaChe()
+ {
+ return await _dal.GetCaChe();
+ }
+
+ #endregion
+
+ #region 重写根据条件查询分页数据
+ ///
+ /// 重写根据条件查询分页数据
+ ///
+ /// 判断集合
+ /// 排序方式
+ /// 当前页面索引
+ /// 分布大小
+ ///
+ /// 是否使用WITH(NOLOCK)
+ ///
+ public async Task> QueryPageAsync(Expression> predicate,
+ Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1,
+ int pageSize = 20, bool blUseNoLock = false)
+ {
+ return await _dal.QueryPageAsync(predicate, orderByExpression, orderByType, pageIndex, pageSize, blUseNoLock);
+ }
+ #endregion
+
+ }
+}
diff --git a/CoreCms.Net.Uni-App/CoreShop/common/request/http.api.js b/CoreCms.Net.Uni-App/CoreShop/common/request/http.api.js
index 558a9a85..44c5907f 100644
--- a/CoreCms.Net.Uni-App/CoreShop/common/request/http.api.js
+++ b/CoreCms.Net.Uni-App/CoreShop/common/request/http.api.js
@@ -409,6 +409,12 @@ const install = (Vue, vm) => {
let getLiveInfo = (params, config = {}) => http.post('/Api/LiveBroadCast/GetLiveInfo', params, { custom: { methodName: 'liveBroadCast.getLiveInfo', needToken: false } });
+ //充值规则列表
+ let getTopUpTypeList = (params, config = {}) => http.post('/Api/TopUp/TypeList', params, { custom: { methodName: 'topUp.typeList', needToken: false } });
+ //获取单个充值规则
+ let getTypeDetail = (params, config = {}) => http.post('/Api/TopUp/getTypeDetail', params, { custom: { methodName: 'topUp.getTypeDetail', needToken: false } });
+
+
// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
vm.$u.api = {
shopConfigV2,
@@ -602,7 +608,10 @@ const install = (Vue, vm) => {
getSolitairePageList,
getSolitaireDetail,
- getLiveInfo
+ getLiveInfo,
+
+ getTopUpTypeList,
+ getTypeDetail
};
}
diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/member/balance/recharge/recharge.vue b/CoreCms.Net.Uni-App/CoreShop/pages/member/balance/recharge/recharge.vue
index 969a6192..ee1de9c5 100644
--- a/CoreCms.Net.Uni-App/CoreShop/pages/member/balance/recharge/recharge.vue
+++ b/CoreCms.Net.Uni-App/CoreShop/pages/member/balance/recharge/recharge.vue
@@ -15,10 +15,40 @@
{{ user.balance || '0'}}
-
-
+
+
+
+
+ 请选择您的充值方案
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 充值须知:
+
+
+ 1、充值金额永不过期;
+
+
+ 2、充值一经办理,概不退款;
+
+
+ 3、充值金额将无法用于提现;
+
+
+
+
+
+ 充值类型
+
+
+
+
+ 构造函数
+
+
+
+
+ 获取列表
+
+
+
+
+
+ 首页数据
+
+
+
+
+
+ 创建数据
+
+
+
+
+
+ 创建提交
+
+
+
+
+
+
+ 编辑数据
+
+
+
+
+
+
+ 编辑提交
+
+
+
+
+
+
+ 单选删除
+
+
+
+
+
+
+ 预览数据
+
+
+
+
+
+
+ 设置是否启用
+
+
+
+
接龙活动表
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/shop/topuptype/topuptype/create.html b/CoreCms.Net.Web.Admin/wwwroot/views/shop/topuptype/topuptype/create.html
new file mode 100644
index 00000000..e4e769ab
--- /dev/null
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/shop/topuptype/topuptype/create.html
@@ -0,0 +1,89 @@
+
+
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/shop/topuptype/topuptype/details.html b/CoreCms.Net.Web.Admin/wwwroot/views/shop/topuptype/topuptype/details.html
new file mode 100644
index 00000000..e23b9233
--- /dev/null
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/shop/topuptype/topuptype/details.html
@@ -0,0 +1,90 @@
+
+
\ No newline at end of file
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/shop/topuptype/topuptype/edit.html b/CoreCms.Net.Web.Admin/wwwroot/views/shop/topuptype/topuptype/edit.html
new file mode 100644
index 00000000..f8e51d10
--- /dev/null
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/shop/topuptype/topuptype/edit.html
@@ -0,0 +1,86 @@
+
+
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/shop/topuptype/topuptype/index.html b/CoreCms.Net.Web.Admin/wwwroot/views/shop/topuptype/topuptype/index.html
new file mode 100644
index 00000000..bd6f1853
--- /dev/null
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/shop/topuptype/topuptype/index.html
@@ -0,0 +1,328 @@
+充值类型
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CoreCms.Net.Web.WebApi/Controllers/TopUpController.cs b/CoreCms.Net.Web.WebApi/Controllers/TopUpController.cs
new file mode 100644
index 00000000..21e5c83e
--- /dev/null
+++ b/CoreCms.Net.Web.WebApi/Controllers/TopUpController.cs
@@ -0,0 +1,77 @@
+using CoreCms.Net.IServices;
+using CoreCms.Net.Model.FromBody;
+using CoreCms.Net.Model.ViewModels.UI;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using SqlSugar;
+using System.Threading.Tasks;
+
+namespace CoreCms.Net.Web.WebApi.Controllers
+{
+ ///
+ /// 充值接口
+ ///
+ [Route("api/[controller]/[action]")]
+ [ApiController]
+ public class TopUpController : ControllerBase
+ {
+
+ private readonly ICoreCmsTopUpTypeServices _topUpTypeServices;
+
+ ///
+ /// 构造函数
+ ///
+ ///
+ public TopUpController(ICoreCmsTopUpTypeServices topUpTypeServices)
+ {
+ _topUpTypeServices = topUpTypeServices;
+ }
+
+
+ #region 获取充值规则列表
+ ///
+ /// 获取通知列表
+ ///
+ ///
+ [HttpPost]
+ public async Task TypeList()
+ {
+ var jm = new WebApiCallBack();
+
+ var list = await _topUpTypeServices.QueryListByClauseAsync(p => p.isEnable == true, p => p.sortId, OrderByType.Desc, true, true);
+ jm.status = true;
+ jm.data = list;
+
+ return jm;
+ }
+
+ #endregion
+
+
+ #region 获取单个充值规则
+ ///
+ /// 获取单个充值规则
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task GetTypeDetail([FromBody] FMIntId entity)
+ {
+ var jm = new WebApiCallBack();
+
+ var model = await _topUpTypeServices.QueryByClauseAsync(p => p.id == entity.id, true, true);
+ if (model == null)
+ {
+ jm.msg = "数据获取失败";
+ return jm;
+ }
+ jm.status = true;
+ jm.data = model;
+ return jm;
+
+ }
+ #endregion
+
+
+ }
+}
diff --git a/CoreCms.Net.Web.WebApi/CoreCms.Net.Web.WebApi.xml b/CoreCms.Net.Web.WebApi/CoreCms.Net.Web.WebApi.xml
index aa751869..d04215b3 100644
--- a/CoreCms.Net.Web.WebApi/CoreCms.Net.Web.WebApi.xml
+++ b/CoreCms.Net.Web.WebApi/CoreCms.Net.Web.WebApi.xml
@@ -992,6 +992,30 @@
+
+
+ 充值接口
+
+
+
+
+ 构造函数
+
+
+
+
+
+ 获取通知列表
+
+
+
+
+
+ 获取单个充值规则
+
+
+
+
用户操作事件
diff --git a/数据库/MySql/20230327/升级脚本/1、创建表.sql b/数据库/MySql/20230327/升级脚本/1、创建表.sql
new file mode 100644
index 00000000..3e3667f1
--- /dev/null
+++ b/数据库/MySql/20230327/升级脚本/1、创建表.sql
@@ -0,0 +1,13 @@
+create table if not exists CoreCmsTopUpType
+(
+ id int auto_increment comment '序列'
+ primary key,
+ title varchar(50) not null comment '标题',
+ defaultMoney int default 0 not null comment '充值金额',
+ giftMoney int default 0 not null comment '赠送金额',
+ giftPoint int default 0 not null comment '赠送积分',
+ sortId int default 1 not null comment '显示排序',
+ isEnable bit default b'1' not null comment '是否启用',
+ description varchar(100) charset utf8 null comment '说明'
+)
+ comment '充值类型';
\ No newline at end of file
diff --git a/数据库/MySql/20230327/升级脚本/2、插入示例数据.sql b/数据库/MySql/20230327/升级脚本/2、插入示例数据.sql
new file mode 100644
index 00000000..d0f9522f
--- /dev/null
+++ b/数据库/MySql/20230327/升级脚本/2、插入示例数据.sql
@@ -0,0 +1,4 @@
+INSERT INTO coreshop.CoreCmsTopUpType (id, title, defaultMoney, giftMoney, giftPoint, sortId, isEnable, description) VALUES (1, '冲100送10', 100, 10, 0, 3, true, '冲100送10');
+INSERT INTO coreshop.CoreCmsTopUpType (id, title, defaultMoney, giftMoney, giftPoint, sortId, isEnable, description) VALUES (2, '冲10元送5元', 1, 5, 7, 4, true, '冲10元送5元');
+INSERT INTO coreshop.CoreCmsTopUpType (id, title, defaultMoney, giftMoney, giftPoint, sortId, isEnable, description) VALUES (3, '冲500送50', 500, 50, 0, 2, true, '冲500送50');
+INSERT INTO coreshop.CoreCmsTopUpType (id, title, defaultMoney, giftMoney, giftPoint, sortId, isEnable, description) VALUES (4, '冲1000送120', 1000, 120, 0, 1, true, '冲1000送120');