예제 #1
0
            public void StuViewCount()
            {
                BLLJIMP.BLLMQ bllMq = new BLLJIMP.BLLMQ();

                var msgBody = new BLLJIMP.Model.MQ.QuestionnaireStatisticsInfo()
                {
                    CurrfilePath        = this.CurrfilePath,
                    EventBrowser        = HttpContextCurrent.Request.Browser == null ? "" : HttpContextCurrent.Request.Browser.ToString(),
                    EventBrowserID      = HttpContextCurrent.Request.Browser.Id,
                    EventBrowserIsBata  = HttpContextCurrent.Request.Browser.Beta? "测试版": "正式版",
                    EventBrowserVersion = HttpContextCurrent.Request.Browser.Version,
                    EventSysPlatform    = HttpContextCurrent.Request.Browser.Platform,
                    EventUserID         = this.EventUserID,
                    SourceIP            = Common.MySpider.GetClientIP(HttpContextCurrent),
                    QuestionnaireID     = this.QuestionnaireID,
                    RequesSourcetUrl    = HttpContextCurrent.Request.UrlReferrer != null?HttpContextCurrent.Request.UrlReferrer.ToString() : "",
                                              SourceUrl    = HttpContextCurrent.Request.Url.ToString(),
                                              SpreadUserId = SpreadUser == null? "": SpreadUser.UserID
                };

                msgBody.IPLocation = Common.MySpider.GetIPLocation(msgBody.SourceIP, HttpContextCurrent);

                if (HttpContextCurrent.Request.Browser.Win16)
                {
                    msgBody.EventSysByte = "16位系统";
                }
                else
                if (HttpContextCurrent.Request.Browser.Win32)
                {
                    msgBody.EventSysByte = "32位系统";
                }
                else
                {
                    msgBody.EventSysByte = "64位系统";
                }


                var mq = new BLLJIMP.Model.MQ.MessageInfo()
                {
                    Msg          = JsonConvert.SerializeObject(msgBody),
                    MsgId        = Guid.NewGuid().ToString(),
                    MsgType      = CommonPlatform.Helper.EnumStringHelper.ToString(BLLJIMP.Enums.MQType.QuestionnaireStatistics),
                    WebsiteOwner = this.WebsiteOwner
                };

                bllMq.Publish(mq);

                //BLLJIMP.BLL bll = new BLLJIMP.BLL();

                //var QuestionnaireModel = bll.Get<BLLJIMP.Model.Questionnaire>(string.Format("QuestionnaireID={0}", this.QuestionnaireID));

                //MonitorEventDetailsInfo detailInfo = new MonitorEventDetailsInfo();
                //detailInfo.MonitorPlanID = this.QuestionnaireID;
                //detailInfo.EventType = 0;
                //detailInfo.EventBrowser = HttpContextCurrent.Request.Browser == null ? "" : HttpContextCurrent.Request.Browser.ToString();
                //detailInfo.EventBrowserID = HttpContextCurrent.Request.Browser.Id; ;
                //if (HttpContextCurrent.Request.Browser.Beta)
                //    detailInfo.EventBrowserIsBata = "测试版";
                //else
                //    detailInfo.EventBrowserIsBata = "正式版";

                //detailInfo.EventBrowserVersion = HttpContextCurrent.Request.Browser.Version;
                //detailInfo.EventDate = DateTime.Now;
                //if (HttpContextCurrent.Request.Browser.Win16)
                //    detailInfo.EventSysByte = "16位系统";
                //else
                //    if (HttpContextCurrent.Request.Browser.Win32)
                //    detailInfo.EventSysByte = "32位系统";
                //else
                //    detailInfo.EventSysByte = "64位系统";
                //detailInfo.EventSysPlatform = HttpContextCurrent.Request.Browser.Platform;
                //detailInfo.SourceIP = Common.MySpider.GetClientIP(HttpContextCurrent);
                //detailInfo.IPLocation = Common.MySpider.GetIPLocation(detailInfo.SourceIP, HttpContextCurrent);
                //detailInfo.SourceUrl = HttpContextCurrent.Request.Url.ToString();
                //detailInfo.RequesSourcetUrl = HttpContextCurrent.Request.UrlReferrer != null ? HttpContextCurrent.Request.UrlReferrer.ToString() : "";
                //detailInfo.WebsiteOwner = this.WebsiteOwner;
                //detailInfo.ModuleType = "question";
                //detailInfo.EventUserID = this.EventUserID;
                //detailInfo.ShareTimestamp = "1";

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

                //QuestionnaireModel.IP = ipCount;
                //QuestionnaireModel.PV = pvCount;
                //QuestionnaireModel.UV = uvCount;
                //bll.Update(QuestionnaireModel);

                //var spreadUser = this.SpreadUser;

                //if (spreadUser != null)
                //{
                //    detailInfo.SpreadUserID = spreadUser.UserID;

                //    MonitorLinkInfo linkInfo = bll.Get<MonitorLinkInfo>(string.Format(" LinkName='{0}' And MonitorPlanID={1}", spreadUser.UserID, QuestionnaireModel.QuestionnaireID));
                //    if (linkInfo != null)
                //    {
                //        linkInfo.ActivityName = QuestionnaireModel.QuestionnaireName;
                //        linkInfo.ThumbnailsPath = QuestionnaireModel.QuestionnaireImage;
                //        //已经为该用户建立推广链接
                //        detailInfo.LinkID = linkInfo.LinkID;
                //        //增加打开人数
                //        linkInfo.OpenCount++;
                //        int shareCount = bll.GetCount<MonitorEventDetailsInfo>("ShareTimestamp", string.Format(" LinkID ={0} and ShareTimestamp is not null and ShareTimestamp <> '' and ShareTimestamp <> '0' ", linkInfo.LinkID));
                //        linkInfo.ShareCount = shareCount;
                //        int iCount = bll.GetCount<MonitorEventDetailsInfo>(" SourceIP ", string.Format(" MonitorPlanID='{0}' AND SpreadUserID='{1}' ", this.QuestionnaireID, spreadUser.UserID));
                //        linkInfo.DistinctOpenCount = ipCount;
                //        int uCount = bll.GetCount<MonitorEventDetailsInfo>(" EventUserId ", string.Format(" MonitorPlanID='{0}' AND SpreadUserID='{1}' ", this.QuestionnaireID, spreadUser.UserID));

                //        int spreadCount = bll.GetCount<MonitorEventDetailsInfo>(string.Format(" MonitorPlanID='{0}' AND EventUserId='{1}' ", this.QuestionnaireID, this.EventUserID));
                //        if (spreadCount == 0)
                //        {
                //            uCount = uCount + 1;
                //        }

                //        bll.Update(linkInfo, string.Format(" OpenCount={0},DistinctOpenCount={1},UV={2},ShareCount={3}", linkInfo.OpenCount, iCount, uCount, shareCount), string.Format("LinkID={0}", linkInfo.LinkID));
                //    }
                //    else
                //    {

                //        //还没有为该用户建立推广链接
                //        MonitorLinkInfo newLinkinfo = new MonitorLinkInfo();
                //        newLinkinfo.LinkID = int.Parse(bll.GetGUID(ZentCloud.BLLJIMP.TransacType.MonitorLinkID));
                //        newLinkinfo.MonitorPlanID = QuestionnaireModel.QuestionnaireID;
                //        newLinkinfo.WXMemberID = 0;
                //        newLinkinfo.LinkName = spreadUser.UserID;
                //        newLinkinfo.RealLink = this.CurrfilePath;
                //        newLinkinfo.InsertDate = DateTime.Now;
                //        newLinkinfo.OpenCount = 1;
                //        newLinkinfo.ActivityName = QuestionnaireModel.QuestionnaireName;
                //        newLinkinfo.ThumbnailsPath = QuestionnaireModel.QuestionnaireImage;
                //        newLinkinfo.WebsiteOwner = this.WebsiteOwner;
                //        newLinkinfo.DistinctOpenCount = 1;// ip
                //        newLinkinfo.ShareCount = 0;//分享数
                //        newLinkinfo.ForwardType = "questionnaire";
                //        newLinkinfo.UV = 1;
                //        newLinkinfo.ActivityId = QuestionnaireModel.QuestionnaireID;
                //        bll.Add(newLinkinfo);
                //    }

                //}
                //bll.Add(detailInfo);


                ////更新ip pv uv[Questionnaire]

                //int countIp = bll.GetCount<MonitorEventDetailsInfo>(" SourceIP ", string.Format(" MonitorPlanID = {0} ", QuestionnaireModel.QuestionnaireID));
                //int countPv = QuestionnaireModel.PV++;
                //int countUv = bll.GetCount<MonitorEventDetailsInfo>(" EventUserId ", string.Format(" MonitorPlanID = {0} ", QuestionnaireModel.QuestionnaireID));
                //bll.Update(QuestionnaireModel, string.Format(" IP={0},PV={1},UV={2} ", countIp, countPv, countUv), string.Format(" QuestionnaireID={0} ", QuestionnaireModel.QuestionnaireID));

                ////更新 转发表
                //bll.Update(new ActivityForwardInfo(), string.Format(" PV+=1,UV={0}", countUv), string.Format(" ActivityId='{0}'", QuestionnaireModel.QuestionnaireID));//更新转发表UV.pv
            }
