# 2022-02-11

### 1.3.5 开源社区版(会员专业版同步修改):
无
### 0.1.6 会员专业版:
【新增】后台【平台设置-订单管理】增加【佣金计算通道】功能,分为【仅代理】【仅分销】【先代理后分销】【先分销后代理】四种自选模式。
【新增】增加【CoreCmsAgentOrderDetails】表,实现代理佣金订单详情列表功能,精确到具体商品明细。
【新增】增加【CoreCmsDistributionOrderDetails】表,实现三级佣金订单详情列表功能,精确到具体商品明细。
【修复】修复代理商商铺开启按钮错用三级分销商店铺开关功能,增加代理商商铺开启开关。
【修复】修复代理商佣金明细日期选择范围错乱问题。
【优化】uniapp自带progress进度条更换为uview2.x进度条。
【优化】敏感词过滤组件启用废弃的【WordsMatch】方法,启用【StringSearch】方法替代。
This commit is contained in:
JianWeie
2022-02-11 05:28:04 +08:00
parent 05df55d7ec
commit 8f64209d27
45 changed files with 16751 additions and 607 deletions

View File

@@ -0,0 +1,215 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2022/2/9 23:36:03
* 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
{
/// <summary>
/// 代理佣金明细 接口实现
/// </summary>
public class CoreCmsAgentOrderDetailsRepository : BaseRepository<CoreCmsAgentOrderDetails>, ICoreCmsAgentOrderDetailsRepository
{
private readonly IUnitOfWork _unitOfWork;
public CoreCmsAgentOrderDetailsRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
_unitOfWork = unitOfWork;
}
#region ==========================================================
/// <summary>
/// 重写异步插入方法
/// </summary>
/// <param name="entity">实体数据</param>
/// <returns></returns>
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsAgentOrderDetails entity)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync() > 0;
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
return jm;
}
/// <summary>
/// 重写异步更新方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public new async Task<AdminUiCallBack> UpdateAsync(CoreCmsAgentOrderDetails entity)
{
var jm = new AdminUiCallBack();
var oldModel = await DbClient.Queryable<CoreCmsAgentOrderDetails>().In(entity.id).SingleAsync();
if (oldModel == null)
{
jm.msg = "不存在此信息";
return jm;
}
//事物处理过程开始
oldModel.id = entity.id;
oldModel.agentOrderId = entity.agentOrderId;
oldModel.orderId = entity.orderId;
oldModel.productPrice = entity.productPrice;
oldModel.amount = entity.amount;
oldModel.goodId = entity.goodId;
oldModel.name = entity.name;
oldModel.addon = entity.addon;
oldModel.productId = entity.productId;
oldModel.productNums = entity.productNums;
oldModel.promotionAmount = entity.promotionAmount;
oldModel.imageUrl = entity.imageUrl;
oldModel.remark = entity.remark;
oldModel.createTime = entity.createTime;
//事物处理过程结束
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
return jm;
}
/// <summary>
/// 重写异步更新方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public new async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsAgentOrderDetails> entity)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
return jm;
}
/// <summary>
/// 重写删除指定ID的数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Deleteable<CoreCmsAgentOrderDetails>(id).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
return jm;
}
/// <summary>
/// 重写删除指定ID集合的数据(批量删除)
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Deleteable<CoreCmsAgentOrderDetails>().In(ids).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
return jm;
}
#endregion
#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>
public new async Task<IPageList<CoreCmsAgentOrderDetails>> QueryPageAsync(Expression<Func<CoreCmsAgentOrderDetails, bool>> predicate,
Expression<Func<CoreCmsAgentOrderDetails, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
int pageSize = 20, bool blUseNoLock = false)
{
RefAsync<int> totalCount = 0;
List<CoreCmsAgentOrderDetails> page;
if (blUseNoLock)
{
page = await DbClient.Queryable<CoreCmsAgentOrderDetails>()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new CoreCmsAgentOrderDetails
{
id = p.id,
agentOrderId = p.agentOrderId,
orderId = p.orderId,
productPrice = p.productPrice,
amount = p.amount,
goodId = p.goodId,
name = p.name,
addon = p.addon,
productId = p.productId,
productNums = p.productNums,
promotionAmount = p.promotionAmount,
imageUrl = p.imageUrl,
remark = p.remark,
createTime = p.createTime,
}).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
}
else
{
page = await DbClient.Queryable<CoreCmsAgentOrderDetails>()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new CoreCmsAgentOrderDetails
{
id = p.id,
agentOrderId = p.agentOrderId,
orderId = p.orderId,
productPrice = p.productPrice,
amount = p.amount,
goodId = p.goodId,
name = p.name,
addon = p.addon,
productId = p.productId,
productNums = p.productNums,
promotionAmount = p.promotionAmount,
imageUrl = p.imageUrl,
remark = p.remark,
createTime = p.createTime,
}).ToPageListAsync(pageIndex, pageSize, totalCount);
}
var list = new PageList<CoreCmsAgentOrderDetails>(page, pageIndex, pageSize, totalCount);
return list;
}
#endregion
}
}

