예제 #1
0
        /// <summary>
        /// 取积分优惠券
        /// </summary>
        /// <param name="page"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public JsonResult <Result <dynamic> > GetIntegralCoupon(int pageNo = 1, int pageSize = 10)
        {
            QueryPageModel <CouponInfo> coupons = CouponApplication.GetIntegralCoupons(pageNo, pageSize);

            Mapper.CreateMap <CouponInfo, CouponGetIntegralCouponModel>();
            QueryPageModel <CouponGetIntegralCouponModel> result = new QueryPageModel <CouponGetIntegralCouponModel>();

            result.Total = coupons.Total;
            if (result.Total > 0)
            {
                var datalist = coupons.Models.ToList();

                var objlist = new List <CouponGetIntegralCouponModel>();
                foreach (var item in datalist)
                {
                    var tmp = Mapper.Map <CouponGetIntegralCouponModel>(item);
                    tmp.ShowIntegralCover = Core.HimallIO.GetRomoteImagePath(item.IntegralCover);
                    var vshopobj = VshopApplication.GetVShopByShopId(tmp.ShopId);
                    if (vshopobj != null)
                    {
                        tmp.VShopId = vshopobj.Id;
                        //优惠价封面为空时,取微店Logo,微店Logo为空时,取商城微信Logo
                        if (string.IsNullOrWhiteSpace(tmp.ShowIntegralCover))
                        {
                            if (!string.IsNullOrWhiteSpace(vshopobj.WXLogo))
                            {
                                tmp.ShowIntegralCover = Core.HimallIO.GetRomoteImagePath(vshopobj.WXLogo);
                            }
                        }
                    }
                    if (string.IsNullOrWhiteSpace(tmp.ShowIntegralCover))
                    {
                        var siteset = SiteSettingApplication.SiteSettings;
                        tmp.ShowIntegralCover = Core.HimallIO.GetRomoteImagePath(siteset.WXLogo);
                    }
                    objlist.Add(tmp);
                }
                result.Models = objlist.ToList();
            }
            return(JsonResult <dynamic>(new { total = result.Total, Data = result.Models }));
        }
예제 #2
0
        public object GetIndexData(string openId = "")
        {
            //轮播图
            dynamic result  = new System.Dynamic.ExpandoObject();
            var     slidads = SlideApplication.GetSlidAds(0, Entities.SlideAdInfo.SlideAdType.AppGifts).ToList();

            foreach (var item in slidads)
            {
                item.ImageUrl = MallIO.GetRomoteImagePath(item.ImageUrl);
            }
            result.SlideAds = slidads;

            //大转盘刮刮卡
            var malllist = new List <IntegralMallAdInfo>();
            var robj     = GiftApplication.GetAdInfo(IntegralMallAdInfo.AdActivityType.Roulette, IntegralMallAdInfo.AdShowPlatform.APP);

            if (robj != null)
            {
                //robj.LinkUrl = Request.RequestUri.Scheme + "://" + Request.RequestUri.Authority + "/m-wap/BigWheel/index/" + robj.ActivityId;
                robj.LinkUrl = "/m-wap/BigWheel/index/" + robj.ActivityId;
                malllist.Add(robj);
            }
            var cobj = GiftApplication.GetAdInfo(IntegralMallAdInfo.AdActivityType.ScratchCard, IntegralMallAdInfo.AdShowPlatform.APP);

            if (cobj != null)
            {
                //cobj.LinkUrl = Request.RequestUri.Scheme + "://" + Request.RequestUri.Authority + "/m-wap/ScratchCard/index/" + cobj.ActivityId;
                cobj.LinkUrl = "/m-wap/ScratchCard/index/" + cobj.ActivityId;
                malllist.Add(cobj);
            }
            result.WeiActives = malllist;

            //首页礼品
            GiftQuery query = new GiftQuery();

            query.skey     = "";
            query.status   = Mall.Entities.GiftInfo.GiftSalesStatus.Normal;
            query.PageSize = 4;
            query.PageNo   = 1;
            QueryPageModel <GiftModel> gifts = GiftApplication.GetGifts(query);

            result.HomeGiftses  = gifts.Models.ToList();
            result.HasMoreGifts = gifts.Total > 4;
            foreach (var item in result.HomeGiftses)
            {
                item.DefaultShowImage = MallIO.GetRomoteImagePath(item.GetImage(ImageSize.Size_350));
            }

            //积分优惠券
            var coupons = CouponApplication.GetIntegralCoupons(1, 3);

            //   Mapper.CreateMap<CouponInfo, CouponGetIntegralCouponModel>();
            if (coupons.Models.Count > 0)
            {
                var datalist = coupons.Models.ToList();
                var objlist  = new List <CouponGetIntegralCouponModel>();
                foreach (var item in datalist)
                {
                    var tmp = item.Map <CouponGetIntegralCouponModel>();
                    tmp.ShowIntegralCover = MallIO.GetRomoteImagePath(item.IntegralCover);
                    var vshopobj = VshopApplication.GetVShopByShopId(tmp.ShopId);
                    if (vshopobj != null)
                    {
                        tmp.VShopId = vshopobj.Id;
                        //优惠价封面为空时,取微店Logo,微店Logo为空时,取商城微信Logo
                        if (string.IsNullOrWhiteSpace(tmp.ShowIntegralCover))
                        {
                            if (!string.IsNullOrWhiteSpace(vshopobj.WXLogo))
                            {
                                tmp.ShowIntegralCover = MallIO.GetRomoteImagePath(vshopobj.WXLogo);
                            }
                        }
                    }
                    if (string.IsNullOrWhiteSpace(tmp.ShowIntegralCover))
                    {
                        var siteset = SiteSettingApplication.SiteSettings;
                        tmp.ShowIntegralCover = MallIO.GetRomoteImagePath(siteset.WXLogo);
                    }
                    objlist.Add(tmp);
                }
                result.IntegralCoupons        = objlist.ToList();
                result.HasMoreIntegralCoupons = coupons.Total > 3;
            }

            result.HasLogined = false;

            //用户积分与等级
            if (CurrentUser != null)
            {
                //登录后处理会员积分
                var userInte  = MemberIntegralApplication.GetMemberIntegral(CurrentUser.Id);
                var userGrade = MemberGradeApplication.GetMemberGradeByUserIntegral(userInte.HistoryIntegrals);
                result.MemberAvailableIntegrals = userInte.AvailableIntegrals;
                result.MemberGradeName          = userGrade.GradeName;
                result.HasLogined = true;
            }
            return(Json(result));
        }