Commit 169870a7 authored by liudong1993's avatar liudong1993

课程列表+详情

parent 8a6ce82a
...@@ -66,6 +66,11 @@ namespace Mall.Common.Enum.Goods ...@@ -66,6 +66,11 @@ namespace Mall.Common.Enum.Goods
/// 司导商品 /// 司导商品
/// </summary> /// </summary>
[EnumField("司导商品")] [EnumField("司导商品")]
SDGoods = 11 SDGoods = 11,
/// <summary>
/// 网教课程
/// </summary>
[EnumField("网教课程")]
KCGoods = 12,
} }
} }
...@@ -16,6 +16,10 @@ namespace Mall.Model.Extend.Product ...@@ -16,6 +16,10 @@ namespace Mall.Model.Extend.Product
[DB(ConnectionName = "DefaultConnection")] [DB(ConnectionName = "DefaultConnection")]
public class RB_Goods_Extend : RB_Goods public class RB_Goods_Extend : RB_Goods
{ {
/// <summary>
/// 课程是否已付款
/// </summary>
public bool IsPay { get; set; }
/// <summary> /// <summary>
/// 课程列表 /// 课程列表
/// </summary> /// </summary>
......
...@@ -17,10 +17,6 @@ namespace Mall.Model.Extend.Product ...@@ -17,10 +17,6 @@ namespace Mall.Model.Extend.Product
/// 商品ids /// 商品ids
/// </summary> /// </summary>
public string GoodsIds { get; set; } public string GoodsIds { get; set; }
/// <summary>
/// 文件类型 1腾讯 2阿里云
/// </summary>
public int PathType { get; set; }
} }
/// <summary> /// <summary>
......
...@@ -21,5 +21,9 @@ namespace Mall.Model.Extend.Product ...@@ -21,5 +21,9 @@ namespace Mall.Model.Extend.Product
/// 教师名称 /// 教师名称
/// </summary> /// </summary>
public string Name { get; set; } public string Name { get; set; }
/// <summary>
/// 教师头像
/// </summary>
public string TeacherLogo { get; set; }
} }
} }
...@@ -79,23 +79,11 @@ namespace Mall.Module.Education ...@@ -79,23 +79,11 @@ namespace Mall.Module.Education
/// <summary> /// <summary>
/// 分销商等级 /// 分销商等级
/// </summary> /// </summary>
private readonly RB_Distributor_GradeRepository distributor_GradeRepository = new RB_Distributor_GradeRepository(); private readonly RB_Distributor_GradeRepository distributor_GradeRepository = new RB_Distributor_GradeRepository();
/// <summary>
/// 分销商
/// </summary>
private readonly RB_Distributor_InfoRepository distributor_InfoRepository = new RB_Distributor_InfoRepository();
/// <summary> /// <summary>
/// 会员等级 /// 会员等级
/// </summary> /// </summary>
private readonly RB_Member_GradeRepository member_GradeRepository = new RB_Member_GradeRepository(); private readonly RB_Member_GradeRepository member_GradeRepository = new RB_Member_GradeRepository();
/// <summary>
/// 微店
/// </summary>
private RB_SmallShops_InfoRepository smallShops_InfoRepository = new RB_SmallShops_InfoRepository();
/// <summary>
/// 微店商品价格
/// </summary>
private RB_SmallShops_PriceRepository smallShops_PriceRepository = new RB_SmallShops_PriceRepository();
/// <summary> /// <summary>
/// 会员信息 /// 会员信息
...@@ -1151,132 +1139,6 @@ namespace Mall.Module.Education ...@@ -1151,132 +1139,6 @@ namespace Mall.Module.Education
#endregion #endregion
#region 小程序课程
/// <summary>
/// 获取小程序课程列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Goods_Extend> GetAppletCoursePageList(int pageIndex, int pageSize, out long count, RB_Goods_Extend demodel)
{
var list = goodsRepository.GetAppletGoodsPageList(pageIndex, pageSize, out count, demodel, 2);
if (list.Any())
{
//会员价格
var MemberPriceList = new List<RB_Goods_MemberPrice_Extend>();
if (list.Where(x => x.EnjoyMember == 1 && x.SeparateSetMember == 1).Any())
{
string goodsIds = string.Join(",", list.Where(x => x.EnjoyMember == 1 && x.SeparateSetMember == 1).Select(x => x.Id));
MemberPriceList = goods_MemberPriceRepository.GetList(new RB_Goods_MemberPrice_Extend() { GoodsIds = goodsIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
}
string goodsIds2 = string.Join(",", list.Select(x => x.Id));
List<RB_Goods_Order_Extend> orderlist = goods_OrderRepository.GetGoodsOrderNum(goodsIds: goodsIds2);
#region 微店价格
RB_SmallShops_Info smallModel = new RB_SmallShops_Info();
List<RB_SmallShops_Price_Extend> smallPList = new List<RB_SmallShops_Price_Extend>();
if (demodel.SmallShopsId > 0)
{
smallModel = smallShops_InfoRepository.GetEntity(demodel.SmallShopsId);
smallPList = smallShops_PriceRepository.GetList(new RB_SmallShops_Price_Extend() { SmallShopsId = demodel.SmallShopsId, GoodsIds = goodsIds2 });
}
#endregion
foreach (var item in list)
{
item.CoverImage = "";
if (!string.IsNullOrEmpty(item.CarouselImage) && item.CarouselImage != "[]")
{
List<string> CarouselIdList = JsonConvert.DeserializeObject<List<string>>(item.CarouselImage);
//封面图
item.CoverImage = CarouselIdList[0];
}
if (demodel.SmallShopsId > 0)
{
if ((smallModel.UpPrice ?? 0) > 0 || smallPList.Where(x => x.GoodsId == item.Id && x.UpPrice > 0).Any())
{
var sspModel = smallPList.Where(x => x.GoodsId == item.Id && x.SpecificationKey == "").FirstOrDefault();
if (sspModel != null)
{
//单商品设置的
if (sspModel.PriceType == 1)
{
item.SellingPrice = (item.SellingPrice ?? 0) + Math.Ceiling((item.SellingPrice ?? 0) * (sspModel.UpPrice ?? 0) / 100);
}
else if (sspModel.PriceType == 2)
{
item.SellingPrice = (item.SellingPrice ?? 0) + (sspModel.UpPrice ?? 0);
}
}
else
{
if ((smallModel.UpPrice ?? 0) > 0)
{
if (smallModel.PriceType == 1)
{
item.SellingPrice = (item.SellingPrice ?? 0) + Math.Ceiling((item.SellingPrice ?? 0) * (smallModel.UpPrice ?? 0) / 100);
}
else if (smallModel.PriceType == 2)
{
item.SellingPrice = (item.SellingPrice ?? 0) + (smallModel.UpPrice ?? 0);
}
}
}
}
}
if (item.EnjoyMember == 1 && item.SeparateSetMember == 1)
{
item.MemberPriceList = MemberPriceList.Where(x => x.GoodsId == item.Id).ToList();
#region 微店处理会员价格
if (item.MemberPriceList.Any() && demodel.SmallShopsId > 0)
{
if ((smallModel.UpPrice ?? 0) > 0 || smallPList.Where(x => x.GoodsId == item.Id && x.UpPrice > 0).Any())
{
foreach (var mqitem in item.MemberPriceList)
{
var sspModel = smallPList.Where(x => x.SpecificationKey == mqitem.SpecificationSort).FirstOrDefault();
if (sspModel != null)
{
//单商品设置的
if (sspModel.PriceType == 1)
{
mqitem.MemberPrice = (mqitem.MemberPrice ?? 0) + Math.Ceiling((mqitem.MemberPrice ?? 0) * (sspModel.UpPrice ?? 0) / 100);
}
else if (sspModel.PriceType == 2)
{
mqitem.MemberPrice = (mqitem.MemberPrice ?? 0) + (sspModel.UpPrice ?? 0);
}
}
else
{
if ((smallModel.UpPrice ?? 0) > 0)
{
if (smallModel.PriceType == 1)
{
mqitem.MemberPrice = (mqitem.MemberPrice ?? 0) + Math.Ceiling((mqitem.MemberPrice ?? 0) * (smallModel.UpPrice ?? 0) / 100);
}
else if (smallModel.PriceType == 2)
{
mqitem.MemberPrice = (mqitem.MemberPrice ?? 0) + (smallModel.UpPrice ?? 0);
}
}
}
}
}
}
#endregion
}
item.SalesNum += (orderlist.Where(x => x.GoodsId == item.Id).FirstOrDefault()?.OrderNum ?? 0);
}
}
return list;
}
#endregion
#region 教师管理 #region 教师管理
/// <summary> /// <summary>
///教师配置列表 ///教师配置列表
......
...@@ -171,6 +171,7 @@ namespace Mall.Module.Product ...@@ -171,6 +171,7 @@ namespace Mall.Module.Product
private readonly RB_Distributor_FXCommissionRepository distributor_FXCommissionRepository = new RB_Distributor_FXCommissionRepository(); private readonly RB_Distributor_FXCommissionRepository distributor_FXCommissionRepository = new RB_Distributor_FXCommissionRepository();
private RB_FreeShippingRepository freeShippingRepository = new RB_FreeShippingRepository(); private RB_FreeShippingRepository freeShippingRepository = new RB_FreeShippingRepository();
/// <summary> /// <summary>
/// 微店基础 /// 微店基础
/// </summary> /// </summary>
...@@ -183,6 +184,14 @@ namespace Mall.Module.Product ...@@ -183,6 +184,14 @@ namespace Mall.Module.Product
/// 微店商品价格 /// 微店商品价格
/// </summary> /// </summary>
private RB_SmallShops_PriceRepository smallShops_PriceRepository = new RB_SmallShops_PriceRepository(); private RB_SmallShops_PriceRepository smallShops_PriceRepository = new RB_SmallShops_PriceRepository();
/// <summary>
/// 课程
/// </summary>
private readonly RB_Goods_WK_CourseRepository goods_WK_CourseRepository = new RB_Goods_WK_CourseRepository();
/// <summary>
/// 教师
/// </summary>
private readonly RB_Goods_WK_TeacherRepository goods_WK_TeacherRepository = new RB_Goods_WK_TeacherRepository();
...@@ -2632,6 +2641,767 @@ namespace Mall.Module.Product ...@@ -2632,6 +2641,767 @@ namespace Mall.Module.Product
} }
#endregion #endregion
#region 小程序课程
/// <summary>
/// 获取小程序课程列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Goods_Extend> GetAppletCoursePageList(int pageIndex, int pageSize, out long count, RB_Goods_Extend demodel)
{
var list = goodsRepository.GetAppletGoodsPageList(pageIndex, pageSize, out count, demodel, 2);
if (list.Any())
{
//会员价格
var MemberPriceList = new List<RB_Goods_MemberPrice_Extend>();
if (list.Where(x => x.EnjoyMember == 1 && x.SeparateSetMember == 1).Any())
{
string goodsIds = string.Join(",", list.Where(x => x.EnjoyMember == 1 && x.SeparateSetMember == 1).Select(x => x.Id));
MemberPriceList = goods_MemberPriceRepository.GetList(new RB_Goods_MemberPrice_Extend() { GoodsIds = goodsIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
}
string goodsIds2 = string.Join(",", list.Select(x => x.Id));
List<RB_Goods_Order_Extend> orderlist = goods_OrderRepository.GetGoodsOrderNum(goodsIds: goodsIds2);
#region 微店价格
RB_SmallShops_Info smallModel = new RB_SmallShops_Info();
List<RB_SmallShops_Price_Extend> smallPList = new List<RB_SmallShops_Price_Extend>();
if (demodel.SmallShopsId > 0)
{
smallModel = smallShops_InfoRepository.GetEntity(demodel.SmallShopsId);
smallPList = smallShops_PriceRepository.GetList(new RB_SmallShops_Price_Extend() { SmallShopsId = demodel.SmallShopsId, GoodsIds = goodsIds2 });
}
#endregion
#region 是否购买
List<RB_Goods_Order_Extend> opaylist = new List<RB_Goods_Order_Extend>();
if (demodel.UserId > 0)
{
opaylist = goods_OrderRepository.GetCourseOrderIsPay(GoodsIds: goodsIds2, UserId: demodel.UserId ?? 0);
}
#endregion
foreach (var item in list)
{
item.CoverImage = "";
if (!string.IsNullOrEmpty(item.CarouselImage) && item.CarouselImage != "[]")
{
List<string> CarouselIdList = JsonConvert.DeserializeObject<List<string>>(item.CarouselImage);
//封面图
item.CoverImage = CarouselIdList[0];
}
if (demodel.SmallShopsId > 0)
{
if ((smallModel.UpPrice ?? 0) > 0 || smallPList.Where(x => x.GoodsId == item.Id && x.UpPrice > 0).Any())
{
var sspModel = smallPList.Where(x => x.GoodsId == item.Id && x.SpecificationKey == "").FirstOrDefault();
if (sspModel != null)
{
//单商品设置的
if (sspModel.PriceType == 1)
{
item.SellingPrice = (item.SellingPrice ?? 0) + Math.Ceiling((item.SellingPrice ?? 0) * (sspModel.UpPrice ?? 0) / 100);
}
else if (sspModel.PriceType == 2)
{
item.SellingPrice = (item.SellingPrice ?? 0) + (sspModel.UpPrice ?? 0);
}
}
else
{
if ((smallModel.UpPrice ?? 0) > 0)
{
if (smallModel.PriceType == 1)
{
item.SellingPrice = (item.SellingPrice ?? 0) + Math.Ceiling((item.SellingPrice ?? 0) * (smallModel.UpPrice ?? 0) / 100);
}
else if (smallModel.PriceType == 2)
{
item.SellingPrice = (item.SellingPrice ?? 0) + (smallModel.UpPrice ?? 0);
}
}
}
}
}
if (item.EnjoyMember == 1 && item.SeparateSetMember == 1)
{
item.MemberPriceList = MemberPriceList.Where(x => x.GoodsId == item.Id).ToList();
#region 微店处理会员价格
if (item.MemberPriceList.Any() && demodel.SmallShopsId > 0)
{
if ((smallModel.UpPrice ?? 0) > 0 || smallPList.Where(x => x.GoodsId == item.Id && x.UpPrice > 0).Any())
{
foreach (var mqitem in item.MemberPriceList)
{
var sspModel = smallPList.Where(x => x.SpecificationKey == mqitem.SpecificationSort).FirstOrDefault();
if (sspModel != null)
{
//单商品设置的
if (sspModel.PriceType == 1)
{
mqitem.MemberPrice = (mqitem.MemberPrice ?? 0) + Math.Ceiling((mqitem.MemberPrice ?? 0) * (sspModel.UpPrice ?? 0) / 100);
}
else if (sspModel.PriceType == 2)
{
mqitem.MemberPrice = (mqitem.MemberPrice ?? 0) + (sspModel.UpPrice ?? 0);
}
}
else
{
if ((smallModel.UpPrice ?? 0) > 0)
{
if (smallModel.PriceType == 1)
{
mqitem.MemberPrice = (mqitem.MemberPrice ?? 0) + Math.Ceiling((mqitem.MemberPrice ?? 0) * (smallModel.UpPrice ?? 0) / 100);
}
else if (smallModel.PriceType == 2)
{
mqitem.MemberPrice = (mqitem.MemberPrice ?? 0) + (smallModel.UpPrice ?? 0);
}
}
}
}
}
}
#endregion
}
item.SalesNum += (orderlist.Where(x => x.GoodsId == item.Id).FirstOrDefault()?.OrderNum ?? 0);
if (demodel.UserId > 0) {
var omodel = opaylist.Where(x => x.GoodsId == item.Id).FirstOrDefault();
if (omodel != null)
{
if (omodel.PaymentTime.HasValue)
{
item.IsPay = true;
}
}
}
}
}
return list;
}
/// <summary>
/// 获取小程序课程详情
/// </summary>
/// <param name="goodsId"></param>
/// <param name="UserId"></param>
/// <param name="SmallShopsId"></param>
/// <param name="TenantId"></param>
/// <param name="MallBaseId"></param>
/// <returns></returns>
public object GetAppletCourseInfo(int goodsId, int UserId, int SmallShopsId, int TenantId, int MallBaseId)
{
var model = goodsRepository.GetEntity(goodsId).RefMapperTo<RB_Goods_Extend>();
if (model == null || model.TenantId != TenantId || model.MallBaseId != MallBaseId)
{
return null;
}
else
{
model.CoverImage = "";
if (!string.IsNullOrEmpty(model.CarouselImage) && model.CarouselImage != "[]")
{
List<string> CarouselIdList = JsonConvert.DeserializeObject<List<string>>(model.CarouselImage);
//封面图
model.CoverImage = CarouselIdList[0];
}
}
RB_Member_User_Extend userModel = new RB_Member_User_Extend();
if (UserId > 0)
{
userModel = member_UserRepository.GetEntity<RB_Member_User_Extend>(UserId);
if (SmallShopsId == 0)
{
SmallShopsId = userModel.SmallShopId;
}
}
#region 基本信息
//查询分类
model.CategoryList = goods_CategoryRepository.GetList(new RB_Goods_Category_Extend() { GoodsId = goodsId, TenantId = TenantId, MallBaseId = MallBaseId });
#region 微店价格
RB_SmallShops_Info smallModel = new RB_SmallShops_Info();
List<RB_SmallShops_Price_Extend> smallPList = new List<RB_SmallShops_Price_Extend>();
if (SmallShopsId > 0)
{
smallModel = smallShops_InfoRepository.GetEntity(SmallShopsId);
smallPList = smallShops_PriceRepository.GetList(new RB_SmallShops_Price_Extend() { SmallShopsId = SmallShopsId, GoodsId = goodsId });
if (((smallModel.UpPrice ?? 0) > 0 || smallPList.Where(x => x.UpPrice > 0).Any()))
{
var sspModel = smallPList.Where(x => x.SpecificationKey == "").FirstOrDefault();
if (sspModel != null)
{
//单商品设置的
if (sspModel.PriceType == 1)
{
model.SellingPrice = (model.SellingPrice ?? 0) + Math.Ceiling((model.SellingPrice ?? 0) * (sspModel.UpPrice ?? 0) / 100);
model.OriginalPrice = (model.OriginalPrice ?? 0) + Math.Ceiling((model.OriginalPrice ?? 0) * (sspModel.UpPrice ?? 0) / 100);
}
else if (sspModel.PriceType == 2)
{
model.SellingPrice = (model.SellingPrice ?? 0) + (sspModel.UpPrice ?? 0);
model.OriginalPrice = (model.OriginalPrice ?? 0) + (sspModel.UpPrice ?? 0);
}
}
else
{
if ((smallModel.UpPrice ?? 0) > 0)
{
if (smallModel.PriceType == 1)
{
model.SellingPrice = (model.SellingPrice ?? 0) + Math.Ceiling((model.SellingPrice ?? 0) * (smallModel.UpPrice ?? 0) / 100);
model.OriginalPrice = (model.OriginalPrice ?? 0) + Math.Ceiling((model.OriginalPrice ?? 0) * (smallModel.UpPrice ?? 0) / 100);
}
else if (smallModel.PriceType == 2)
{
model.SellingPrice = (model.SellingPrice ?? 0) + (smallModel.UpPrice ?? 0);
model.OriginalPrice = (model.OriginalPrice ?? 0) + (smallModel.UpPrice ?? 0);
}
}
}
}
}
#endregion
//最大售价
decimal MaxSellMoney = model.SellingPrice ?? 0;
//区域
model.AreaList = new List<RB_Goods_Area_Extend>();
if (model.IsAreaBuy == 1)
{
model.AreaList = goods_AreaRepository.GetList(new RB_Goods_Area_Extend() { GoodsId = goodsId, TenantId = TenantId, MallBaseId = MallBaseId });
}
//返佣
model.DistributionCommissionList = new List<RB_Goods_DistributionCommission_Extend>();
if (model.SeparateDistribution == 1)
{
model.DistributionCommissionList = goods_DistributionCommissionRepository.GetList(new RB_Goods_DistributionCommission_Extend() { GoodsId = goodsId, TenantId = TenantId, MallBaseId = MallBaseId });
}
//会员价格
model.MemberPriceList = new List<RB_Goods_MemberPrice_Extend>();
if (model.EnjoyMember == 1 && model.SeparateSetMember == 1)
{
model.MemberPriceList = goods_MemberPriceRepository.GetList(new RB_Goods_MemberPrice_Extend() { GoodsId = goodsId, TenantId = TenantId, MallBaseId = MallBaseId });
}
#region 微店处理会员价格
if (model.MemberPriceList.Any() && SmallShopsId > 0)
{
if ((smallModel.UpPrice ?? 0) > 0 || smallPList.Where(x => x.UpPrice > 0).Any())
{
foreach (var item in model.MemberPriceList)
{
var sspModel = smallPList.Where(x => x.SpecificationKey == item.SpecificationSort).FirstOrDefault();
if (sspModel != null)
{
//单商品设置的
if (sspModel.PriceType == 1)
{
item.MemberPrice = (item.MemberPrice ?? 0) + Math.Ceiling((item.MemberPrice ?? 0) * (sspModel.UpPrice ?? 0) / 100);
}
else if (sspModel.PriceType == 2)
{
item.MemberPrice = (item.MemberPrice ?? 0) + (sspModel.UpPrice ?? 0);
}
}
else
{
if ((smallModel.UpPrice ?? 0) > 0)
{
if (smallModel.PriceType == 1)
{
item.MemberPrice = (item.MemberPrice ?? 0) + Math.Ceiling((item.MemberPrice ?? 0) * (smallModel.UpPrice ?? 0) / 100);
}
else if (smallModel.PriceType == 2)
{
item.MemberPrice = (item.MemberPrice ?? 0) + (smallModel.UpPrice ?? 0);
}
}
}
}
}
}
#endregion
model.CustomShareImagePath = model.CustomShareImage;
#endregion
#region 是否收藏
model.Favorite = false;
if (UserId > 0)
{
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Member_Collection_Extend.UserId),
FiledValue=UserId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Member_Collection_Extend.GoodsId),
FiledValue=goodsId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Member_Collection_Extend.TenantId),
FiledValue=TenantId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Member_Collection_Extend.MallBaseId),
FiledValue=MallBaseId,
OperatorEnum=OperatorEnum.Equal
},
};
if (member_CollectionRepository.Exists(wheres))
{
model.Favorite = true;
}
}
#endregion
#region 最高返佣
model.MaxShare = 0;
decimal MyBuyCommission = 0;//自购返利
var BasicsModel = distributor_BasicsRepository.GetList(new RB_Distributor_Basics_Extend() { TenantId = TenantId, MallBaseId = MallBaseId }).FirstOrDefault();
if (UserId > 0)
{
//获取分销商信息
var disModel = distributor_InfoRepository.GetList(new RB_Distributor_Info_Extend() { TenantId = TenantId, MallBaseId = MallBaseId, UserId = UserId, AuditStatus = Common.Enum.User.DistributorAuditStatusEnum.Audited }).FirstOrDefault();
if (disModel != null)
{
if ((BasicsModel?.IsEnableFXGrade ?? 2) == 1)
{
if ((model.PresentFXGrade ?? 0) == 0)
{
var FXList = distributor_FXGradeRepository.GetList(new RB_Distributor_FXGrade_Extend() { TenantId = TenantId, MallBaseId = MallBaseId });
if (FXList.Any() && FXList.Where(x => x.IsGuest == 1).Any())
{
var FXModel = FXList.Where(x => x.Id == disModel.FXGradeId).FirstOrDefault();
var PModel = FXList.Where(x => x.IsGuest == 1).FirstOrDefault();
if (FXModel != null && PModel != null)
{
decimal CRate = 0;
if (FXModel.Id == PModel.Id)
{
CRate = FXModel.SiblingRatio ?? 0;
}
else
{
CRate = (FXModel.CommissionRatio ?? 0) - (PModel.CommissionRatio ?? 0);
}
if (model.IsCustomSpecification == 1)
{
var dcModel = model.SpecificationPriceList.OrderByDescending(x => x.Commission).FirstOrDefault();
if (dcModel.Commission > 0)
{
if (FXModel.DecimalType == 1)
{
model.MaxShare = Math.Ceiling(dcModel.Commission * CRate / 100);
MyBuyCommission = Math.Ceiling(dcModel.Commission * (FXModel.CommissionRatio ?? 0) / 100);
}
else
{
model.MaxShare = Math.Ceiling(dcModel.Commission * CRate) / 100;
MyBuyCommission = Math.Ceiling(dcModel.Commission * (FXModel.CommissionRatio ?? 0)) / 100;
}
}
}
else
{
if (model.Commission > 0)
{
if (FXModel.DecimalType == 1)
{
model.MaxShare = Math.Ceiling(model.Commission * CRate / 100);
MyBuyCommission = Math.Ceiling(model.Commission * (FXModel.CommissionRatio ?? 0) / 100);
}
else
{
model.MaxShare = Math.Ceiling(model.Commission * CRate) / 100;
MyBuyCommission = Math.Ceiling(model.Commission * (FXModel.CommissionRatio ?? 0)) / 100;
}
}
}
}
}
}
else
{
//是否展示分享vip佣金
var fxcommissionList = distributor_FXCommissionRepository.GetFXCommissionList(new RB_Distributor_FXCommission_Extend() { TenantId = TenantId, MallBaseId = MallBaseId, FXGradeId = disModel.FXGradeId ?? 0 });
if (fxcommissionList.Any())
{
model.MaxShare = fxcommissionList.Max(x => x.CommissionPrice ?? 0);
}
}
}
else
{
if (model.SeparateDistribution == 1)
{
var dcList = model.DistributionCommissionList.Where(x => x.DistributorGrade == disModel.GradeId).ToList();
//if ((BasicsModel?.IsCommissionResidue ?? 2) == 1)
//{
// model.MaxShare = dcList.Max(x => (x.OneCommission ?? 0) + (x.TwoCommission ?? 0) + (x.ThreeCommission ?? 0));
//}
//else
//{
model.MaxShare = dcList.Max(x => x.OneCommission ?? 0);
//}
// 这里需注意,可能需要分销 是否提所有返佣控制
if (model.SeparateDistributionMoneyType == 1)
{
model.MaxShare = Math.Round(model.MaxShare * MaxSellMoney / 100, 2, MidpointRounding.AwayFromZero);
}
}
else
{
if (disModel.GradeId == 0)
{
//拿分销基础配置
//if ((BasicsModel?.IsCommissionResidue ?? 2) == 1)
//{
// model.MaxShare = (BasicsModel?.OneCommission ?? 0) + (BasicsModel?.TwoCommission ?? 0) + (BasicsModel?.ThreeCommission ?? 0);
//}
//else
//{
model.MaxShare = BasicsModel?.OneCommission ?? 0;
//}
if ((BasicsModel?.DistributorCommissionType ?? 2) == 1)
{
model.MaxShare = Math.Round(model.MaxShare * MaxSellMoney / 100, 2, MidpointRounding.AwayFromZero);
}
}
else if (disModel.GradeId > 0)
{
//获取分销商等级
var disgradeModel = distributor_GradeRepository.GetEntity(disModel.GradeId);
if (disgradeModel != null)
{
//if ((BasicsModel?.IsCommissionResidue ?? 2) == 1)
//{
// model.MaxShare = (disgradeModel?.OneCommission ?? 0) + (disgradeModel?.TwoCommission ?? 0) + (disgradeModel?.ThreeCommission ?? 0);
//}
//else
//{
model.MaxShare = disgradeModel?.OneCommission ?? 0;
//}
if ((disgradeModel?.DistributionCommissionType ?? 2) == 1)
{
model.MaxShare = Math.Round(model.MaxShare * MaxSellMoney / 100, 2, MidpointRounding.AwayFromZero);
}
}
}
}
}
}
}
#endregion
#region 最外层组装参数
List<RB_Member_Grade_Extend> memeberList = new List<RB_Member_Grade_Extend>();
if (UserId > 0)
{
if (userModel.MemberGrade > 0)
{
memeberList = GetMemberGradeList(new RB_Member_Grade_Extend() { Enabled = 1, TenantId = TenantId, MallBaseId = MallBaseId });
}
}
#region 组装价格
decimal price_member = model.SellingPrice ?? 0;//未设会员价格的话 就为销售价格
List<object> member_price_list = new List<object>();
if (model.EnjoyMember == 1 && model.SeparateSetMember == 1)
{
if (model.MemberPriceList.Any())
{
var mlist = model.MemberPriceList;
foreach (var qitem in mlist)
{
member_price_list.Add(new
{
member_grade = qitem.MemberGrade,
member_price = qitem.MemberPrice
});
}
if (UserId > 0 && userModel.MemberGrade > 0)
{
var gmodel = mlist.Where(x => x.MemberGrade == userModel.MemberGrade).FirstOrDefault();
price_member = gmodel.MemberPrice ?? 0;
}
else
{
price_member = mlist.Max(x => x.MemberPrice ?? 0);
}
}
}
else
{
//根据会员等级查找会员价格
foreach (var qitem in memeberList)
{
var mprice = Math.Round((model.SellingPrice ?? 0) * (qitem.Discount ?? 10) / 10, 2, MidpointRounding.AwayFromZero);
member_price_list.Add(new
{
member_grade = qitem.Grade,
member_price = mprice
});
}
if (UserId > 0 && userModel.MemberGrade > 0 && memeberList.Any())
{
var gmodel = memeberList.Where(x => x.Grade == userModel.MemberGrade).FirstOrDefault();
price_member = Math.Round((model.SellingPrice ?? 0) * (gmodel?.Discount ?? 10) / 10, 2, MidpointRounding.AwayFromZero);
}
else if (memeberList.Any())
{
price_member = Math.Round((model.SellingPrice ?? 0) * (memeberList.Max(x => x.Discount) ?? 10) / 10, 2, MidpointRounding.AwayFromZero);
}
}
#endregion
#region 赠送积分
int Integral = 0;
if (model.IntegralPresent > 0)
{
Integral = model.IntegralPresent ?? 0;
if (model.IntegralPresentType == 1)
{
Integral = Convert.ToInt32(Math.Floor((model.SellingPrice ?? 0) * (model.IntegralPresent ?? 0) / 100));
}
}
int CommentIntegral = 0;
if (model.IntegralComment > 0)
{
CommentIntegral = model.IntegralComment ?? 0;
if (model.IntegralCommentType == 1)
{
CommentIntegral = Convert.ToInt32(Math.Floor((model.SellingPrice ?? 0) * (model.IntegralComment ?? 0) / 100));
}
}
#endregion
#region 会员价格
decimal price_member_max = 0, price_member_min = 0, price_min = 0, price_max = 0;
if (model.EnjoyMember == 1 && model.SeparateSetMember == 1 && model.MemberPriceList.Any())
{
price_member_min = model.MemberPriceList.Min(x => x.MemberPrice ?? 0);
price_member_max = model.MemberPriceList.Max(x => x.MemberPrice ?? 0);
if (userModel.MemberGrade > 0)
{
price_min = model.MemberPriceList.Where(x => x.MemberGrade == userModel.MemberGrade).Min(x => x.MemberPrice ?? 0);
price_max = model.MemberPriceList.Where(x => x.MemberGrade == userModel.MemberGrade).Max(x => x.MemberPrice ?? 0);
}
}
else
{
if (model.IsCustomSpecification == 1)
{
price_member_min = price_min = model.SpecificationPriceList.Where(x => x.SellingPrice > 0).Min(x => x.SellingPrice ?? 0);
price_member_max = price_max = model.SpecificationPriceList.Where(x => x.SellingPrice > 0).Max(x => x.SellingPrice ?? 0);
}
else
{
price_member_min = price_member_max = price_min = price_max = model.SellingPrice ?? 0;
}
if (memeberList.Any())
{
List<decimal> pricelist = new List<decimal>();
foreach (var item in memeberList)
{
pricelist.Add(price_member_min * (item.Discount ?? 10) / 10);
pricelist.Add(price_member_max * (item.Discount ?? 10) / 10);
}
price_member_min = pricelist.Min(x => x);
price_member_max = pricelist.Max(x => x);
if (userModel.MemberGrade > 0)
{
if (price_min > (model.SellingPrice ?? 0)) { price_min = model.SellingPrice ?? 0; }
if (price_max < (model.SellingPrice ?? 0)) { price_max = model.SellingPrice ?? 0; }
price_min = price_member_min * (memeberList.Where(x => x.Id == userModel.MemberGrade).FirstOrDefault()?.Discount ?? 10) / 10;
price_max = price_member_max * (memeberList.Where(x => x.Id == userModel.MemberGrade).FirstOrDefault()?.Discount ?? 10) / 10;
}
}
}
price_member_max = Math.Round(price_member_max, 2, MidpointRounding.AwayFromZero);
price_member_min = Math.Round(price_member_min, 2, MidpointRounding.AwayFromZero);
//price_min = Math.Round(price_min, 2, MidpointRounding.AwayFromZero);
//price_max = Math.Round(price_max, 2, MidpointRounding.AwayFromZero);//先使用会员的
price_min = price_member_min;
price_max = price_member_max;
#endregion
#region 教师列表
model.TeacherList = goods_WK_TeacherRepository.GetList(new RB_Goods_WK_Teacher_Extend() { GoodsId = goodsId });
#endregion
#region 轮播图
//轮播
model.CarouselImageList = new List<RB_ImageCommonModel>();
if (!string.IsNullOrWhiteSpace(model.VideoAddress))
{
model.CarouselImageList.Add(new RB_ImageCommonModel()
{
Id = 0,
Name = "",
Type = 1,
Path = model.VideoAddress
});
}
if (!string.IsNullOrEmpty(model.CarouselImage) && model.CarouselImage != "[]")
{
List<string> CarouselIdList = JsonConvert.DeserializeObject<List<string>>(model.CarouselImage);
//轮播图
foreach (var item in CarouselIdList)
{
model.CarouselImageList.Add(new RB_ImageCommonModel()
{
Id = 0,
Name = "",
Path = item
});
}
}
#endregion
#region 课程列表 单独写个分页接口展示
//model.CourseList = goods_WK_CourseRepository.GetList(new RB_Goods_WK_Course_Extend() { GoodsId = goodsId });
#endregion
#region 订单购买
bool IsPay = false;//是否支付 1是 2否
bool IsOrders = false;//是否下单 1是 2否
if (UserId > 0)
{
var omodel = goods_OrderRepository.GetCourseOrderIsPay(GoodsIds: goodsId.ToString(), UserId: UserId).FirstOrDefault();
if (omodel != null) {
IsOrders = true;
if (omodel.PaymentTime.HasValue) {
IsPay = true;
}
}
}
#endregion
#region 返回参数
int IsAllowShare = 1;
if (model.CategoryList.Where(x => x.IsForeignShare == 2).Any())
{
IsAllowShare = 2;
}
//订单课程的销售数量
int payment_num = goods_OrderRepository.GetGoodsOrderPaymentInfo(goodsId);
return new
{
goods = new
{
id = model.Id,
mall_id = model.MallBaseId,
mch_id = model.TenantId,//暂 商户id
status = model.GoodsStatus,
isAllowShare = IsAllowShare,//是否可以分享
advertising = model.Advertising,//广告词
price = model.SellingPrice,
give_integral = model.IntegralPresent,
give_integral_type = model.IntegralPresentType,
forehead_integral = model.PointsDeduction,//暂 积分抵扣
forehead_integral_type = model.PointsDeductionType,//暂 积分抵扣类型
accumulative = model.IsMultipleDeduction,//多件抵扣
individual_share = userModel?.IsDistributor ?? 2,// 是否分销商
attr_setting_type = model.SeparateDistributionType,//分销类型
is_level = model.EnjoyMember,//是否销售会员价格
is_level_alone = model.SeparateSetMember,//是否单独设置会员价
share_type = model.SeparateDistributionMoneyType,//分销佣金类型
app_share_pic = model.CustomShareImagePath,
app_share_title = model.CustomShareTitles,
sort = model.Sort,
created_at = model.CreateDate.HasValue ? model.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
updated_at = model.UpdateDate.HasValue ? model.UpdateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
sales = (model.SalesNum ?? 0) + payment_num,//已售出数量 + 订单商品数量//
name = model.Name,
original_price = model.OriginalPrice,
cover_pic = model.CoverImage,
unit = model.Unit,
detail = model.GoodsDetails,
video_url = model.VideoAddress,
level_show = (userModel?.MemberGrade ?? 0) > 0 ? 1 : 2,//是否显示会员价
is_pay = IsPay,
is_orders = IsOrders,
share = model.MaxShare,//分销佣金
myBuyCommission = MyBuyCommission,//粉象模式 自购返利
favorite = model.Favorite,//是否收藏
goods_marketing_award = new
{
integral = new
{
title = Integral > 0 ? "购买可得" + Integral + "积分" : ""
},
commentIntegral = new
{
title = CommentIntegral > 0 ? "购买并评论可得" + Integral + "积分" : ""
}
},
extra_quick_share = new
{
share_pic = model.CarouselImageList.Select(x => new
{
id = x.Id,
pic_url = x.Path
}),
share_text = model.Name,
mall_name = model.MallName,
format_time = model.UpdateDate.HasValue ? model.UpdateDate.Value.ToString("yyyy-MM-dd") : ""
},
marketingLogo = model.MarketingLogo,
//分类
cats = model.CategoryList.Select(x => new
{
x.CategoryId,
x.CategoryName
}),
video_type = model.VideoType,
teacher_list = model.TeacherList.Select(x=>new {
teacher_id = x.TeacherId,
teacher_logo = x.TeacherLogo,
teacher_name = x.Name
})
},
delivery = ""
};
#endregion
#endregion
}
/// <summary>
/// 获取小程序课程章节列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="goodsId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public List<RB_Goods_WK_Course_Extend> GetAppletGoodsCourseList(int pageIndex, int pageSize, out long count, int goodsId, int tenantId, int mallBaseId)
{
var list = goods_WK_CourseRepository.GetPageList(pageIndex, pageSize, out count, new RB_Goods_WK_Course_Extend() { GoodsId = goodsId, TenantId = tenantId, MallBaseId = mallBaseId });
//查询观看数量
return list;
}
#endregion
#region 素材管理 #region 素材管理
/// <summary> /// <summary>
......
...@@ -663,6 +663,31 @@ WHERE od.GoodsId={goodsId} and o.`Status`=0 and o.OrderStatus <> 7 GROUP BY o.Us ...@@ -663,6 +663,31 @@ WHERE od.GoodsId={goodsId} and o.`Status`=0 and o.OrderStatus <> 7 GROUP BY o.Us
} }
/// <summary>
/// 根据商品id 获取其订单相关统计
/// </summary>
/// <param name="payment_amount"></param>
/// <param name="payment_num"></param>
/// <param name="payment_order"></param>
/// <param name="payment_people"></param>
/// <param name="goodsId"></param>
public int GetGoodsOrderPaymentInfo(int goodsId)
{
string sql2 = $@"
SELECT SUM(od.Number) as OrderNum FROM rb_goods_order o
INNER JOIN rb_goods_orderdetail od on o.OrderId=od.OrderId
WHERE od.GoodsId={goodsId} and o.`Status`=0 and o.OrderStatus <> 7";
var model2 = Get<RB_Goods_Order_Extend>(sql2).FirstOrDefault();
if (model2 != null)
{
return model2.OrderNum ?? 0;
}
return 0;
}
/// <summary> /// <summary>
/// 根据商品ids 获取商品的订单销量 /// 根据商品ids 获取商品的订单销量
/// </summary> /// </summary>
...@@ -1801,6 +1826,23 @@ SELECT o.* FROM rb_goods_order o ...@@ -1801,6 +1826,23 @@ SELECT o.* FROM rb_goods_order o
INNER JOIN rb_goods_orderdetail od on o.OrderId = od.OrderId INNER JOIN rb_goods_orderdetail od on o.OrderId = od.OrderId
WHERE o.TenantId={tenantId} AND o.MallBaseId={mallBaseId} AND o.`Status`=0 AND o.Recycled=2 AND o.OrderStatus =4 AND o.OrderClassify =1 AND od.TripETime < '{DateTime.Now.ToString("yyyy-MM-dd")}' WHERE o.TenantId={tenantId} AND o.MallBaseId={mallBaseId} AND o.`Status`=0 AND o.Recycled=2 AND o.OrderStatus =4 AND o.OrderClassify =1 AND od.TripETime < '{DateTime.Now.ToString("yyyy-MM-dd")}'
GROUP BY o.OrderId GROUP BY o.OrderId
";
return Get<RB_Goods_Order_Extend>(sql).ToList();
}
/// <summary>
/// 获取订单付款信息
/// </summary>
/// <param name="GoodsId"></param>
/// <param name="UserId"></param>
/// <returns></returns>
public List<RB_Goods_Order_Extend> GetCourseOrderIsPay(string GoodsIds,int UserId)
{
string sql = $@"
SELECT o.OrderId,od.GoodsId,o.PaymentTime FROM rb_goods_order o
INNER JOIN rb_goods_orderdetail od on o.OrderId = od.OrderId
WHERE od.GoodsId in({GoodsIds}) AND o.UserId = {UserId} and o.OrderStatus <> 7
GROUP BY o.OrderId,od.GoodsId
"; ";
return Get<RB_Goods_Order_Extend>(sql).ToList(); return Get<RB_Goods_Order_Extend>(sql).ToList();
} }
......
...@@ -39,8 +39,46 @@ namespace Mall.Repository.Product ...@@ -39,8 +39,46 @@ namespace Mall.Repository.Product
string sql = $@" string sql = $@"
SELECT gc.* FROM RB_Goods_WK_Course gc SELECT gc.* FROM RB_Goods_WK_Course gc
WHERE {where} ORDER BY gc.Id asc "; WHERE {where} ORDER BY gc.Sort asc ";
return Get<RB_Goods_WK_Course_Extend>(sql).ToList(); return Get<RB_Goods_WK_Course_Extend>(sql).ToList();
} }
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_WK_Course_Extend> GetPageList(int pageIndex, int pageSize, out long count, RB_Goods_WK_Course_Extend dmodel)
{
string where = $" 1=1 and gc.{nameof(RB_Goods_WK_Course.Status)}=0";
if (dmodel.TenantId > 0)
{
where += $@" and gc.{nameof(RB_Goods_WK_Course.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and gc.{nameof(RB_Goods_WK_Course.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0)
{
where += $@" and gc.{nameof(RB_Goods_WK_Course.Id)}={dmodel.Id}";
}
if (dmodel.GoodsId > 0)
{
where += $@" and gc.{nameof(RB_Goods_WK_Course.GoodsId)}={dmodel.GoodsId}";
}
if (!string.IsNullOrEmpty(dmodel.GoodsIds))
{
where += $@" and gc.{nameof(RB_Goods_Category.GoodsId)} in({dmodel.GoodsIds})";
}
string sql = $@"
SELECT gc.* FROM RB_Goods_WK_Course gc
WHERE {where} ORDER BY gc.Sort asc ";
return GetPage<RB_Goods_WK_Course_Extend>(pageIndex, pageSize, out count, sql).ToList();
}
} }
} }
...@@ -41,7 +41,7 @@ namespace Mall.Repository.Product ...@@ -41,7 +41,7 @@ namespace Mall.Repository.Product
} }
string sql = $@" string sql = $@"
SELECT gc.*,pc.Name SELECT gc.*,pc.Name,pc.TeacherLogo
FROM RB_Goods_WK_Teacher gc inner join rb_education_teacher pc on gc.TeacherId=pc.Id FROM RB_Goods_WK_Teacher gc inner join rb_education_teacher pc on gc.TeacherId=pc.Id
WHERE {where} ORDER BY gc.Id asc "; WHERE {where} ORDER BY gc.Id asc ";
return Get<RB_Goods_WK_Teacher_Extend>(sql).ToList(); return Get<RB_Goods_WK_Teacher_Extend>(sql).ToList();
......
...@@ -61,15 +61,13 @@ namespace Mall.WebApi.Controllers.Education ...@@ -61,15 +61,13 @@ namespace Mall.WebApi.Controllers.Education
demodel.SmallShopsId = userModel.SmallShopId; demodel.SmallShopsId = userModel.SmallShopId;
} }
} }
var list = educationModule.GetAppletCoursePageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel); var list = productModule.GetAppletCoursePageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
List<object> RList = new List<object>(); List<object> RList = new List<object>();
if (list.Any()) if (list.Any())
{ {
foreach (var model in list) foreach (var model in list)
{ {
#region 组装价格 #region 组装价格
List<object> priceList = new List<object>();
decimal price_member = model.SellingPrice ?? 0;//未设会员价格的话 就为销售价格 decimal price_member = model.SellingPrice ?? 0;//未设会员价格的话 就为销售价格
if (model.EnjoyMember == 1 && model.SeparateSetMember == 1) if (model.EnjoyMember == 1 && model.SeparateSetMember == 1)
{ {
...@@ -90,28 +88,6 @@ namespace Mall.WebApi.Controllers.Education ...@@ -90,28 +88,6 @@ namespace Mall.WebApi.Controllers.Education
price_member = Math.Round((model.SellingPrice ?? 0) * (memberGrade?.Discount ?? 10) / 10, 2, MidpointRounding.AwayFromZero); price_member = Math.Round((model.SellingPrice ?? 0) * (memberGrade?.Discount ?? 10) / 10, 2, MidpointRounding.AwayFromZero);
} }
} }
priceList.Add(new
{
id = 0,
goods_id = model.Id,
sign_id = "",
stock = model.InventoryNum,
price = model.SellingPrice ?? 0,
no = model.GoodsNumbers,
weight = model.GoodsWeight,
pic_url = "",
is_delete = 0,
attr_list = new
{
attr_group_name = "规格",
attr_group_id = 0,
attr_id = 0,
attr_name = model.DefaultSpecificationName
},
price_member
});
#endregion #endregion
...@@ -130,40 +106,21 @@ namespace Mall.WebApi.Controllers.Education ...@@ -130,40 +106,21 @@ namespace Mall.WebApi.Controllers.Education
RList.Add(new RList.Add(new
{ {
id = model.Id, id = model.Id,
sign = "",
name = model.Name, name = model.Name,
cover_pic = model.CoverImage, cover_pic = model.CoverImage,
video_url = model.VideoAddress, video_url = model.VideoAddress,
original_price = model.OriginalPrice, original_price = model.OriginalPrice,
unit = model.Unit, unit = model.Unit,
page_url = "/pages/goods/goods?id=" + model.Id, page_url = "/pages/goods/goods?id=" + model.Id,
is_negotiable = model.IsGoodsNegotiable,
is_level = model.EnjoyMember, is_level = model.EnjoyMember,
level_price = memberprice, level_price = memberprice,
price = (model.SellingPrice ?? 0).ToString("#0.00"), price = (model.SellingPrice ?? 0).ToString("#0.00"),
price_content = "¥" + (model.SellingPrice ?? 0).ToString("#0.00"), price_content = "¥" + (model.SellingPrice ?? 0).ToString("#0.00"),
is_sales = model.GoodsStatus,
sales = "已售" + model.SalesNum + "件", sales = "已售" + model.SalesNum + "件",
freeShippingName = model.FreeShippingModel.Name,
freeShippingFullMoneyPinkage = model.FreeShippingModel.FullMoneyPinkage ?? 0,
freeShippingFullNumPinkage = model.FreeShippingModel.FullNumPinkage ?? 0,
attr_groups = model.SpecificationList.Select(x => new
{
attr_group_id = x.Sort,
attr_group_name = x.Name,
attr_list = x.SpecificationValueList.Select(z => new
{
attr_id = z.Sort,
attr_name = z.Name,
pic_url = z.ImagePath
})
}),
attr = priceList,
goods_stock = model.InventoryNum,
goods_num = model.InventoryNum,
marketingLogo = model.MarketingLogo, marketingLogo = model.MarketingLogo,
video_type = model.VideoType, video_type = model.VideoType,
erpgoodobj = model.ERPGoodObj course_score = model.CourseScore,
is_pay = model.IsPay,
}); });
} }
} }
...@@ -174,7 +131,7 @@ namespace Mall.WebApi.Controllers.Education ...@@ -174,7 +131,7 @@ namespace Mall.WebApi.Controllers.Education
} }
/// <summary> /// <summary>
/// 获取小程序商品详情 /// 获取小程序课程详情
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
...@@ -193,10 +150,52 @@ namespace Mall.WebApi.Controllers.Education ...@@ -193,10 +150,52 @@ namespace Mall.WebApi.Controllers.Education
} }
int UserId = req.UserId; int UserId = req.UserId;
var Robj = productModule.GetAppletGoodsInfo_V2(GoodsId, UserId, req.SmallShopsId, req.TenantId, req.MallBaseId); var Robj = productModule.GetAppletCourseInfo(GoodsId, UserId, req.SmallShopsId, req.TenantId, req.MallBaseId);
return ApiResult.Success("", Robj); return ApiResult.Success("", Robj);
} }
/// <summary>
/// 获取小程序课程章节列表
/// </summary>
/// <param name="requestMsg"></param>
/// <returns></returns>
[HttpPost]
public ApiResult GetAppletGoodsCourseList(object requestMsg) {
var req = JsonConvert.DeserializeObject<RequestParm>(requestMsg.ToString());
if (req.MallBaseId <= 0)
{
return ApiResult.ParamIsNull();
}
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(req.msg.ToString());
JObject prams = JObject.Parse(req.msg.ToString());
int GoodsId = prams.GetInt("GoodsId", 0);
if (GoodsId <= 0)
{
return ApiResult.ParamIsNull();
}
var list = productModule.GetAppletGoodsCourseList(pagelist.pageIndex,pagelist.pageSize,out long count, GoodsId, req.TenantId, req.MallBaseId);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.Id,
x.Sort,
x.SortName,
x.Name,
x.Type,
TypeName = x.Type.GetEnumName(),
x.IsTrySee,
x.Number,
x.IsCache,
x.FilePath,
x.IsImageOK,
x.VideoImage,
x.VideoTime,
ImageList = !string.IsNullOrEmpty(x.Image) && x.Image != "[]" ? JsonConvert.DeserializeObject<List<CourseImageModel>>(x.Image) : new List<CourseImageModel>()
});
return ApiResult.Success("", pagelist);
}
#endregion #endregion
#region 资讯 #region 资讯
......
...@@ -583,7 +583,7 @@ namespace Mall.WebApi.Controllers.Education ...@@ -583,7 +583,7 @@ namespace Mall.WebApi.Controllers.Education
} }
demodel.IsQuickBuy ??= 2; demodel.IsQuickBuy ??= 2;
demodel.IsSellWell ??= 2; demodel.IsSellWell ??= 2;
demodel.GoodsType ??= Common.Enum.Goods.OrderTypeEnum.SDGoods; demodel.GoodsType ??= Common.Enum.Goods.OrderTypeEnum.KCGoods;
demodel.GoodsStatus ??= 2; demodel.GoodsStatus ??= 2;
demodel.IsProxy ??= 2; demodel.IsProxy ??= 2;
......
...@@ -74,9 +74,9 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -74,9 +74,9 @@ namespace Mall.WebApi.Controllers.MallBase
RB_Material_Info_Extend demodel = JsonConvert.DeserializeObject<RB_Material_Info_Extend>(parms.msg.ToString()); RB_Material_Info_Extend demodel = JsonConvert.DeserializeObject<RB_Material_Info_Extend>(parms.msg.ToString());
if (string.IsNullOrEmpty(demodel.Name)) if (string.IsNullOrEmpty(demodel.Name))
{ {
return ApiResult.ParamIsNull("请输入分组名称"); return ApiResult.ParamIsNull("请输入素材名称");
} }
if (demodel.Type != 1 && demodel.Type != 2) if (demodel.Type != 1 && demodel.Type != 2 && demodel.Type != 3)
{ {
return ApiResult.ParamIsNull("请传递类型"); return ApiResult.ParamIsNull("请传递类型");
} }
...@@ -151,7 +151,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -151,7 +151,7 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.ParamIsNull("请输入分组名称"); return ApiResult.ParamIsNull("请输入分组名称");
} }
if (demodel.Type != 1 && demodel.Type != 2) if (demodel.Type != 1 && demodel.Type != 2 && demodel.Type != 3)
{ {
return ApiResult.ParamIsNull("请传递类型"); return ApiResult.ParamIsNull("请传递类型");
} }
......
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