Commit 7d82ed23 authored by 吴春's avatar 吴春

Merge branch 'sdzq-ld' of http://gitlab.oytour.com/Kui2/mall.oytour.com into sdzq

parents 1d3ca843 e1d45777
......@@ -66,6 +66,11 @@ namespace Mall.Common.Enum.Goods
/// 司导商品
/// </summary>
[EnumField("司导商品")]
SDGoods = 11
SDGoods = 11,
/// <summary>
/// 网教课程
/// </summary>
[EnumField("网教课程")]
KCGoods = 12,
}
}
......@@ -16,6 +16,10 @@ namespace Mall.Model.Extend.Product
[DB(ConnectionName = "DefaultConnection")]
public class RB_Goods_Extend : RB_Goods
{
/// <summary>
/// 课程是否已付款
/// </summary>
public bool IsPay { get; set; }
/// <summary>
/// 课程列表
/// </summary>
......
......@@ -17,10 +17,6 @@ namespace Mall.Model.Extend.Product
/// 商品ids
/// </summary>
public string GoodsIds { get; set; }
/// <summary>
/// 文件类型 1腾讯 2阿里云
/// </summary>
public int PathType { get; set; }
}
/// <summary>
......
......@@ -21,5 +21,9 @@ namespace Mall.Model.Extend.Product
/// 教师名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 教师头像
/// </summary>
public string TeacherLogo { get; set; }
}
}
......@@ -79,23 +79,11 @@ namespace Mall.Module.Education
/// <summary>
/// 分销商等级
/// </summary>
private readonly RB_Distributor_GradeRepository distributor_GradeRepository = new RB_Distributor_GradeRepository();
/// <summary>
/// 分销商
/// </summary>
private readonly RB_Distributor_InfoRepository distributor_InfoRepository = new RB_Distributor_InfoRepository();
private readonly RB_Distributor_GradeRepository distributor_GradeRepository = new RB_Distributor_GradeRepository();
/// <summary>
/// 会员等级
/// </summary>
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>
/// 会员信息
......@@ -1188,132 +1176,6 @@ namespace Mall.Module.Education
#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 教师管理
/// <summary>
///教师配置列表
......
This diff is collapsed.
......@@ -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>
/// 根据商品ids 获取商品的订单销量
/// </summary>
......@@ -1801,6 +1826,23 @@ SELECT o.* FROM rb_goods_order o
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")}'
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();
}
......
......@@ -39,8 +39,46 @@ namespace Mall.Repository.Product
string sql = $@"
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();
}
/// <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
}
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
WHERE {where} ORDER BY gc.Id asc ";
return Get<RB_Goods_WK_Teacher_Extend>(sql).ToList();
......
......@@ -62,15 +62,13 @@ namespace Mall.WebApi.Controllers.Education
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>();
if (list.Any())
{
foreach (var model in list)
{
#region 组装价格
List<object> priceList = new List<object>();
decimal price_member = model.SellingPrice ?? 0;//未设会员价格的话 就为销售价格
if (model.EnjoyMember == 1 && model.SeparateSetMember == 1)
{
......@@ -91,29 +89,6 @@ namespace Mall.WebApi.Controllers.Education
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
#region 会员价格
......@@ -131,40 +106,21 @@ namespace Mall.WebApi.Controllers.Education
RList.Add(new
{
id = model.Id,
sign = "",
name = model.Name,
cover_pic = model.CoverImage,
video_url = model.VideoAddress,
original_price = model.OriginalPrice,
unit = model.Unit,
page_url = "/pages/goods/goods?id=" + model.Id,
is_negotiable = model.IsGoodsNegotiable,
is_level = model.EnjoyMember,
level_price = memberprice,
price = (model.SellingPrice ?? 0).ToString("#0.00"),
price_content = "¥" + (model.SellingPrice ?? 0).ToString("#0.00"),
is_sales = model.GoodsStatus,
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,
video_type = model.VideoType,
erpgoodobj = model.ERPGoodObj
course_score = model.CourseScore,
is_pay = model.IsPay,
});
}
}
......@@ -175,7 +131,7 @@ namespace Mall.WebApi.Controllers.Education
}
/// <summary>
/// 获取小程序商品详情
/// 获取小程序课程详情
/// </summary>
/// <returns></returns>
[HttpPost]
......@@ -194,10 +150,52 @@ namespace Mall.WebApi.Controllers.Education
}
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);
}
/// <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
#region 资讯
......
......@@ -596,7 +596,7 @@ namespace Mall.WebApi.Controllers.Education
}
demodel.IsQuickBuy ??= 2;
demodel.IsSellWell ??= 2;
demodel.GoodsType ??= Common.Enum.Goods.OrderTypeEnum.SDGoods;
demodel.GoodsType ??= Common.Enum.Goods.OrderTypeEnum.KCGoods;
demodel.GoodsStatus ??= 2;
demodel.IsProxy ??= 2;
......
......@@ -74,9 +74,9 @@ namespace Mall.WebApi.Controllers.MallBase
RB_Material_Info_Extend demodel = JsonConvert.DeserializeObject<RB_Material_Info_Extend>(parms.msg.ToString());
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("请传递类型");
}
......@@ -151,7 +151,7 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.ParamIsNull("请输入分组名称");
}
if (demodel.Type != 1 && demodel.Type != 2)
if (demodel.Type != 1 && demodel.Type != 2 && demodel.Type != 3)
{
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