View File

@@ -15,9 +15,9 @@ 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.Basics;
using CoreCms.Net.Model.ViewModels.UI;
using SqlSugar;
@@ -32,109 +32,6 @@ namespace CoreCms.Net.Repository
{
}
#region ==========================================================
/// <summary>
/// 重写异步插入方法
/// </summary>
/// <param name="entity">实体数据</param>
/// <returns></returns>
public new async Task<AdminUiCallBack> InsertAsync(CoreCmsAgentOrder entity)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync() > 0;
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
return jm;
}
/// <summary>
/// 重写异步更新方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public new async Task<AdminUiCallBack> UpdateAsync(CoreCmsAgentOrder entity)
{
var jm = new AdminUiCallBack();
var oldModel = await DbClient.Queryable<CoreCmsAgentOrder>().In(entity.id).SingleAsync();
if (oldModel == null)
{
jm.msg = "不存在此信息";
return jm;
}
//事物处理过程开始
oldModel.id = entity.id;
oldModel.userId = entity.userId;
oldModel.buyUserId = entity.buyUserId;
oldModel.orderId = entity.orderId;
oldModel.amount = entity.amount;
oldModel.isSettlement = entity.isSettlement;
oldModel.createTime = entity.createTime;
oldModel.updateTime = entity.updateTime;
oldModel.isDelete = entity.isDelete;
//事物处理过程结束
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
return jm;
}
/// <summary>
/// 重写异步更新方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public new async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsAgentOrder> entity)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
return jm;
}
/// <summary>
/// 重写删除指定ID的数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Deleteable<CoreCmsAgentOrder>(id).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
return jm;
}
/// <summary>
/// 重写删除指定ID集合的数据(批量删除)
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Deleteable<CoreCmsAgentOrder>().In(ids).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
return jm;
}
#endregion
#region
/// <summary>
/// 重写根据条件查询分页数据

View File

@@ -10,15 +10,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
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 CoreCms.Net.Model.ViewModels.Basics;
using CoreCms.Net.Model.ViewModels.DTO;
using CoreCms.Net.Model.ViewModels.DTO.Agent;
using SqlSugar;
@@ -135,10 +136,20 @@ namespace CoreCms.Net.Repository
createTime = dOrder.createTime,
updateTime = dOrder.updateTime,
isDelete = dOrder.isDelete,
buyUserNickName = userInfo.nickName
buyUserNickName = userInfo.nickName,
buyUserAvatar = userInfo.avatarImage,
goodsAmount = cOrder.goodsAmount,
payedAmount = cOrder.payedAmount,
})
.With(SqlWith.NoLock)
.MergeTable()
.Mapper(m =>
{
var id = m.id;
m.agentOrderDetails = DbClient.Queryable<CoreCmsAgentOrderDetails>()
.Where(p => p.agentOrderId == id).ToList();
})
.WhereIF(typeId > 0, p => p.isSettlement == typeId)
.OrderBy(dOrder => dOrder.id, OrderByType.Desc)
.ToPageListAsync(pageIndex, pageSize, totalCount);