public ActionResult GroupDetail(long id, long aid) { FightGroupActiveModel model = FightGroupApplication.GetActive(aid, false, true); if (model == null) { throw new HimallException("错误的活动信息"); } model.InitProductImages(); FightGroupsModel group = FightGroupApplication.GetGroup(aid, id); if (group == null) { throw new HimallException("错误的拼团信息"); } if (group.BuildStatus == FightGroupBuildStatus.Opening) { return(this.Redirect(string.Format("/m-{0}/Member/Center/", base.PlatformType.ToString()))); } FightGroupGroupDetailModel model3 = new FightGroupGroupDetailModel { ActiveData = model, GroupsData = group, HasJoin = false }; if (base.CurrentUser != null) { model3.HasJoin = !FightGroupApplication.CanJoinGroup(aid, id, base.CurrentUser.Id); } model3.ShareUrl = string.Format("{0}/m-{1}/FightGroup/GroupDetail/{2}?aid={3}", new object[] { CurrentUrlHelper.CurrentUrlNoPort(), "WeiXin", group.Id, group.ActiveId }); model3.ShareTitle = "我参加了(" + model.ProductName + ")的拼团"; model3.ShareImage = model.ProductDefaultImage; if (!string.IsNullOrWhiteSpace(model3.ShareImage) && (model3.ShareImage.Substring(0, 4) != "http")) { model3.ShareImage = HimallIO.GetRomoteImagePath(model3.ShareImage, null); } int num = group.LimitedNumber - group.JoinedNumber; num = (num < 0) ? 0 : num; if (num > 0) { model3.ShareDesc = "还差" + num + "人即可成团"; } if (!string.IsNullOrWhiteSpace(model.ProductShortDescription)) { if (!string.IsNullOrWhiteSpace(model3.ShareDesc)) { model3.ShareDesc = model3.ShareDesc + ",(" + model.ProductShortDescription + ")"; } else { model3.ShareDesc = model3.ShareDesc + model.ProductShortDescription; } } return(base.View(model3)); }
/// <summary> /// 获取拼团团组详情 /// </summary> /// <param name="activeId">拼团活动ID</param> /// <param name="groupId">拼团团组ID</param> /// <returns></returns> public JsonResult <Result <dynamic> > GetGroupDetail(long activeId, long groupId) { var data = FightGroupApplication.GetGroup(activeId, groupId); if (data == null) { throw new HimallException("错误的拼团信息"); } return(JsonResult <dynamic>(data)); }
public object GetGroupDetail(long activeId, long groupId) { var data = FightGroupApplication.GetGroup(activeId, groupId); if (data == null) { throw new MallException("错误的拼团信息"); } return(Json(data)); }
/// <summary> /// 我的拼团详情 /// </summary> /// <param name="id"></param> /// <param name="aid"></param> /// <returns></returns> public ActionResult GroupDetail(long id, long aid) { FightGroupActiveModel gpact = FightGroupApplication.GetActive(aid, false); if (gpact == null) { throw new HimallException("错误的活动信息"); } FightGroupsModel groupsdata = FightGroupApplication.GetGroup(aid, id); if (groupsdata == null) { throw new HimallException("错误的拼团信息"); } if (groupsdata.BuildStatus == FightGroupBuildStatus.Opening) { //throw new HimallException("开团未成功,等待团长付款中"); return(Redirect(string.Format("/m-{0}/Member/Center/", PlatformType.ToString()))); } MyFightGroupDetailModel model = new MyFightGroupDetailModel(); model.ActiveData = gpact; model.GroupsData = groupsdata; model.ShareUrl = string.Format("{0}/m-{1}/FightGroup/GroupDetail/{2}?aid={3}", Request.Url.Scheme + "://" + Request.Url.Authority, "WeiXin", groupsdata.Id, groupsdata.ActiveId); model.ShareTitle = "我参加了(" + groupsdata.ProductName + ")的拼团"; model.ShareImage = gpact.ProductDefaultImage; if (!string.IsNullOrWhiteSpace(model.ShareImage)) { if (model.ShareImage.Substring(0, 4) != "http") { model.ShareImage = HimallIO.GetRomoteImagePath(model.ShareImage); } } int neednum = groupsdata.LimitedNumber - groupsdata.JoinedNumber; neednum = neednum < 0 ? 0 : neednum; if (neednum > 0) { model.ShareDesc = "还差" + neednum + "人即可成团"; } if (!string.IsNullOrWhiteSpace(gpact.ProductShortDescription)) { if (!string.IsNullOrWhiteSpace(model.ShareDesc)) { model.ShareDesc += ",(" + gpact.ProductShortDescription + ")"; } else { model.ShareDesc += gpact.ProductShortDescription; } } return(View(model)); }
public ActionResult GroupOrderOk(long orderid) { FightGroupOrderOkModel model = new FightGroupOrderOkModel(); FightGroupOrderModel order = FightGroupApplication.GetOrder(orderid); if (order == null) { throw new HimallException("错误的拼团预约单信息"); } FightGroupsModel group = FightGroupApplication.GetGroup(order.ActiveId, order.GroupId); if (group == null) { throw new HimallException("错误的拼团信息"); } if (group.BuildStatus == FightGroupBuildStatus.Opening) { return(this.Redirect(string.Format("/m-{0}/Member/Center/", base.PlatformType.ToString()))); } if (group.BuildStatus == FightGroupBuildStatus.Failed) { } FightGroupActiveModel model4 = FightGroupApplication.GetActive(group.ActiveId, false, true); model.isFirst = order.IsFirstOrder; model.LimitedNumber = group.LimitedNumber; model.JoinNumber = group.JoinedNumber; model.ShareUrl = string.Format("{0}/m-{1}/FightGroup/GroupDetail/{2}?aid={3}", new object[] { CurrentUrlHelper.CurrentUrlNoPort(), "WeiXin", group.Id, group.ActiveId }); model.ShareTitle = "我参加了(" + group.ProductName + ")的拼团"; model.ShareImage = model4.ProductDefaultImage; if (!string.IsNullOrWhiteSpace(model.ShareImage) && (model.ShareImage.Substring(0, 4) != "http")) { model.ShareImage = HimallIO.GetRomoteImagePath(model.ShareImage, null); } int num = group.LimitedNumber - group.JoinedNumber; num = (num < 0) ? 0 : num; if (num > 0) { model.ShareDesc = "还差" + num + "人即可成团"; } if (!string.IsNullOrWhiteSpace(model4.ProductShortDescription)) { if (!string.IsNullOrWhiteSpace(model.ShareDesc)) { model.ShareDesc = model.ShareDesc + ",(" + model4.ProductShortDescription + ")"; } else { model.ShareDesc = model.ShareDesc + model4.ProductShortDescription; } } return(base.View(model)); }
/// <summary> /// 分享参数二次加载 /// <para>ios分享错误临时解决方案</para> /// </summary> /// <param name="id"></param> /// <param name="aid"></param> /// <returns></returns> public JsonResult GetGroupDetailWXShare(long id, long aid) { FightGroupActiveModel gpact = FightGroupApplication.GetActive(aid, false); if (gpact == null) { throw new HimallException("错误的活动信息"); } FightGroupsModel groupsdata = FightGroupApplication.GetGroup(aid, id); if (groupsdata == null) { throw new HimallException("错误的拼团信息"); } if (groupsdata.BuildStatus == FightGroupBuildStatus.Opening) { throw new HimallException("开团未成功,等待团长付款中"); } MyFightGroupDetailModel model = new MyFightGroupDetailModel(); model.ShareUrl = string.Format("{0}/m-{1}/FightGroup/GroupDetail/{2}?aid={3}", Request.Url.Authority, "WeiXin", groupsdata.Id, groupsdata.ActiveId); model.ShareTitle = "我参加了(" + groupsdata.ProductName + ")的拼团"; model.ShareImage = gpact.ProductDefaultImage; if (!string.IsNullOrWhiteSpace(model.ShareImage)) { if (model.ShareImage.Substring(0, 4) != "http") { model.ShareImage = HimallIO.GetRomoteImagePath(model.ShareImage); } } int neednum = groupsdata.LimitedNumber - groupsdata.JoinedNumber; neednum = neednum < 0 ? 0 : neednum; model.ShareDesc = "还差" + neednum + "人即可成团"; if (!string.IsNullOrWhiteSpace(gpact.ProductShortDescription)) { model.ShareDesc += ",(" + gpact.ProductShortDescription + ")"; } //model.WeiXinShareArgs = Application.WXApiApplication.GetWeiXinShareArgs(this.HttpContext.Request.UrlReferrer.AbsoluteUri); return(Json(model)); }
/// <summary> /// 获取拼团订单详情 /// </summary> /// <param name="Id">订单Id</param> /// <returns></returns> public JsonResult <Result <dynamic> > GetFightGroupOrderDetail(long id) { var userList = new List <FightGroupOrderInfo>(); var orderDetail = FightGroupApplication.GetFightGroupOrderStatusByOrderId(id); //团组活动信息 orderDetail.UserInfo = new List <UserInfo>(); var data = FightGroupApplication.GetActive((long)orderDetail.ActiveId, false, true); Mapper.CreateMap <FightGroupActiveInfo, FightGroupActiveModel>(); //规格映射 Mapper.CreateMap <FightGroupActiveItemInfo, FightGroupActiveItemModel>(); FightGroupsModel groupsdata = FightGroupApplication.GetGroup(orderDetail.ActiveId, orderDetail.GroupId); if (groupsdata == null) { throw new HimallException("错误的拼团信息"); } if (data != null) { //商品图片地址修正 data.ProductDefaultImage = HimallIO.GetRomoteProductSizeImage(data.ProductImgPath, 1, (int)ImageSize.Size_350); } orderDetail.AddGroupTime = groupsdata.AddGroupTime; orderDetail.GroupStatus = groupsdata.BuildStatus; orderDetail.ProductId = data.ProductId; orderDetail.ProductName = data.ProductName; orderDetail.IconUrl = HimallIO.GetRomoteProductSizeImage(data.ProductImgPath, 1, (int)ImageSize.Size_350);//result.IconUrl; orderDetail.thumbs = HimallIO.GetRomoteProductSizeImage(data.ProductImgPath, 1, (int)ImageSize.Size_100); //在使用之后,再修正为绝对路径 data.ProductImgPath = HimallIO.GetRomoteImagePath(data.ProductImgPath); orderDetail.MiniGroupPrice = data.MiniGroupPrice; TimeSpan mids = DateTime.Now - (DateTime)orderDetail.AddGroupTime; orderDetail.Seconds = (int)(data.LimitedHour * 3600) - (int)mids.TotalSeconds; orderDetail.LimitedHour = data.LimitedHour.GetValueOrDefault(); orderDetail.LimitedNumber = data.LimitedNumber.GetValueOrDefault(); orderDetail.JoinedNumber = groupsdata.JoinedNumber; orderDetail.OverTime = groupsdata.OverTime.HasValue ? groupsdata.OverTime : orderDetail.AddGroupTime.AddHours((double)orderDetail.LimitedHour); if (orderDetail.OverTime.HasValue) { orderDetail.OverTime = DateTime.Parse(orderDetail.OverTime.Value.ToString("yyyy-MM-dd HH:mm:ss")); } //拼装已参团成功的用户 userList = ServiceProvider.Instance <IFightGroupService> .Create.GetActiveUsers((long)orderDetail.ActiveId, (long)orderDetail.GroupId); foreach (var userItem in userList) { var userInfo = new UserInfo(); userInfo.Photo = !string.IsNullOrWhiteSpace(userItem.Photo) ? Core.HimallIO.GetRomoteImagePath(userItem.Photo) : ""; userInfo.UserName = userItem.UserName; userInfo.JoinTime = userItem.JoinTime; orderDetail.UserInfo.Add(userInfo); } //获取团长信息 var GroupsData = ServiceProvider.Instance <IFightGroupService> .Create.GetGroup(orderDetail.ActiveId, orderDetail.GroupId); if (GroupsData != null) { orderDetail.HeadUserName = GroupsData.HeadUserName; orderDetail.HeadUserIcon = !string.IsNullOrWhiteSpace(GroupsData.HeadUserIcon) ? Core.HimallIO.GetRomoteImagePath(GroupsData.HeadUserIcon) : ""; orderDetail.ShowHeadUserIcon = !string.IsNullOrWhiteSpace(GroupsData.ShowHeadUserIcon) ? Core.HimallIO.GetRomoteImagePath(GroupsData.ShowHeadUserIcon) : ""; } //商品评论数 var product = ServiceProvider.Instance <IProductService> .Create.GetProduct(orderDetail.ProductId); var comCount = CommentApplication.GetCommentCountByProduct(product.Id); //商品描述 var ProductDescription = ServiceApplication.Create <IProductService>().GetProductDescription(orderDetail.ProductId); if (ProductDescription == null) { throw new Himall.Core.HimallException("错误的商品编号"); } string description = ProductDescription.ShowMobileDescription.Replace("src=\"/Storage/", "src=\"" + Core.HimallIO.GetRomoteImagePath("/Storage/") + "/");//商品描述 return(JsonResult <dynamic>(new { OrderDetail = orderDetail, ComCount = comCount, ProductDescription = description })); }
/// <summary> /// 开团成功 /// </summary> /// <param name="orderid">订单编号</param> /// <returns></returns> public ActionResult GroupOrderOk(long orderid) { FightGroupOrderOkModel model = new FightGroupOrderOkModel(); var gpord = FightGroupApplication.GetOrder(orderid); if (gpord == null) { throw new HimallException("错误的拼团订单信息"); } var gpobj = FightGroupApplication.GetGroup(gpord.ActiveId, gpord.GroupId); if (gpobj == null) { throw new HimallException("错误的拼团信息"); } if (gpobj.BuildStatus == FightGroupBuildStatus.Opening) { //throw new HimallException("开团未成功,等待团长付款中"); return(Redirect(string.Format("/m-{0}/Member/Center/", PlatformType.ToString()))); } if (gpobj.BuildStatus == FightGroupBuildStatus.Failed) { //throw new HimallException("成团已失败"); //return Redirect(string.Format("/m-{0}/Member/Center/", PlatformType.ToString())); } var gpact = FightGroupApplication.GetActive(gpobj.ActiveId); model.isFirst = gpord.IsFirstOrder; model.LimitedNumber = gpobj.LimitedNumber; model.JoinNumber = gpobj.JoinedNumber; model.FightGroupStatus = gpobj.BuildStatus; if (gpobj.BuildStatus != FightGroupBuildStatus.Success) { model.ShareUrl = string.Format("{0}/m-{1}/FightGroup/GroupDetail/{2}?aid={3}", CurrentUrlHelper.CurrentUrlNoPort(), "WeiXin", gpobj.Id, gpobj.ActiveId); model.ShareTitle = "我参加了(" + gpobj.ProductName + ")的拼团"; model.ShareImage = gpact.ProductDefaultImage; if (!string.IsNullOrWhiteSpace(model.ShareImage)) { if (model.ShareImage.Substring(0, 4) != "http") { model.ShareImage = HimallIO.GetRomoteImagePath(model.ShareImage); } } int neednum = gpobj.LimitedNumber - gpobj.JoinedNumber; neednum = neednum < 0 ? 0 : neednum; if (neednum > 0) { model.ShareDesc = "还差" + neednum + "人即可成团"; } if (!string.IsNullOrWhiteSpace(gpact.ProductShortDescription)) { if (!string.IsNullOrWhiteSpace(model.ShareDesc)) { model.ShareDesc += ",(" + gpact.ProductShortDescription + ")"; } else { model.ShareDesc += gpact.ProductShortDescription; } } } return(View(model)); }
/// <summary> /// 参与拼团 /// <para>拼团查看</para> /// </summary> /// <param name="id">团编号</param> /// <param name="aid">活动编号</param> /// <returns></returns> public ActionResult GroupDetail(long id, long aid) { FightGroupActiveModel activedata = FightGroupApplication.GetActive(aid, false); if (activedata == null) { throw new HimallException("错误的活动信息"); } activedata.InitProductImages(); FightGroupsModel groupsdata = FightGroupApplication.GetGroup(aid, id); if (groupsdata == null) { throw new HimallException("错误的拼团信息"); } if (groupsdata.BuildStatus == FightGroupBuildStatus.Opening) { return(Redirect(string.Format("/m-{0}/Member/Center/", PlatformType.ToString()))); } FightGroupGroupDetailModel model = new FightGroupGroupDetailModel(); model.ActiveData = activedata; model.GroupsData = groupsdata; model.HasJoin = false; if (CurrentUser != null) { model.HasJoin = !FightGroupApplication.CanJoinGroup(aid, id, CurrentUser.Id); } model.ShareUrl = string.Format("{0}/m-{1}/FightGroup/GroupDetail/{2}?aid={3}", CurrentUrlHelper.CurrentUrlNoPort(), "WeiXin", groupsdata.Id, groupsdata.ActiveId); model.ShareTitle = "我参加了(" + activedata.ProductName + ")的拼团"; model.ShareImage = activedata.ProductDefaultImage; if (!string.IsNullOrWhiteSpace(model.ShareImage)) { if (model.ShareImage.Substring(0, 4) != "http") { model.ShareImage = HimallIO.GetRomoteImagePath(model.ShareImage); } } int neednum = groupsdata.LimitedNumber - groupsdata.JoinedNumber; neednum = neednum < 0 ? 0 : neednum; if (neednum > 0) { model.ShareDesc = "还差" + neednum + "人即可成团"; } if (!string.IsNullOrWhiteSpace(activedata.ProductShortDescription)) { if (!string.IsNullOrWhiteSpace(model.ShareDesc)) { model.ShareDesc += ",(" + activedata.ProductShortDescription + ")"; } else { model.ShareDesc += activedata.ProductShortDescription; } } model.ActiveData.IsSaleCountOnOff = SiteSettingApplication.SiteSettings.ProductSaleCountOnOff == 1; //是否显示销量 model.ActiveData.SaleVolume = activedata.ActiveItems.Sum(d => d.BuyCount); //销量 model.ActiveData.FreightTemplate = FreightTemplateApplication.GetFreightTemplate(activedata.FreightTemplateId); //运费模板 model.ActiveData.FreightStr = FreightTemplateApplication.GetFreightStr(activedata.ProductId, activedata.FreightTemplate, CurrentUser); //运费或免运费 return(View(model)); }
/// <summary> /// 获取拼团订单详情 /// </summary> /// <param name="Id">订单Id</param> /// <returns></returns> public object GetFightGroupOrderDetail(long Id) { var userList = new List <FightGroupOrderInfo>(); var orderDetail = FightGroupApplication.GetFightGroupOrderStatusByOrderId(Id); //团组活动信息 orderDetail.UserInfo = new List <UserInfo>(); var data = FightGroupApplication.GetActive((long)orderDetail.ActiveId, false, true); Mapper.CreateMap <FightGroupActiveInfo, FightGroupActiveModel>(); //规格映射 Mapper.CreateMap <FightGroupActiveItemInfo, FightGroupActiveItemModel>(); if (data != null) { //商品图片地址修正 data.ProductDefaultImage = HimallIO.GetProductSizeImage(data.ProductImgPath, 1, (int)ImageSize.Size_350); data.ProductImgPath = HimallIO.GetRomoteImagePath(data.ProductImgPath); } FightGroupsModel groupsdata = FightGroupApplication.GetGroup(orderDetail.ActiveId.Value, orderDetail.GroupId.Value); if (groupsdata == null) { throw new HimallException("错误的拼团信息"); } orderDetail.AddGroupTime = groupsdata.AddGroupTime; //if (!string.IsNullOrWhiteSpace(result.IconUrl)) //{ // result.IconUrl = Himall.Core.HimallIO.GetImagePath(result.IconUrl); //} orderDetail.ProductId = data.ProductId; orderDetail.ProductName = data.ProductName; orderDetail.IconUrl = HimallIO.GetRomoteProductSizeImage(data.ProductImgPath, 1, (int)ImageSize.Size_350);//result.IconUrl; orderDetail.MiniGroupPrice = data.MiniGroupPrice; TimeSpan mids = DateTime.Now - (DateTime)orderDetail.AddGroupTime; orderDetail.Seconds = (int)(data.LimitedHour * 3600) - (int)mids.TotalSeconds; orderDetail.LimitedHour = data.LimitedHour.GetValueOrDefault(); orderDetail.LimitedNumber = data.LimitedNumber.GetValueOrDefault(); orderDetail.JoinedNumber = groupsdata.JoinedNumber; orderDetail.OverTime = groupsdata.OverTime.HasValue? groupsdata.OverTime:orderDetail.AddGroupTime.AddHours((double)orderDetail.LimitedHour); //拼装已参团成功的用户 userList = ServiceProvider.Instance <IFightGroupService> .Create.GetActiveUsers((long)orderDetail.ActiveId, (long)orderDetail.GroupId); foreach (var userItem in userList) { var userInfo = new UserInfo(); userInfo.Photo = !string.IsNullOrWhiteSpace(userItem.Photo) ? Core.HimallIO.GetRomoteImagePath(userItem.Photo) : ""; userInfo.UserName = userItem.UserName; userInfo.JoinTime = userItem.JoinTime; orderDetail.UserInfo.Add(userInfo); } //获取团长信息 var GroupsData = ServiceProvider.Instance <IFightGroupService> .Create.GetGroup((long)orderDetail.ActiveId, (long)orderDetail.GroupId); if (GroupsData != null) { orderDetail.HeadUserName = GroupsData.HeadUserName; orderDetail.HeadUserIcon = !string.IsNullOrWhiteSpace(GroupsData.HeadUserIcon) ? Core.HimallIO.GetRomoteImagePath(GroupsData.HeadUserIcon) : ""; orderDetail.ShowHeadUserIcon = !string.IsNullOrWhiteSpace(GroupsData.ShowHeadUserIcon) ? Core.HimallIO.GetRomoteImagePath(GroupsData.ShowHeadUserIcon) : ""; } //商品评论数 var product = ServiceProvider.Instance <IProductService> .Create.GetProduct((long)orderDetail.ProductId); var com = product.Himall_ProductComments.Where(item => !item.IsHidden.HasValue || item.IsHidden.Value == false); var comCount = com.Count(); //商品描述 var ProductDescription = ServiceHelper.Create <IProductService>().GetProductDescription((long)orderDetail.ProductId); if (ProductDescription == null) { throw new Himall.Core.HimallException("错误的商品编号"); } string description = ProductDescription.ShowMobileDescription.Replace("src=\"/Storage/", "src=\"" + Core.HimallIO.GetRomoteImagePath("/Storage/"));//商品描述 return(Json(new { OrderDetail = orderDetail, ComCount = comCount, ProductDescription = description })); }