mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 17:23:26 +08:00
【修复】修复商品下架或者删除后,【我的足迹】统计数据及列表不准确的问题。
【修复】修复商品下架或者删除后,【我的收藏】统计数据及列表不准确的问题。
This commit is contained in:
@@ -23,6 +23,16 @@ namespace CoreCms.Net.IRepository
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ICoreCmsGoodsCollectionRepository : IBaseRepository<CoreCmsGoodsCollection>
|
public interface ICoreCmsGoodsCollectionRepository : IBaseRepository<CoreCmsGoodsCollection>
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据用户序列获取用户的收藏
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
|
||||||
|
Task<int> GetUserCountAsync(int userId);
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重写根据条件查询分页数据
|
/// 重写根据条件查询分页数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -23,6 +23,15 @@ namespace CoreCms.Net.IServices
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ICoreCmsGoodsCollectionServices : IBaseServices<CoreCmsGoodsCollection>
|
public interface ICoreCmsGoodsCollectionServices : IBaseServices<CoreCmsGoodsCollection>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 根据用户序列获取用户的收藏
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
|
||||||
|
Task<int> GetUserCountAsync(int userId);
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检查是否收藏了此商品
|
/// 检查是否收藏了此商品
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -32,6 +32,23 @@ namespace CoreCms.Net.Repository
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据用户序列获取用户的足迹数量
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
|
||||||
|
public async Task<int> GetUserCountAsync(int userId)
|
||||||
|
{
|
||||||
|
var count = await DbClient.Queryable<CoreCmsGoodsCollection, CoreCmsGoods>((gc, goods) =>
|
||||||
|
new JoinQueryInfos(JoinType.Left, gc.goodsId == goods.id))
|
||||||
|
.Where((gc, goods) => goods.isDel == false && goods.isMarketable == true && gc.userId == userId).With(SqlWith.NoLock).CountAsync();
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region 重写根据条件查询分页数据
|
#region 重写根据条件查询分页数据
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重写根据条件查询分页数据
|
/// 重写根据条件查询分页数据
|
||||||
@@ -47,7 +64,19 @@ namespace CoreCms.Net.Repository
|
|||||||
int pageSize = 20)
|
int pageSize = 20)
|
||||||
{
|
{
|
||||||
RefAsync<int> totalCount = 0;
|
RefAsync<int> totalCount = 0;
|
||||||
var page = await DbClient.Queryable<CoreCmsGoodsCollection>()
|
var page = await DbClient.Queryable<CoreCmsGoodsCollection, CoreCmsGoods>((gc, goods) =>
|
||||||
|
new JoinQueryInfos(JoinType.Left, gc.goodsId == goods.id))
|
||||||
|
.Where((gc, goods) => goods.isDel == false && goods.isMarketable == true)
|
||||||
|
.Select((gc, goods) => new CoreCmsGoodsCollection
|
||||||
|
{
|
||||||
|
id = gc.id,
|
||||||
|
userId = gc.userId,
|
||||||
|
goodsId = gc.goodsId,
|
||||||
|
createTime = gc.createTime,
|
||||||
|
goodsName = gc.goodsName
|
||||||
|
})
|
||||||
|
.With(SqlWith.NoLock)
|
||||||
|
.MergeTable()
|
||||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||||
.WhereIF(predicate != null, predicate)
|
.WhereIF(predicate != null, predicate)
|
||||||
.Mapper(p => p.goods, p => p.goodsId)
|
.Mapper(p => p.goods, p => p.goodsId)
|
||||||
|
|||||||
@@ -41,6 +41,15 @@ namespace CoreCms.Net.Services
|
|||||||
_unitOfWork = unitOfWork;
|
_unitOfWork = unitOfWork;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据用户序列获取用户的收藏
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<int> GetUserCountAsync(int userId)
|
||||||
|
{
|
||||||
|
return await _dal.GetUserCountAsync(userId);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检查是否收藏了此商品
|
/// 检查是否收藏了此商品
|
||||||
|
|||||||
@@ -841,7 +841,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
|||||||
//足迹
|
//足迹
|
||||||
var footPrintCount = await _goodsBrowsingServices.GetUserCountAsync(user.id);
|
var footPrintCount = await _goodsBrowsingServices.GetUserCountAsync(user.id);
|
||||||
//收藏
|
//收藏
|
||||||
var collectionCount = await _goodsCollectionServices.GetCountAsync(p => p.userId == user.id);
|
var collectionCount = await _goodsCollectionServices.GetUserCountAsync(user.id);
|
||||||
|
|
||||||
if (user.sex != (int)GlobalEnumVars.UserSexTypes.女 && user.sex != (int)GlobalEnumVars.UserSexTypes.男 && user.sex != (int)GlobalEnumVars.UserSexTypes.未知)
|
if (user.sex != (int)GlobalEnumVars.UserSexTypes.女 && user.sex != (int)GlobalEnumVars.UserSexTypes.男 && user.sex != (int)GlobalEnumVars.UserSexTypes.未知)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user