Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((!bll.IsLogin) || (!bll.IsMobile))
            {
                Response.Write("请用微信打开");
                Response.End();
            }
            try
            {
                CurrentUserInfo = bll.GetCurrentUserInfo();
                //if (string.IsNullOrEmpty(CurrentUserInfo.WXNickname))
                //{
                //    Session.Clear();
                //    Response.Redirect(Request.Url.ToString());
                //    Response.End();
                //    return;
                //}

                model = bll.Get <WXLotteryV1>(string.Format("LotteryID={0}", Request["id"]));
                if (model == null)
                {
                    Response.End();
                }


                var signInMsg    = string.Empty;
                var signInCanUse = new BllLottery().signInLotteryIsCanUse(model.LotteryID, out signInMsg);

                if (!signInCanUse)
                {
                    Response.Redirect("/Error/CommonMsg.aspx?msg=" + signInMsg);
                    Response.End();
                }


                myStartTime = ((DateTime)model.StartTime).ToString("yyyy/MM/dd HH:mm:ss");
                if (model.IsGetPrizeFromMobile.Equals(0))
                {
                    myPageCash = "1";
                }
                if (model.IsGetPrizeFromMobile.Equals(1))
                {
                    myPageCash = "2";
                }
                if (model.IsGetPrizeFromMobile.Equals(2))
                {
                    myPageCash = "3";
                }
                //myPageCash=model.IsGetPrizeFromMobile.Equals(1)?"true":"false";
                if (model.Status == 1)
                {
                }
                else
                {
                    myAwardGameOver = "true";
                }
                var lotteryRecord = bll.GetWXLotteryRecordV1(CurrentUserInfo.UserID, model.LotteryID);
                if (lotteryRecord != null)
                {
                    //IsShowVar = true;
                    myAwardName = lotteryRecord.WXAwardName;
                    myCashed    = IsUserGetPrizeV1(CurrentUserInfo.UserID, model.LotteryID).ToString().ToLower();
                    myIsAward   = "true";
                    if ((!string.IsNullOrEmpty(lotteryRecord.Name)) && (!string.IsNullOrEmpty(lotteryRecord.Phone)))
                    {
                        isSubmitInfo = "true";
                    }
                }
                else
                {
                    int count = bll.GetWXLotteryLogCountV1(model.LotteryID, CurrentUserInfo.UserID);
                    if (count >= model.MaxCount)
                    {
                        //IsShowVar = true;
                        myAwardName = "未中奖";
                        myCashed    = "false";
                        myIsAward   = "false";
                    }
                }
                MonitorEventDetailsInfo detailInfo = new MonitorEventDetailsInfo();
                detailInfo.MonitorPlanID  = model.LotteryID;
                detailInfo.EventType      = 0;
                detailInfo.EventBrowser   = HttpContext.Current.Request.Browser == null ? "" : HttpContext.Current.Request.Browser.ToString();
                detailInfo.EventBrowserID = HttpContext.Current.Request.Browser.Id;;
                if (HttpContext.Current.Request.Browser.Beta)
                {
                    detailInfo.EventBrowserIsBata = "测试版";
                }
                else
                {
                    detailInfo.EventBrowserIsBata = "正式版";
                }

                detailInfo.EventBrowserVersion = HttpContext.Current.Request.Browser.Version;
                detailInfo.EventDate           = DateTime.Now;
                if (HttpContext.Current.Request.Browser.Win16)
                {
                    detailInfo.EventSysByte = "16位系统";
                }
                else
                if (HttpContext.Current.Request.Browser.Win32)
                {
                    detailInfo.EventSysByte = "32位系统";
                }
                else
                {
                    detailInfo.EventSysByte = "64位系统";
                }
                detailInfo.EventSysPlatform = HttpContext.Current.Request.Browser.Platform;
                detailInfo.SourceIP         = Common.MySpider.GetClientIP();
                detailInfo.IPLocation       = Common.MySpider.GetIPLocation(detailInfo.SourceIP);
                detailInfo.RequesSourcetUrl = HttpContext.Current.Request.UrlReferrer != null?HttpContext.Current.Request.UrlReferrer.ToString() : "";

                detailInfo.SourceUrl    = HttpContext.Current.Request.Url.ToString();
                detailInfo.WebsiteOwner = bll.WebsiteOwner;
                detailInfo.ModuleType   = "scratch";
                if (bll.IsLogin)
                {
                    detailInfo.EventUserID = bll.GetCurrUserID();
                }
                bll.Add(detailInfo);

                int ipCount = bll.GetCount <MonitorEventDetailsInfo>(" SourceIP ", string.Format(" WebsiteOwner='{0}' AND MonitorPlanID={1} ", bll.WebsiteOwner, model.LotteryID));
                int uvCount = bll.GetCount <MonitorEventDetailsInfo>(" EventUserID ", string.Format(" EventUserID is not null AND WebsiteOwner='{0}' AND MonitorPlanID={1} ", bll.WebsiteOwner, model.LotteryID));
                int pvCount = bll.GetCount <MonitorEventDetailsInfo>(string.Format(" WebsiteOwner='{0}' AND MonitorPlanID={1} ", bll.WebsiteOwner, model.LotteryID));

                bll.Update(new WXLotteryV1(), string.Format(" IP={0},PV={1},UV={2} ", ipCount, pvCount, uvCount), string.Format(" LotteryID={0} ", model.LotteryID));
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
                Response.End();
            }
        }