예제 #1
0
        public object GetOrderBonus(string orderIds)
        {
            CheckUserLogin();
            List <BonuModel> bonus = new List <BonuModel>();
            var    shopService     = ServiceProvider.Instance <IShopService> .Create;
            var    orderService    = ServiceProvider.Instance <IOrderService> .Create;
            var    bonusService    = ServiceProvider.Instance <IShopBonusService> .Create;
            string orderids        = orderIds;

            string[] orderArray = orderids.Split(',');
            foreach (string item in orderArray)
            {
                long orderid = 0;
                if (long.TryParse(item, out orderid))
                {
                    var bonuInfo = bonusService.GetGrantByUserOrder(orderid, CurrentUser.Id);
                    if (bonuInfo != null)
                    {
                        BonuModel bonuObject = new BonuModel();
                        bonuObject.ShareHref   = "http://" + HttpContext.Current.Request.Url.Host + "/m-weixin/shopbonus/index/" + bonuInfo.Id;
                        bonuObject.ShareCount  = bonuInfo.Himall_ShopBonus.Count;
                        bonuObject.ShareDetail = bonuInfo.Himall_ShopBonus.ShareDetail;
                        bonuObject.ShareTitle  = bonuInfo.Himall_ShopBonus.ShareTitle;
                        bonuObject.ShopName    = shopService.GetShop(bonuInfo.Himall_ShopBonus.ShopId).ShopName;
                        bonus.Add(bonuObject);
                    }
                }
            }

            return(Json(new { Success = "true", List = bonus }));
        }
예제 #2
0
        public object GetOrderBonus(string orderIds)
        {
            CheckUserLogin();
            List <BonuModel> bonus = new List <BonuModel>();
            var    shopService     = ServiceProvider.Instance <IShopService> .Create;
            var    orderService    = ServiceProvider.Instance <IOrderService> .Create;
            var    bonusService    = ServiceProvider.Instance <IShopBonusService> .Create;
            string orderids        = orderIds;

            string[] orderArray = orderids.Split(',');
            foreach (string item in orderArray)
            {
                long orderid = 0;
                if (long.TryParse(item, out orderid))
                {
                    var BonusInfo = bonusService.GetGrantByUserOrder(orderid, CurrentUser.Id);
                    if (BonusInfo != null)
                    {
                        BonuModel bonuObject = new BonuModel();
                        var       info       = ShopBonusApplication.GetBonus(BonusInfo.ShopBonusId);
                        bonuObject.ShareHref   = CurrentUrlHelper.CurrentUrlNoPort() + "/m-weixin/shopbonus/index/" + BonusInfo.Id;
                        bonuObject.ShareCount  = info.Count;
                        bonuObject.ShareDetail = info.ShareDetail;
                        bonuObject.ShareTitle  = info.ShareTitle;
                        bonuObject.ShopName    = shopService.GetShop(info.ShopId).ShopName;
                        bonus.Add(bonuObject);
                    }
                }
            }

            return(new { success = true, List = bonus });
        }