Commit c4273a40 authored by 吴春's avatar 吴春

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

parents f2e54dc5 6ea9bf02
...@@ -35,5 +35,13 @@ namespace Mall.Model.Entity.Product ...@@ -35,5 +35,13 @@ namespace Mall.Model.Entity.Product
/// 可预定日期 /// 可预定日期
/// </summary> /// </summary>
public DateTime? Date { get; set; } public DateTime? Date { get; set; }
/// <summary>
/// 是否可以预定 1是 2否
/// </summary>
public int IsReserve { get; set; }
/// <summary>
/// 已预定的座位数量
/// </summary>
public int ReserveNum { get; set; }
} }
} }
...@@ -645,6 +645,29 @@ namespace Mall.Module.Product ...@@ -645,6 +645,29 @@ namespace Mall.Module.Product
return model; return model;
} }
/// <summary>
/// 验证可预定日期是否可以修改
/// </summary>
/// <param name="goodsIs"></param>
/// <param name="tdlist"></param>
/// <returns></returns>
public string ValidateGoodsTargetDate(int goodsId, List<RB_Goods_TargetDate_Extend> tdlist) {
var oldtdlist = goods_TargetDateRepository.GetList(new RB_Goods_TargetDate_Extend() { GoodsId = goodsId });
var tddeleteList = oldtdlist.Where(x => !tdlist.Select(y => y.Date).Contains(x.Date)).ToList();
string msg = "";
foreach (var item in tddeleteList) {
//看是否有不可预约的 / 有预定人数的
if (item.IsReserve == 2 || item.ReserveNum > 0) {
msg += item.Date.Value.ToString("yyyy-MM-dd") + ",";
}
}
if (msg != "") {
msg = msg[..1];
msg += " 已有订单预定,无法修改当前日期";
}
return msg;
}
/// <summary> /// <summary>
/// 新增修改商品信息 /// 新增修改商品信息
/// </summary> /// </summary>
...@@ -754,7 +777,9 @@ namespace Mall.Module.Product ...@@ -754,7 +777,9 @@ namespace Mall.Module.Product
{ {
Id = 0, Id = 0,
GoodsId = demodel.Id, GoodsId = demodel.Id,
Date = item.Date Date = item.Date,
IsReserve = 1,
ReserveNum = 0
}); });
} }
foreach (var item in tddeleteList) foreach (var item in tddeleteList)
...@@ -935,7 +960,9 @@ namespace Mall.Module.Product ...@@ -935,7 +960,9 @@ namespace Mall.Module.Product
{ {
Id = 0, Id = 0,
GoodsId = Id, GoodsId = Id,
Date = item.Date Date = item.Date,
IsReserve = 1,
ReserveNum = 0
}); });
} }
//插入分类 //插入分类
...@@ -1576,6 +1603,12 @@ namespace Mall.Module.Product ...@@ -1576,6 +1603,12 @@ namespace Mall.Module.Product
{ {
model.LineDescriptionList = JsonConvert.DeserializeObject<List<string>>(model.LineDescription); model.LineDescriptionList = JsonConvert.DeserializeObject<List<string>>(model.LineDescription);
} }
var targetList = goods_TargetDateRepository.GetList(new RB_Goods_TargetDate_Extend() { GoodsId = goodsId });
if (model.AdvanceDay > 0) {
DateTime Mindate = Convert.ToDateTime(DateTime.Now.AddDays(model.AdvanceDay ?? 0).ToString("yyyy-MM-dd"));
targetList = targetList.Where(x => x.Date >= Mindate).ToList();
}
#endregion #endregion
#region 返回参数 #region 返回参数
...@@ -1620,9 +1653,12 @@ namespace Mall.Module.Product ...@@ -1620,9 +1653,12 @@ namespace Mall.Module.Product
line_descriptionlist = model.LineDescriptionList, line_descriptionlist = model.LineDescriptionList,
is_spell = model.IsSpell, is_spell = model.IsSpell,
ride_num = model.RideNum, ride_num = model.RideNum,
target_list = targetList.Select(x=>new {
// 哪天 再加个剩余座位数 x.Id,
Date = x.Date.Value.ToString("yyyy-MM-dd"),
x.IsReserve,
x.ReserveNum
}),
advance_day = model.AdvanceDay, advance_day = model.AdvanceDay,
give_integral = model.IntegralPresent, give_integral = model.IntegralPresent,
give_integral_type = model.IntegralPresentType, give_integral_type = model.IntegralPresentType,
...@@ -1652,7 +1688,7 @@ namespace Mall.Module.Product ...@@ -1652,7 +1688,7 @@ namespace Mall.Module.Product
video_url = model.VideoAddress, video_url = model.VideoAddress,
level_show = (userModel?.MemberGrade ?? 0) > 0 ? 1 : 2,//是否显示会员价 level_show = (userModel?.MemberGrade ?? 0) > 0 ? 1 : 2,//是否显示会员价
is_sales = model.GoodsStatus,//是否可购买 ______根据日期判断 。。。。。。。。。。。。。。。。。。。。。。。。。。 is_sales = model.GoodsStatus,//是否可购买 ______根据日期判断 。。。。。。。。。。。。。。。。。。。。。。。。。。
attr = priceList, //attr = priceList,
pic_url = model.CarouselImageList.Select(x => new pic_url = model.CarouselImageList.Select(x => new
{ {
id = x.Id, id = x.Id,
......
...@@ -20,7 +20,7 @@ namespace Mall.WebApi.Controllers.Product ...@@ -20,7 +20,7 @@ namespace Mall.WebApi.Controllers.Product
[ApiExceptionFilter] [ApiExceptionFilter]
[ApiController] [ApiController]
[EnableCors("AllowCors")] [EnableCors("AllowCors")]
public class AppletGuideCarController : BaseController public class AppletGuideCarController : ControllerBase
{ {
private readonly GuideCarModule guideCarModule = new GuideCarModule(); private readonly GuideCarModule guideCarModule = new GuideCarModule();
...@@ -60,13 +60,12 @@ namespace Mall.WebApi.Controllers.Product ...@@ -60,13 +60,12 @@ namespace Mall.WebApi.Controllers.Product
/// 获取详情 /// 获取详情
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public ApiResult GetGuideCarGuideModel() public ApiResult GetGuideCarGuideModel(object requestMsg)
{ {
var parms = RequestParm; var parms = JsonConvert.DeserializeObject<RequestParm>(requestMsg.ToString());
var userInfo = AppletUserInfo; var query = JsonConvert.DeserializeObject<RB_GuideCar_Guide_Extend>(parms.msg.ToString());
var query = JsonConvert.DeserializeObject<RB_GuideCar_Guide_Extend>(RequestParm.msg.ToString()); query.TenantId = parms.TenantId;
query.TenantId = userInfo.TenantId; query.MallBaseId = parms.MallBaseId;
query.MallBaseId = userInfo.MallBaseId;
var oldLogisticsModel = guideCarModule.GetGuideCarGuideModel(query); var oldLogisticsModel = guideCarModule.GetGuideCarGuideModel(query);
if (oldLogisticsModel == null) if (oldLogisticsModel == null)
{ {
...@@ -82,13 +81,12 @@ namespace Mall.WebApi.Controllers.Product ...@@ -82,13 +81,12 @@ namespace Mall.WebApi.Controllers.Product
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult GetGuideCarModel() public ApiResult GetGuideCarModel(object requestMsg)
{ {
var parms = RequestParm; var parms = JsonConvert.DeserializeObject<RequestParm>(requestMsg.ToString());
var userInfo = AppletUserInfo; var query = JsonConvert.DeserializeObject<RB_GuideCar_Car_Extend>(parms.msg.ToString());
var query = JsonConvert.DeserializeObject<RB_GuideCar_Car_Extend>(RequestParm.msg.ToString()); query.TenantId = parms.TenantId;
query.TenantId = userInfo.TenantId; query.MallBaseId = parms.MallBaseId;
query.MallBaseId = userInfo.MallBaseId;
var oldLogisticsModel = guideCarModule.GetGuideCarModel(query); var oldLogisticsModel = guideCarModule.GetGuideCarModel(query);
if (oldLogisticsModel == null) if (oldLogisticsModel == null)
{ {
......
...@@ -462,6 +462,14 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -462,6 +462,14 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.IsSpell ??= 1; demodel.IsSpell ??= 1;
demodel.AdvanceDay ??= 0; demodel.AdvanceDay ??= 0;
if (demodel.Id > 0)
{
string vmsg = guideCarModule.ValidateGoodsTargetDate(demodel.Id, demodel.TargetDateList);
if (vmsg != "")
{
return ApiResult.Failed(vmsg);
}
}
#endregion #endregion
demodel.IsCustomSpecification ??= 2; demodel.IsCustomSpecification ??= 2;
......
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