Commit a7b54baa authored by liudong1993's avatar liudong1993

推荐调整

parent db99d999
...@@ -31,6 +31,10 @@ namespace Mall.Model.Entity.Product ...@@ -31,6 +31,10 @@ namespace Mall.Model.Entity.Product
set; set;
} }
/// <summary> /// <summary>
/// 是否优先推荐同类商品 1是 2否
/// </summary>
public int? DetailRecommendSame { get; set; }
/// <summary>
/// 推荐数量 /// 推荐数量
/// </summary> /// </summary>
public int? DetailRecommendNum public int? DetailRecommendNum
......
...@@ -122,6 +122,10 @@ namespace Mall.Model.Extend.Product ...@@ -122,6 +122,10 @@ namespace Mall.Model.Extend.Product
/// </summary> /// </summary>
public int? GoodsId { get; set; } public int? GoodsId { get; set; }
/// <summary> /// <summary>
/// 排除商品id
/// </summary>
public int? NoGoodsId { get; set; }
/// <summary>
/// 采购商品id /// 采购商品id
/// </summary> /// </summary>
public int? ProcurementGoodsId { get; set; } public int? ProcurementGoodsId { get; set; }
......
...@@ -532,9 +532,46 @@ namespace Mall.Module.Product ...@@ -532,9 +532,46 @@ namespace Mall.Module.Product
} }
} }
} }
var list = goodsRepository.GetAppletGoodsPageList(pageIndex, pageSize, out long count, demodel);
List<RB_Goods_Extend> RList = list; List<RB_Goods_Extend> RList = new List<RB_Goods_Extend>();
List<RB_Goods_Extend> list = new List<RB_Goods_Extend>();
if (demodel.RecommendType == 1 && rmodel.DetailRecommendSame == 1 && demodel.GoodsId > 0)
{
//根据商品查询出分类
var categoryList = goods_CategoryRepository.GetList(new RB_Goods_Category_Extend() { GoodsId = demodel.GoodsId });
if (categoryList.Any())
{
demodel.CategoryIds = string.Join(",", categoryList.Select(x => x.CategoryId ?? 0).Distinct());
demodel.NoGoodsId = demodel.GoodsId;
demodel.GoodsId = 0;
//根据分类 查询出商品列表
list = goodsRepository.GetAppletGoodsPageList(pageIndex, pageSize, out long count, demodel);
//查看商品数量 不足的 根据以前逻辑查询出来补充
if (list.Count() < pageSize)
{
demodel.CategoryIds = "";
int pageSize2 = pageSize - list.Count();
var list2 = goodsRepository.GetAppletGoodsPageList(pageIndex, pageSize2, out long count2, demodel);
if (list2.Any())
{
foreach (var item in list2)
{
list.Add(item);
}
}
}
RList = list;
}
else {
list = goodsRepository.GetAppletGoodsPageList(pageIndex, pageSize, out long count, demodel);
RList = list;
}
}
else
{
list = goodsRepository.GetAppletGoodsPageList(pageIndex, pageSize, out long count, demodel);
RList = list;
}
if (list.Any()) if (list.Any())
{ {
if (demodel.RecommendType == 2 && rmodel.IsOrderRecommend == 1 && !string.IsNullOrEmpty(rmodel.OrderProductIds)) if (demodel.RecommendType == 2 && rmodel.IsOrderRecommend == 1 && !string.IsNullOrEmpty(rmodel.OrderProductIds))
...@@ -635,9 +672,47 @@ namespace Mall.Module.Product ...@@ -635,9 +672,47 @@ namespace Mall.Module.Product
} }
} }
} }
var list = goodsRepository.GetAppletGoodsPageList(pageIndex, pageSize, out long count, demodel);
List<RB_Goods_Extend> RList = list; List<RB_Goods_Extend> RList = new List<RB_Goods_Extend>();
List<RB_Goods_Extend> list = new List<RB_Goods_Extend>();
if (demodel.RecommendType == 1 && rmodel.DetailRecommendSame == 1 && demodel.GoodsId > 0)
{
//根据商品查询出分类
var categoryList = goods_CategoryRepository.GetList(new RB_Goods_Category_Extend() { GoodsId = demodel.GoodsId });
if (categoryList.Any())
{
demodel.CategoryIds = string.Join(",", categoryList.Select(x => x.CategoryId ?? 0).Distinct());
demodel.NoGoodsId = demodel.GoodsId;
demodel.GoodsId = 0;
//根据分类 查询出商品列表
list = goodsRepository.GetAppletGoodsPageList(pageIndex, pageSize, out long count, demodel);
//查看商品数量 不足的 根据以前逻辑查询出来补充
if (list.Count() < pageSize)
{
demodel.CategoryIds = "";
int pageSize2 = pageSize - list.Count();
var list2 = goodsRepository.GetAppletGoodsPageList(pageIndex, pageSize2, out long count2, demodel);
if (list2.Any())
{
foreach (var item in list2)
{
list.Add(item);
}
}
}
RList = list;
}
else
{
list = goodsRepository.GetAppletGoodsPageList(pageIndex, pageSize, out long count, demodel);
RList = list;
}
}
else
{
list = goodsRepository.GetAppletGoodsPageList(pageIndex, pageSize, out long count, demodel);
RList = list;
}
if (list.Any()) if (list.Any())
{ {
if (demodel.RecommendType == 2 && rmodel.IsOrderRecommend == 1 && !string.IsNullOrEmpty(rmodel.OrderProductIds)) if (demodel.RecommendType == 2 && rmodel.IsOrderRecommend == 1 && !string.IsNullOrEmpty(rmodel.OrderProductIds))
...@@ -3697,6 +3772,7 @@ namespace Mall.Module.Product ...@@ -3697,6 +3772,7 @@ namespace Mall.Module.Product
{ nameof(RB_Product_Recommend.CommentRecommentStatus),demodel.CommentRecommentStatus}, { nameof(RB_Product_Recommend.CommentRecommentStatus),demodel.CommentRecommentStatus},
{ nameof(RB_Product_Recommend.DetailRecommendNum),demodel.DetailRecommendNum}, { nameof(RB_Product_Recommend.DetailRecommendNum),demodel.DetailRecommendNum},
{ nameof(RB_Product_Recommend.DetailRecommendStatus),demodel.DetailRecommendStatus}, { nameof(RB_Product_Recommend.DetailRecommendStatus),demodel.DetailRecommendStatus},
{ nameof(RB_Product_Recommend.DetailRecommendSame),demodel.DetailRecommendSame},
{ nameof(RB_Product_Recommend.IsCommentRecommend),demodel.IsCommentRecommend}, { nameof(RB_Product_Recommend.IsCommentRecommend),demodel.IsCommentRecommend},
{ nameof(RB_Product_Recommend.IsOrderRecommend),demodel.IsOrderRecommend}, { nameof(RB_Product_Recommend.IsOrderRecommend),demodel.IsOrderRecommend},
{ nameof(RB_Product_Recommend.OrderCompleteStatus),demodel.OrderCompleteStatus}, { nameof(RB_Product_Recommend.OrderCompleteStatus),demodel.OrderCompleteStatus},
......
...@@ -259,6 +259,7 @@ namespace Mall.Module.User ...@@ -259,6 +259,7 @@ namespace Mall.Module.User
CreateDate = DateTime.Now, CreateDate = DateTime.Now,
DetailRecommendNum = 6, DetailRecommendNum = 6,
DetailRecommendStatus = 1, DetailRecommendStatus = 1,
DetailRecommendSame = 1,
IsCommentRecommend = 2, IsCommentRecommend = 2,
IsOrderRecommend = 2, IsOrderRecommend = 2,
MallBaseId = MallBaseId, MallBaseId = MallBaseId,
......
...@@ -3998,6 +3998,27 @@ namespace Mall.Module.User ...@@ -3998,6 +3998,27 @@ namespace Mall.Module.User
return RList; return RList;
} }
/// <summary>
/// 获取我的线下层级关系
/// </summary>
/// <param name="userId1"></param>
/// <param name="userId2"></param>
/// <returns></returns>
public ApiResult GetMyUserHierarchicalRelationList(int userId1, int userId2)
{
var umodel = member_UserRepository.GetEntity(userId1);
var mymodel = member_UserRepository.GetEntity(userId2);
if (umodel == null) {
return ApiResult.ParamIsNull("当前用户不存在");
}
if (mymodel == null) {
return ApiResult.ParamIsNull("用户不存在");
}
return ApiResult.Success();
}
/// <summary> /// <summary>
/// 获取我的团队自定义信息 /// 获取我的团队自定义信息
/// </summary> /// </summary>
......
...@@ -517,6 +517,9 @@ WHERE {where} group by g.Id order by g.CreateDate desc"; ...@@ -517,6 +517,9 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
{ {
where += $@" and g.{nameof(RB_Goods_Extend.Id)} in({dmodel.GoodsIds})"; where += $@" and g.{nameof(RB_Goods_Extend.Id)} in({dmodel.GoodsIds})";
} }
if (dmodel.NoGoodsId > 0) {
where += $@" and g.{nameof(RB_Goods_Extend.Id)} <> {dmodel.NoGoodsId}";
}
if (!string.IsNullOrEmpty(dmodel.SupplierIds)) if (!string.IsNullOrEmpty(dmodel.SupplierIds))
{ {
where += $@" and g.{nameof(RB_Goods_Extend.SupplierId)} in({dmodel.SupplierIds})"; where += $@" and g.{nameof(RB_Goods_Extend.SupplierId)} in({dmodel.SupplierIds})";
......
...@@ -939,6 +939,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -939,6 +939,7 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
model.Id, model.Id,
model.DetailRecommendStatus, model.DetailRecommendStatus,
model.DetailRecommendSame,
model.DetailRecommendNum, model.DetailRecommendNum,
model.OrderCompleteStatus, model.OrderCompleteStatus,
model.IsOrderRecommend, model.IsOrderRecommend,
......
...@@ -865,6 +865,24 @@ namespace Mall.WebApi.Controllers.User ...@@ -865,6 +865,24 @@ namespace Mall.WebApi.Controllers.User
var robj = userModule.GetUserVipBuyRecommend(GradeId, userInfo); var robj = userModule.GetUserVipBuyRecommend(GradeId, userInfo);
return ApiResult.Success("", robj); return ApiResult.Success("", robj);
} }
/// <summary>
/// 获取我的用户层级关系图
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetMyUserHierarchicalRelationList()
{
var req = RequestParm;
var userInfo = AppletUserInfo;
JObject parms = JObject.Parse(req.msg.ToString());
int UserId = parms.GetInt("UserId", 0);
if (UserId <= 0) {
return ApiResult.ParamIsNull("请传递用户id");
}
return userModule.GetMyUserHierarchicalRelationList(UserId, userInfo.UserId);
}
#endregion #endregion
#region 会员中心 #region 会员中心
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment