/// <summary> /// 查看活动 /// </summary> /// <param name="id">活动编号</param> /// <returns></returns> public ActionResult ViewActive(long id) { FightGroupActiveModel model = FightGroupApplication.GetActive(id); if (model == null) { throw new MallException("错误的活动编号"); } return(View(model)); }
public JsonResult PostActiveList(int page) { int pageSize = 5; QueryPageModel <FightGroupActiveListModel> model = FightGroupApplication.GetActives(new List <FightGroupActiveStatus> { 0, FightGroupActiveStatus.WillStart }, "", "", null, page, pageSize); List <FightGroupActiveListModel> list2 = model.Models.ToList <FightGroupActiveListModel>(); return(base.Json(new { success = true, rows = list2, total = model.Total })); }
public ActionResult ShowNewCanJoinGroup(long id) { List <FightGroupBuildStatus> statuses = new List <FightGroupBuildStatus> { 0 }; DateTime?startTime = null; List <FightGroupsListModel> model = FightGroupApplication.GetGroups(id, statuses, startTime, null, 1, 10).Models.ToList <FightGroupsListModel>(); return(base.View(model)); }
/// <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 ActionResult ShowNewCanJoinGroup(long id) { List <FightGroupBuildStatus> stlist = new List <FightGroupBuildStatus>(); stlist.Add(FightGroupBuildStatus.Ongoing); var data = FightGroupApplication.GetGroups(id, stlist, null, null, 1, 10); var datatlist = data.Models.ToList(); return(View(datatlist)); }
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)); }
public JsonResult PostGroupList(long actionId, FightGroupBuildStatus?groupStatus, DateTime?startTime, DateTime?endTime, int page, int rows) { List <FightGroupBuildStatus> seastatus = new List <FightGroupBuildStatus>(); if (groupStatus.HasValue) { seastatus.Add(groupStatus.Value); } var data = FightGroupApplication.GetGroups(actionId, seastatus, startTime, endTime, page, rows); return(Json(new { rows = data.Models.ToList(), total = data.Total })); }
public JsonResult PostActiveList(FightGroupActiveQuery query) { query.SaleStatus = ProductSaleStatus.OnSale;//已销售状态商品 query.PageSize = 5; query.ActiveStatusList = new List <FightGroupActiveStatus> { FightGroupActiveStatus.Ongoing, FightGroupActiveStatus.WillStart }; var data = FightGroupApplication.GetActives(query); return(Json(new { success = true, data = data.Models, total = data.Total })); }
public JsonResult PostActiveList(string productName, FightGroupActiveStatus?activeStatus, string shopName, int page, int rows) { List <FightGroupActiveStatus> seastatus = new List <FightGroupActiveStatus>(); if (activeStatus.HasValue) { seastatus.Add(activeStatus.Value); } var data = FightGroupApplication.GetActives(seastatus, productName, shopName, null, page, rows); return(Json(new { rows = data.Models.ToList(), total = data.Total })); }
public JsonResult EndActive(long id) { Result result = new Result(); var data = FightGroupApplication.GetActive(id, false, false); data.EndTime = DateTime.Now.AddMinutes(-1); FightGroupApplication.UpdateActive(data); ProductManagerApplication.SaveCaculateMinPrice(data.ProductId, CurrentShop.Id); result.success = true; result.msg = "操作成功"; return(Json(result)); }
public JsonResult PostActiveList(int page) { int pagesize = 5; List <FightGroupActiveStatus> seastatus = new List <FightGroupActiveStatus>(); seastatus.Add(FightGroupActiveStatus.Ongoing); seastatus.Add(FightGroupActiveStatus.WillStart); var data = FightGroupApplication.GetActives(seastatus, "", "", null, page, pagesize); var datalist = data.Models.ToList(); return(Json(new { success = true, rows = datalist, total = data.Total })); }
/// <summary> /// 修改拼团活动 /// </summary> /// <returns></returns> public ActionResult EditActive(long id) { FightGroupActiveModel model = FightGroupApplication.GetActive(id); if (model == null) { throw new MallException("错误的活动编号"); } if (model.EndTime < DateTime.Now) { throw new MallException("已结束的活动不可以编辑"); } return(View(model)); }
public JsonResult CheckBuyNumber(long id, string skuId, int count) { long exist = 0; if (CurrentUser != null) { exist = FightGroupApplication.GetMarketSaleCountForUserId(id, CurrentUser.Id); } else { exist = 0; //未登录用户默认为未买 } return(Json(new { success = true, data = new { hasbuy = exist } })); }
public JsonResult CheckBuyNumber(long id, string skuId, int count) { int marketSaleCountForUserId = 0; if (base.CurrentUser != null) { marketSaleCountForUserId = FightGroupApplication.GetMarketSaleCountForUserId(id, base.CurrentUser.Id); } else { marketSaleCountForUserId = 0; } return(base.Json(new { success = true, hasbuy = marketSaleCountForUserId })); }
public JsonResult CanJoin(long aid, long gpid) { Result result = new Result { success = false, msg = "不可重复参团" }; if (FightGroupApplication.CanJoinGroup(aid, gpid, CurrentUser.Id)) { result = new Result { success = true, msg = "yes" }; } return(Json(result)); }
/// <summary> /// 查看活动 /// </summary> /// <param name="id">活动编号</param> /// <returns></returns> public ActionResult ViewActive(long id) { FightGroupActiveModel model = FightGroupApplication.GetActive(id); if (model == null) { throw new MallException("错误的活动编号"); } if (model.ShopId != CurShopId) { throw new MallException("错误的活动编号"); } model.ProductDefaultImage = MallIO.GetProductSizeImage(model.ProductImgPath, 1, ImageSize.Size_150.GetHashCode()); return(View(model)); }
/// <summary> /// 查看拼团情况 /// </summary> /// <param name="id">活动编号</param> /// <returns></returns> public ActionResult ViewGroupList(long id) { var actobj = FightGroupApplication.GetActive(id, false, false); if (actobj == null) { throw new MallException("错误的活动编号"); } if (actobj.ShopId != CurShopId) { throw new MallException("错误的活动编号"); } ViewBag.ActionId = id; return(View()); }
public JsonResult ServiceSetting(decimal Price) { Result result = new Result(); if (Price < 0) { result.success = false; result.msg = "错误的服务价格!"; return(Json(result)); } FightGroupApplication.SetMarketServicePrice(Price); result.success = true; result.msg = "保存成功!"; return(Json(result)); }
public JsonResult GetSkus(long id) { FightGroupActiveModel model = FightGroupApplication.GetActive(id, false, true); if (model == null) { throw new HimallException("错误的活动信息"); } List <SKUDataModel> data = (from d in model.ActiveItems where d.ActiveStock > 0L select new SKUDataModel { SkuId = d.SkuId, Color = d.Color, Size = d.Size, Version = d.Version, Stock = (int)d.ActiveStock.Value, CostPrice = d.ProductCostPrice, SalePrice = d.ProductPrice, Price = d.ActivePrice }).ToList <SKUDataModel>(); return(base.Json(data)); }
public ActionResult Detail(long id) { FightGroupActiveModel source = FightGroupApplication.GetActive(id, false, true); if (source == null) { throw new HimallException("错误的活动信息"); } source.InitProductImages(); Mapper.CreateMap <FightGroupActiveModel, FightGroupActiveDetailModel>(); FightGroupActiveDetailModel model = Mapper.Map <FightGroupActiveDetailModel>(source); decimal memberDiscount = 1; if (base.CurrentUser != null) { memberDiscount = base.CurrentUser.MemberDiscount; } ((dynamic)base.ViewBag).Discount = memberDiscount; Shop shop = ShopApplication.GetShop(model.ShopId, false); ((dynamic)base.ViewBag).IsSelf = shop.IsSelf; model.ShareUrl = string.Format("{0}/m-{1}/FightGroup/Detail/{2}", CurrentUrlHelper.CurrentUrlNoPort(), "WeiXin", source.Id); model.ShareTitle = (source.ActiveStatus == FightGroupActiveStatus.WillStart) ? "限时限量火拼 即将开始" : "限时限量火拼 正在进行"; model.ShareImage = source.ProductDefaultImage; if (!string.IsNullOrWhiteSpace(model.ShareImage) && (model.ShareImage.Substring(0, 4) != "http")) { model.ShareImage = HimallIO.GetRomoteImagePath(model.ShareImage, null); } model.ShareDesc = source.ProductName; if (!string.IsNullOrWhiteSpace(source.ProductShortDescription)) { model.ShareDesc = model.ShareDesc + ",(" + source.ProductShortDescription + ")"; } if (model.ProductId.HasValue) { StatisticApplication.StatisticVisitCount(model.ProductId.Value, model.ShopId); } List <CustomerService> mobileCustomerService = CustomerServiceApplication.GetMobileCustomerService(model.ShopId); CustomerService item = CustomerServiceApplication.GetPreSaleByShopId(model.ShopId).FirstOrDefault <CustomerService>(p => p.Tool == CustomerServiceInfo.ServiceTool.MeiQia); if (item != null) { mobileCustomerService.Insert(0, item); } ((dynamic)base.ViewBag).CustomerServices = mobileCustomerService; return(base.View(model)); }
public JsonResult CanJoin(long aid, long gpid) { BaseController.Result data = new BaseController.Result { success = false, msg = "不可重复参团" }; if (FightGroupApplication.CanJoinGroup(aid, gpid, base.CurrentUser.Id)) { data = new BaseController.Result { success = true, msg = "yes" }; } return(base.Json(data)); }
/// <summary> /// 过滤过程 /// </summary> /// <param name="filterContext"></param> protected override void OnActionExecuting(ActionExecutingContext filterContext) { //路由处理 var route = filterContext.RouteData; //string controller = route.Values["controller"].ToString().ToLower(); string action = route.Values["action"].ToString().ToLower(); if (action.ToLower() != "close") { if (!FightGroupApplication.IsOpenMarketService()) { filterContext.Result = RedirectToAction("Close"); return; } } base.OnActionExecuting(filterContext); }
public ActionResult PaymentToOrders(string ids) { //红包数据 var bonusGrantIds = new Dictionary <long, Entities.ShopBonusInfo>(); string url = CurrentUrlHelper.CurrentUrlNoPort() + "/m-weixin/shopbonus/index/"; if (!string.IsNullOrEmpty(ids)) { string[] strIds = ids.Split(','); List <long> longIds = new List <long>(); foreach (string id in strIds) { longIds.Add(long.Parse(id)); } var result = PaymentHelper.GenerateBonus(longIds, Request.Url.Host.ToString()); foreach (var item in result) { bonusGrantIds.Add(item.Key, item.Value); } } ViewBag.Path = url; ViewBag.BonusGrantIds = bonusGrantIds; ViewBag.Shops = ShopApplication.GetShops(bonusGrantIds.Select(p => p.Value.ShopId)); ViewBag.BaseAddress = CurrentUrlHelper.CurrentUrlNoPort(); var statistic = StatisticApplication.GetMemberOrderStatistic(CurrentUser.Id); ViewBag.WaitingForComments = statistic.WaitingForComments; ViewBag.AllOrders = statistic.OrderCount; ViewBag.WaitingForRecieve = statistic.WaitingForRecieve + OrderApplication.GetWaitConsumptionOrderNumByUserId(CurrentUser.Id); ViewBag.WaitingForPay = statistic.WaitingForPay; ViewBag.WaitingForDelivery = statistic.WaitingForDelivery; var order = OrderApplication.GetUserOrders(CurrentUser.Id, 1).FirstOrDefault(); if (order != null && order.OrderType == OrderInfo.OrderTypes.FightGroup) { var gpord = FightGroupApplication.GetOrder(order.Id); if (gpord != null) { return(Redirect(string.Format("/m-{0}/FightGroup/GroupOrderOk?orderid={1}", PlatformType.ToString(), order.Id))); } } return(View("~/Areas/Mobile/Templates/Default/Views/Member/Orders.cshtml")); }
public object GetFightGroupOrderByUser(int page) { CheckUserLogin(); int pagesize = 5; long UserId = CurrentUserId; var userList = new List <FightGroupOrderInfo>(); List <FightGroupOrderJoinStatus> seastatus = new List <FightGroupOrderJoinStatus>(); seastatus.Add(FightGroupOrderJoinStatus.JoinSuccess); seastatus.Add(FightGroupOrderJoinStatus.BuildFailed); seastatus.Add(FightGroupOrderJoinStatus.BuildSuccess); var data = FightGroupApplication.GetJoinGroups(UserId, seastatus, page, pagesize); var datalist = data.Models.ToList(); List <FightGroupGetFightGroupOrderByUserModel> resultlist = new List <FightGroupGetFightGroupOrderByUserModel>(); foreach (var item in datalist) { FightGroupGetFightGroupOrderByUserModel _tmp = new FightGroupGetFightGroupOrderByUserModel(); _tmp.Id = item.Id; _tmp.ActiveId = item.ActiveId; _tmp.ProductName = item.ProductName; _tmp.ProductImgPath = MallIO.GetRomoteImagePath(item.ProductImgPath); _tmp.ProductDefaultImage = MallIO.GetRomoteProductSizeImage(_tmp.ProductImgPath, 1, (int)ImageSize.Size_350); _tmp.GroupEndTime = item.OverTime.HasValue ? item.OverTime.Value : item.GroupEndTime; _tmp.BuildStatus = item.BuildStatus; _tmp.NeedNumber = item.LimitedNumber - item.JoinedNumber; _tmp.UserIcons = new List <string>(); foreach (var sitem in item.GroupOrders) { _tmp.UserIcons.Add(MallIO.GetRomoteImagePath(sitem.Photo)); if (sitem.OrderUserId == UserId) { _tmp.OrderId = sitem.OrderId; _tmp.GroupPrice = sitem.SalePrice; } } resultlist.Add(_tmp); } dynamic _result = SuccessResult(); _result.data = resultlist; _result.total = data.Total; return(_result); }
/// <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)); }
public JsonResult GetSalePrice() { //会员折扣 decimal discount = 1M; long shopId = 0; if (CurrentUser != null) { discount = CurrentUser.MemberDiscount; var shopInfo = ShopApplication.GetSelfShop(); shopId = shopInfo.Id; } var limit = LimitTimeApplication.GetLimitProducts(); var fight = FightGroupApplication.GetFightGroupPrice(); return(Json(new { success = true, SelfShopId = shopId, Discount = discount, LimitProducts = limit, FightProducts = fight }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetSalePrice() { //会员折扣 decimal discount = 1M; long shopId = 0; if (CurrentUser != null) { discount = CurrentUser.MemberDiscount; var shopInfo = ShopApplication.GetSelfShop(); shopId = shopInfo.Id; } var limit = LimitTimeApplication.GetLimitProducts(); var fight = FightGroupApplication.GetFightGroupPrice(); return(Json <dynamic>(success: true, data: new { SelfShopId = shopId, Discount = discount, LimitProducts = limit, FightProducts = fight })); }
public JsonResult EditActive(FightGroupActiveModel model) { var result = new Result { success = false, msg = "未知错误", status = -1 }; FightGroupActiveModel data = FightGroupApplication.GetActive(model.Id); if (data == null) { throw new HimallException("错误的活动编号"); } if (model.EndTime < DateTime.Now) { throw new HimallException("错误的结束时间"); } if (model.EndTime < model.StartTime) { throw new HimallException("错误的结束时间"); } if (ModelState.IsValid) { UpdateModel(data); model = data; //数据有效性验证 model.CheckValidation(); data.IconUrl = SaveActiveIcon(data.IconUrl); FightGroupApplication.UpdateActive(data); result = new Result { success = true, msg = "操作成功", status = 1 }; } else { result = new Result { success = false, msg = "数据异常,请检查数据有效性", status = -1 }; } return(Json(result)); }