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、充值金额将无法用于提现; +

+
+ 去支付 @@ -32,8 +62,10 @@ data() { return { user: {}, // 用户信息 + typeList: [], + topUpTypeId: 0, form: { - money: ''// 储值的金额 + money: 0// 储值的金额 }, rules: { money: [ @@ -56,6 +88,7 @@ }, onLoad() { this.userInfo() + this.getTopUpTypeList(); }, methods: { // 获取用户信息 @@ -66,14 +99,47 @@ } }) }, + // 获取用户信息 + getTopUpTypeList() { + this.$u.api.getTopUpTypeList().then(res => { + if (res.status) { + for (var i = 0; i < res.data.length; i++) { + res.data[i].plain = i != 0; + if (i == 0) { + this.form.money = res.data[0].defaultMoney; + this.topUpTypeId = res.data[0].id; + } + } + this.typeList = res.data; + } + }) + }, + changeMoney(key) { + for (var i = 0; i < this.typeList.length; i++) { + if (key == i) { + this.typeList[i].plain = false; + this.form.money = this.typeList[i].defaultMoney; + this.topUpTypeId = this.typeList[i].id; + } else { + this.typeList[i].plain = true; + } + } + this.$refs.uForm.validateField('form.money') + console.log(key); + console.log(this.topUpTypeId); + }, // 去储值 navigateToHandle() { this.$refs.uForm.validate().then(res => { console.log('验证通过'); + if (this.topUpTypeId <= 0) { + this.$u.toast('请选择您要储值的方案。') + return false; + } if (!Number(this.form.money)) { - this.$u.toast('请输入要储值的金额') + this.$u.toast('请选择您要储值的方案。') } else { - this.$u.route('/pages/payment/pay/pay?recharge=' + Number(this.form.money) + '&type=' + this.orderType) + this.$u.route('/pages/payment/pay/pay?recharge=' + Number(this.topUpTypeId) + '&type=' + this.orderType) } }).catch(errors => { uni.$u.toast('提交的数据校验失败,请输入合法信息!') diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/payment/components/coreshop-paymentsByApp.vue b/CoreCms.Net.Uni-App/CoreShop/pages/payment/components/coreshop-paymentsByApp.vue index d6f689a0..f907796b 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages/payment/components/coreshop-paymentsByApp.vue +++ b/CoreCms.Net.Uni-App/CoreShop/pages/payment/components/coreshop-paymentsByApp.vue @@ -127,10 +127,11 @@ trade_type: 'APP', } } - data['ids'] = (this.type == this.$globalConstVars.paymentType.common || this.type == this.$globalConstVars.paymentType.pinTuan || this.type == this.$globalConstVars.paymentType.group || this.type == this.$globalConstVars.paymentType.seckill || this.type == this.$globalConstVars.paymentType.bargain || this.type == this.$globalConstVars.paymentType.giveaway || this.type == this.$globalConstVars.paymentType.solitaire || this.type == this.$globalConstVars.paymentType.transactionComponent || this.type == this.$globalConstVars.paymentType.serviceOrder) ? this.orderId : this.uid + data.ids = (this.type == this.$globalConstVars.paymentType.common || this.type == this.$globalConstVars.paymentType.pinTuan || this.type == this.$globalConstVars.paymentType.group || this.type == this.$globalConstVars.paymentType.seckill || this.type == this.$globalConstVars.paymentType.bargain || this.type == this.$globalConstVars.paymentType.giveaway || this.type == this.$globalConstVars.paymentType.solitaire || this.type == this.$globalConstVars.paymentType.transactionComponent || this.type == this.$globalConstVars.paymentType.serviceOrder) ? this.orderId : this.uid // 判断订单支付类型 if (this.type == this.$globalConstVars.paymentType.recharge && this.recharge) { + data.ids = this.recharge; data.params.money = this.recharge; } else if ((this.type == this.$globalConstVars.paymentType.formPay || this.type == this.$globalConstVars.paymentType.formOrder) && this.recharge) { data.ids = this.orderId; diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/payment/components/coreshop-paymentsByWx.vue b/CoreCms.Net.Uni-App/CoreShop/pages/payment/components/coreshop-paymentsByWx.vue index 28975f2a..812d7e33 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages/payment/components/coreshop-paymentsByWx.vue +++ b/CoreCms.Net.Uni-App/CoreShop/pages/payment/components/coreshop-paymentsByWx.vue @@ -137,17 +137,14 @@ //trade_type: 'NATIVE', } } - data['ids'] = (this.type == this.$globalConstVars.paymentType.common || this.type == this.$globalConstVars.paymentType.pinTuan || this.type == this.$globalConstVars.paymentType.group || this.type == this.$globalConstVars.paymentType.seckill || this.type == this.$globalConstVars.paymentType.bargain || this.type == this.$globalConstVars.paymentType.giveaway || this.type == this.$globalConstVars.paymentType.solitaire || this.type == this.$globalConstVars.paymentType.transactionComponent || this.type == this.$globalConstVars.paymentType.serviceOrder) ? this.orderId : this.uid + data.ids = (this.type == this.$globalConstVars.paymentType.common || this.type == this.$globalConstVars.paymentType.pinTuan || this.type == this.$globalConstVars.paymentType.group || this.type == this.$globalConstVars.paymentType.seckill || this.type == this.$globalConstVars.paymentType.bargain || this.type == this.$globalConstVars.paymentType.giveaway || this.type == this.$globalConstVars.paymentType.solitaire || this.type == this.$globalConstVars.paymentType.transactionComponent || this.type == this.$globalConstVars.paymentType.serviceOrder) ? this.orderId : this.uid // 判断订单支付类型 if (this.type == this.$globalConstVars.paymentType.recharge && this.recharge) { - data['params'] = { - money: this.recharge - } + data.ids = this.recharge; + data.params.money = this.recharge; } else if ((this.type == this.$globalConstVars.paymentType.formPay || this.type == this.$globalConstVars.paymentType.formOrder) && this.recharge) { - data['ids'] = this.orderId; - data['params'] = { - } + data.ids = this.orderId; } let _this = this switch (code) { @@ -164,7 +161,7 @@ signType: res.data.paymentParameters.signType, paySign: res.data.paymentParameters.paySign, success: function (e) { - uni.hideLoading(); + uni.hideLoading(); if (e.errMsg === 'requestOrderPayment:ok') { _this.$u.route({ type: 'redirectTo', url: '/pages/payment/result/result?id=' + res.data.paymentId }); } diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/payment/pay/pay.vue b/CoreCms.Net.Uni-App/CoreShop/pages/payment/pay/pay.vue index 33761e8d..eaf21efd 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages/payment/pay/pay.vue +++ b/CoreCms.Net.Uni-App/CoreShop/pages/payment/pay/pay.vue @@ -48,10 +48,34 @@ @@ -137,6 +161,7 @@ orderInfo: {}, // 订单详情 userInfo: {}, // 用户信息 serviceInfo: {}, // 服务信息 + topUpType: {}, // 充值类型信息 formId: 0, }; }, @@ -161,11 +186,14 @@ this.type = Number(options.type); this.formId = Number(options.formId); + console.log(this.recharge); + if (this.orderId && (this.type == this.$globalConstVars.paymentType.common || this.type == this.$globalConstVars.paymentType.pinTuan || this.type == this.$globalConstVars.paymentType.group || this.type == this.$globalConstVars.paymentType.seckill || this.type == this.$globalConstVars.paymentType.bargain || this.type == this.$globalConstVars.paymentType.giveaway || this.type == this.$globalConstVars.paymentType.solitaire || this.type == this.$globalConstVars.paymentType.transactionComponent)) { // 商品订单 this.getOrderInfo(); - } else if (this.recharge && this.type == this.$globalConstVars.paymentType.recharge) { + } else if (this.recharge > 0 && this.type == this.$globalConstVars.paymentType.recharge) { // 充值订单 获取用户id + this.getTypeDetail(); this.getUserInfo(); } else if (this.formId && (this.type == this.$globalConstVars.paymentType.formPay || this.type == this.$globalConstVars.paymentType.formOrder)) { // 表单订单 id传到订单上 @@ -209,6 +237,19 @@ } }); }, + //获取单个充值规则 + getTypeDetail() { + let data = { + id: this.recharge + }; + this.$u.api.getTypeDetail(data).then(res => { + if (res.status) { + this.topUpType = res.data; + } else { + this.$u.toast(res.msg); + } + }); + }, // 获取用户信息 getUserInfo() { this.$u.api.userInfo().then(res => { diff --git a/CoreCms.Net.Web.Admin/Controllers/Shop/CoreCmsTopUpTypeController.cs b/CoreCms.Net.Web.Admin/Controllers/Shop/CoreCmsTopUpTypeController.cs new file mode 100644 index 00000000..340455fa --- /dev/null +++ b/CoreCms.Net.Web.Admin/Controllers/Shop/CoreCmsTopUpTypeController.cs @@ -0,0 +1,329 @@ +/*********************************************************************** + * 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.ComponentModel; +using System.IO; +using System.Linq; +using System.Linq.Expressions; +using System.Threading.Tasks; +using CoreCms.Net.Configuration; +using CoreCms.Net.Model.Entities; +using CoreCms.Net.Model.Entities.Expression; +using CoreCms.Net.Model.FromBody; +using CoreCms.Net.Model.ViewModels.UI; +using CoreCms.Net.Filter; +using CoreCms.Net.Loging; +using CoreCms.Net.IServices; +using CoreCms.Net.Utility.Helper; +using CoreCms.Net.Utility.Extensions; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Mvc; +using NPOI.HSSF.UserModel; +using SqlSugar; + +namespace CoreCms.Net.Web.Admin.Controllers +{ + /// + /// 充值类型 + /// + [Description("充值类型")] + [Route("api/[controller]/[action]")] + [ApiController] + [RequiredErrorForAdmin] + [Authorize(Permissions.Name)] + public class CoreCmsTopUpTypeController : ControllerBase + { + private readonly IWebHostEnvironment _webHostEnvironment; + private readonly ICoreCmsTopUpTypeServices _coreCmsTopUpTypeServices; + + /// + /// 构造函数 + /// + public CoreCmsTopUpTypeController(IWebHostEnvironment webHostEnvironment + , ICoreCmsTopUpTypeServices coreCmsTopUpTypeServices + ) + { + _webHostEnvironment = webHostEnvironment; + _coreCmsTopUpTypeServices = coreCmsTopUpTypeServices; + } + + #region 获取列表============================================================ + // POST: Api/CoreCmsTopUpType/GetPageList + /// + /// 获取列表 + /// + /// + [HttpPost] + [Description("获取列表")] + public async Task GetPageList() + { + var jm = new AdminUiCallBack(); + var pageCurrent = Request.Form["page"].FirstOrDefault().ObjectToInt(1); + var pageSize = Request.Form["limit"].FirstOrDefault().ObjectToInt(30); + var where = PredicateBuilder.True(); + //获取排序字段 + var orderField = Request.Form["orderField"].FirstOrDefault(); + + Expression> orderEx = orderField switch + { + "id" => p => p.id, + "title" => p => p.title, + "defaultMoney" => p => p.defaultMoney, + "giftMoney" => p => p.giftMoney, + "giftPoint" => p => p.giftPoint, + "sortId" => p => p.sortId, + "isEnable" => p => p.isEnable, + _ => p => p.sortId + }; + + //设置排序方式 + var orderDirection = Request.Form["orderDirection"].FirstOrDefault(); + var orderBy = orderDirection switch + { + "asc" => OrderByType.Asc, + "desc" => OrderByType.Desc, + _ => OrderByType.Desc + }; + //查询筛选 + + //序列 int + var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0); + if (id > 0) + { + where = where.And(p => p.id == id); + } + //标题 nvarchar + var title = Request.Form["title"].FirstOrDefault(); + if (!string.IsNullOrEmpty(title)) + { + where = where.And(p => p.title.Contains(title)); + } + //充值金额 int + var defaultMoney = Request.Form["defaultMoney"].FirstOrDefault().ObjectToInt(0); + if (defaultMoney > 0) + { + where = where.And(p => p.defaultMoney == defaultMoney); + } + //赠送金额 int + var giftMoney = Request.Form["giftMoney"].FirstOrDefault().ObjectToInt(0); + if (giftMoney > 0) + { + where = where.And(p => p.giftMoney == giftMoney); + } + //赠送积分 int + var giftPoint = Request.Form["giftPoint"].FirstOrDefault().ObjectToInt(0); + if (giftPoint > 0) + { + where = where.And(p => p.giftPoint == giftPoint); + } + //显示排序 int + var sortId = Request.Form["sortId"].FirstOrDefault().ObjectToInt(0); + if (sortId > 0) + { + where = where.And(p => p.sortId == sortId); + } + //是否启用 bit + var isEnable = Request.Form["isEnable"].FirstOrDefault(); + if (!string.IsNullOrEmpty(isEnable) && isEnable.ToLowerInvariant() == "true") + { + where = where.And(p => p.isEnable == true); + } + else if (!string.IsNullOrEmpty(isEnable) && isEnable.ToLowerInvariant() == "false") + { + where = where.And(p => p.isEnable == false); + } + //获取数据 + var list = await _coreCmsTopUpTypeServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize, true); + //返回数据 + jm.data = list; + jm.code = 0; + jm.count = list.TotalCount; + jm.msg = "数据调用成功!"; + return jm; + } + #endregion + + #region 首页数据============================================================ + // POST: Api/CoreCmsTopUpType/GetIndex + /// + /// 首页数据 + /// + /// + [HttpPost] + [Description("首页数据")] + public AdminUiCallBack GetIndex() + { + //返回数据 + var jm = new AdminUiCallBack { code = 0 }; + return jm; + } + #endregion + + #region 创建数据============================================================ + // POST: Api/CoreCmsTopUpType/GetCreate + /// + /// 创建数据 + /// + /// + [HttpPost] + [Description("创建数据")] + public AdminUiCallBack GetCreate() + { + //返回数据 + var jm = new AdminUiCallBack { code = 0 }; + return jm; + } + #endregion + + #region 创建提交============================================================ + // POST: Api/CoreCmsTopUpType/DoCreate + /// + /// 创建提交 + /// + /// + /// + [HttpPost] + [Description("创建提交")] + public async Task DoCreate([FromBody] CoreCmsTopUpType entity) + { + var jm = await _coreCmsTopUpTypeServices.InsertAsync(entity); + return jm; + } + #endregion + + #region 编辑数据============================================================ + // POST: Api/CoreCmsTopUpType/GetEdit + /// + /// 编辑数据 + /// + /// + /// + [HttpPost] + [Description("编辑数据")] + public async Task GetEdit([FromBody] FMIntId entity) + { + var jm = new AdminUiCallBack(); + + var model = await _coreCmsTopUpTypeServices.QueryByIdAsync(entity.id, false); + if (model == null) + { + jm.msg = "不存在此信息"; + return jm; + } + jm.code = 0; + jm.data = model; + + return jm; + } + #endregion + + #region 编辑提交============================================================ + // POST: Api/CoreCmsTopUpType/Edit + /// + /// 编辑提交 + /// + /// + /// + [HttpPost] + [Description("编辑提交")] + public async Task DoEdit([FromBody] CoreCmsTopUpType entity) + { + var jm = await _coreCmsTopUpTypeServices.UpdateAsync(entity); + return jm; + } + #endregion + + #region 删除数据============================================================ + // POST: Api/CoreCmsTopUpType/DoDelete/10 + /// + /// 单选删除 + /// + /// + /// + [HttpPost] + [Description("单选删除")] + public async Task DoDelete([FromBody] FMIntId entity) + { + var jm = new AdminUiCallBack(); + + var model = await _coreCmsTopUpTypeServices.ExistsAsync(p => p.id == entity.id, true); + if (!model) + { + jm.msg = GlobalConstVars.DataisNo; + return jm; + } + jm = await _coreCmsTopUpTypeServices.DeleteByIdAsync(entity.id); + + return jm; + } + #endregion + + + #region 预览数据============================================================ + // POST: Api/CoreCmsTopUpType/GetDetails/10 + /// + /// 预览数据 + /// + /// + /// + [HttpPost] + [Description("预览数据")] + public async Task GetDetails([FromBody] FMIntId entity) + { + var jm = new AdminUiCallBack(); + + var model = await _coreCmsTopUpTypeServices.QueryByIdAsync(entity.id, false); + if (model == null) + { + jm.msg = "不存在此信息"; + return jm; + } + jm.code = 0; + jm.data = model; + + return jm; + } + #endregion + + #region 设置是否启用============================================================ + // POST: Api/CoreCmsTopUpType/DoSetisEnable/10 + /// + /// 设置是否启用 + /// + /// + /// + [HttpPost] + [Description("设置是否启用")] + public async Task DoSetisEnable([FromBody] FMUpdateBoolDataByIntId entity) + { + var jm = new AdminUiCallBack(); + + var oldModel = await _coreCmsTopUpTypeServices.QueryByIdAsync(entity.id, false); + if (oldModel == null) + { + jm.msg = "不存在此信息"; + return jm; + } + oldModel.isEnable = (bool)entity.data; + + var bl = await _coreCmsTopUpTypeServices.UpdateAsync(p => new CoreCmsTopUpType() { isEnable = oldModel.isEnable }, p => p.id == oldModel.id); + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure; + + return jm; + } + #endregion + + + } +} diff --git a/CoreCms.Net.Web.Admin/CoreCms.Net.Web.Admin.xml b/CoreCms.Net.Web.Admin/CoreCms.Net.Web.Admin.xml index c5bb341c..c50e80b4 100644 --- a/CoreCms.Net.Web.Admin/CoreCms.Net.Web.Admin.xml +++ b/CoreCms.Net.Web.Admin/CoreCms.Net.Web.Admin.xml @@ -3975,6 +3975,76 @@ + + + 充值类型 + + + + + 构造函数 + + + + + 获取列表 + + + + + + 首页数据 + + + + + + 创建数据 + + + + + + 创建提交 + + + + + + + 编辑数据 + + + + + + + 编辑提交 + + + + + + + 单选删除 + + + + + + + 预览数据 + + + + + + + 设置是否启用 + + + + 接龙活动表 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');