示例#1
0
        public ActionResult ShakingLottery()
        {
            string strId = Request.QueryString["campaignId"];
            Guid   id    = Guid.Empty;

            if (String.IsNullOrEmpty(strId) || Guid.TryParse(strId, out id) == false)
            {
                return(RespondResult(false, "参数无效。"));
            }

            ShakingLotteryViewModel model = new ShakingLotteryViewModel();

            model.CampaignBundle = _campaignManager.ShakingLottery.GetBundle(id);

            if (model.CampaignBundle.ShakingLottery.Mode == EnumCampaign_ShakingLotteryMode.Period)
            {
                model.PeriodList = _campaignManager.ShakingLottery.GetPeriodList(id);
                if (model.CampaignBundle.ShakingLottery.Period.HasValue)
                {
                    model.CurrentPeriod = _campaignManager.ShakingLottery.GetPeriod(model.CampaignBundle.ShakingLottery.Period.Value);
                }
            }

            return(View(model));
        }
        public ActionResult ShakingLottery()
        {
            string strCampaignId = Request.QueryString["campaignId"];
            Guid   campaignId    = Guid.Empty;

            if (String.IsNullOrEmpty(strCampaignId) || Guid.TryParse(strCampaignId, out campaignId) == false)
            {
                return(RespondResult(false, "参数无效。"));
            }

            //递增活动页面PV
            _campaignManager.PageVisit(campaignId);

            ShakingLotteryViewModel model = new ShakingLotteryViewModel();

            model.CampaignBundle = _campaignManager.ShakingLottery.GetBundle(campaignId);

            if (model.CampaignBundle == null || model.CampaignBundle.Empty)
            {
                //重定向到错误页面
                return(new RedirectResult(String.Format(
                                              "~/Home/ErrorView/?message={0}", "td8")));
            }

            if (model.CampaignBundle.ShakingLottery.Mode == EnumCampaign_ShakingLotteryMode.Period)
            {
                if (model.CampaignBundle.ShakingLottery.Period.HasValue)
                {
                    model.CurrentPeriod = _campaignManager.ShakingLottery.GetPeriod(model.CampaignBundle.ShakingLottery.Period.Value);
                }

                if (model.CurrentPeriod != null)
                {
                    model.PlayedTimes = _campaignManager.ShakingLottery.GetMemberPlayedTimes(
                        campaignId, model.CurrentPeriod.Id, MemberContext.Member.Id);
                }
            }
            else
            {
                model.PlayedTimes = _campaignManager.ShakingLottery.GetMemberPlayedTimes(campaignId, null, MemberContext.Member.Id);
            }

            model.DataReport = _campaignManager.ShakingLottery.GetDataReport(campaignId);
            model.GiftList   = _campaignManager.ShakingLottery.GetMemberObtainedGiftList(campaignId, MemberContext.Member.Id);

            WeixinJsApiConfig jsApiConfig = new WeixinJsApiConfig();

            jsApiConfig = DomainContext.GetJsApiConfig(HttpContext.Request.Url.ToString());
            jsApiConfig.JsApiList.Add("onMenuShareTimeline");
            jsApiConfig.JsApiList.Add("onMenuShareAppMessage");
            ViewBag.JsApiConfig = jsApiConfig;

            return(View(model));
        }