예제 #2
0
파일: Product.ashx.cs 프로젝트: uvbs/mmp
            /// <summary>
            ///
            /// </summary>
            public void ShopDetailOpenStatistics()
            {
                MonitorEventDetailsInfo detailInfo = new MonitorEventDetailsInfo();

                detailInfo.EventBrowser   = HttpContextCurrent.Request.Browser == null ? "" : HttpContextCurrent.Request.Browser.ToString();
                detailInfo.EventBrowserID = HttpContextCurrent.Request.Browser.Id;
                if (HttpContextCurrent.Request.Browser.Beta)
                {
                    detailInfo.EventBrowserIsBata = "测试版";
                }
                else
                {
                    detailInfo.EventBrowserIsBata = "正式版";
                }

                detailInfo.EventBrowserVersion = HttpContextCurrent.Request.Browser.Version;
                detailInfo.EventDate           = DateTime.Now;
                if (HttpContextCurrent.Request.Browser.Win16)
                {
                    detailInfo.EventSysByte = "16位系统";
                }
                else
                if (HttpContextCurrent.Request.Browser.Win32)
                {
                    detailInfo.EventSysByte = "32位系统";
                }
                else
                {
                    detailInfo.EventSysByte = "64位系统";
                }

                detailInfo.EventSysPlatform = HttpContextCurrent.Request.Browser.Platform;
                detailInfo.SourceIP         = ZentCloud.Common.MySpider.GetClientIP(HttpContextCurrent);
                detailInfo.IPLocation       = ZentCloud.Common.MySpider.GetIPLocation(detailInfo.SourceIP, HttpContextCurrent);
                detailInfo.SourceUrl        = HttpContextCurrent.Request.Url.ToString();
                detailInfo.RequesSourcetUrl = HttpContextCurrent.Request.UrlReferrer != null?HttpContextCurrent.Request.UrlReferrer.ToString() : "";

                //统计转移到消息队列处理
                BLLJIMP.BLLMQ bllMq = new BLLJIMP.BLLMQ();

                var msgBody = new BLLJIMP.Model.MQ.ShopDetailOpenStatistics()
                {
                    ProductId           = ProductId,
                    EventBrowser        = detailInfo.EventBrowser,
                    EventBrowserID      = detailInfo.EventBrowserID,
                    EventBrowserIsBata  = detailInfo.EventBrowserIsBata,
                    EventBrowserVersion = detailInfo.EventBrowserVersion,
                    EventSysPlatform    = detailInfo.EventSysPlatform,
                    EventUserID         = EventUserID,
                    SourceIP            = detailInfo.SourceIP,
                    RequesSourcetUrl    = detailInfo.RequesSourcetUrl,
                    SourceUrl           = detailInfo.SourceUrl,
                    SpreadUserId        = detailInfo.SpreadUserID,
                    IPLocation          = detailInfo.IPLocation,
                    EventSysByte        = detailInfo.EventSysByte,
                    EventType           = 0,
                    ModuleType          = "product",
                    WebsiteOwner        = WebsiteOwner,
                    EventDate           = detailInfo.EventDate.Value
                };

                var mq = new BLLJIMP.Model.MQ.MessageInfo()
                {
                    Msg          = JsonConvert.SerializeObject(msgBody),
                    MsgId        = Guid.NewGuid().ToString(),
                    MsgType      = CommonPlatform.Helper.EnumStringHelper.ToString(BLLJIMP.Enums.MQType.ShopDetailOpenStatistics),
                    WebsiteOwner = detailInfo.WebsiteOwner
                };

                bllMq.Publish(mq);
            }