public MonitorEventDetailsInfo GetMonitorEventDetailsInfo() { MonitorEventDetailsInfo data = new MonitorEventDetailsInfo(); data.EventUserID = EventUserID; data.SpreadUserID = SpreadUserId; data.EventBrowser = EventBrowser; data.EventBrowserID = EventBrowserID; data.EventBrowserIsBata = EventBrowserIsBata; data.EventBrowserVersion = EventBrowserVersion; data.EventSysByte = EventSysByte; data.EventSysPlatform = EventSysPlatform; data.SourceIP = SourceIP; data.IPLocation = IPLocation; data.SourceUrl = SourceUrl; data.RequesSourcetUrl = RequesSourcetUrl; data.EventType = EventType; data.ModuleType = ModuleType; data.WebsiteOwner = WebsiteOwner; data.EventDate = EventDate; return(data); }
public void ProcessRequest(HttpContext context) { //try //{ BLLJIMP.BLLJuActivity bllJuactivity = new BLLJIMP.BLLJuActivity(""); BLLJIMP.BLLUser bllUser = new BLLJIMP.BLLUser(""); BLLJIMP.BLLMonitor bllMonitor = new BLLJIMP.BLLMonitor(); BLLJIMP.BLLWebSite bllwebSite = new BLLJIMP.BLLWebSite(); BLLJIMP.BLLShareMonitor bllShareMonitor = new BLLJIMP.BLLShareMonitor(); ///推广用户信息 UserInfo spreadUser = null; //分享用户 UserInfo shareUser = null; CompanyWebsite_Config companyConfig = bllwebSite.GetCompanyWebsiteConfig(); currentUrl = context.Request.Url.ToString(); //当前绝对地址 string filePath = context.Request.FilePath; //当前相对路径 #region 微信推广(展示文章页面) if (filePath.Contains(".chtml")) { ToLog(context, " monitorhandler filePath:" + filePath); string[] parameters = filePath.Split('/'); if (parameters.Length > 2) { int activityId = Convert.ToInt32(parameters[1], 16);//ZCJ_JuActivityInfo 文章ID; ToLog(context, " monitorhandler 文章ID:" + activityId); long memberID = 0; if (parameters.Length > 3) { //memberID = parameters[2] == "XXX" ? 0 : Convert.ToInt32(parameters[2], 16);//ZCJ_WXMemberInfo 会员注册ID; spreadUser = bllUser.GetUserInfoByAutoID(Convert.ToInt32(parameters[2], 16)); } string currOpenerOpenID = parameters.Length > 5 ? parameters[3] : string.Empty;//当前打开者的OpenID string spreadUserID = context.Request["spreadU"] == null ? "" : context.Request["spreadU"].ToString(); string shareTimestamp = context.Request["shareTimestamp"]; if (!string.IsNullOrWhiteSpace(spreadUserID)) { spreadUserID = Common.Base64Change.DecodeBase64ByUTF8(spreadUserID); } string spreadUserAutoIDStr = context.Request["ua"] == null ? "" : context.Request["ua"].ToString();//推广ID,原始id*1000,16进制后进行base64,然后“=”变成“_” int spreadUserAutoID = 0; if (!string.IsNullOrWhiteSpace(spreadUserAutoIDStr)) { spreadUserAutoID = bllJuactivity.TransmitIntDeCode(spreadUserAutoIDStr);//Convert.ToInt32(Common.Base64Change.DecodeBase64ByUTF8(spreadUserAutoIDStr.Replace("_", "=")), 16) / 1000; } string shareId = context.Request["comeonshareid"] == null ? "" : context.Request["comeonshareid"].ToString(); if (!string.IsNullOrWhiteSpace(shareId)) { ToLog(context, " monitorhandler 执行shareId查找分享任务: " + shareId); try { var shareInfo = bllShareMonitor.GetShareInfo(shareId); if (!string.IsNullOrWhiteSpace(shareInfo.UserId)) { shareUser = bllUser.GetUserInfo(shareInfo.UserId); } } catch (Exception ex) { ToLog(context, " monitorhandler 获取shareUser异常: " + ex.Message); } } JuActivityInfo activityInfo = bllJuactivity.Get <JuActivityInfo>(string.Format("JuActivityID={0} AND IsDelete=0 ", activityId));//文章信息 if (activityInfo == null) { context.Response.WriteFile("/Error/NotExist.html"); return; } ToLog(context, " monitorhandler 找到文章,开始构造内容: " + activityInfo.JuActivityID); //if (activityInfo.ArticleType == "activity") //{ // if (activityInfo.ActivityStatus == 1) // { // context.Response.Redirect("/Error/CommonMsg.aspx?msg=报名已结束,有疑问请联系我们&&icon=icon iconfont icon-kulian kulian"); // return; // } //} #region 检查是否付费活动 if (activityInfo.IsFee == 1 && !bllJuactivity.IsLogin) { context.Response.Redirect("/App/Cation/Wap/FreeActivityPage.aspx?aid=" + activityInfo.JuActivityID); return; } #endregion #region 检查访问级别 if (activityInfo.AccessLevel > 0) { if (!bllUser.IsLogin) { appLoginUrl = Common.ConfigHelper.GetConfigString("appLoginUrl").ToLower(); context.Response.Redirect(appLoginUrl + string.Format("?redirect=" + HttpUtility.UrlEncode(currentUrl)), true); return; } //else if (!bllUser.IsMember() && activityInfo.AccessLevel == 1) //{ //} else if (bllUser.GetCurrentUserInfo().AccessLevel < activityInfo.AccessLevel) { //if (companyConfig.NoPermissionsPage == 0) //{ // context.Response.WriteFile("/Error/NoPmsMobile.htm"); // return; //} //else if (companyConfig.NoPermissionsPage == 1) //{ // context.Response.Redirect("/App/Cation/Wap/UserEdit.aspx",true); // context.Response.End(); // return; //} context.Response.WriteFile("/Error/NoPmsMobile.htm"); return; } } #endregion #region 检查访问级别 //WXMemberInfo regInfo = juactivityBll.Get<WXMemberInfo>(string.Format("MemberID={0}", memberID));//会员注册信息 // UserInfo userInfo = juactivityBll.Get<UserInfo>(string.Format("UserID='{0}'", activityInfo.UserID));//文章发布者信息 SystemSet systemset = bllJuactivity.Get <SystemSet>(""); //系统配置信息 string pageSource = ""; //待输出的html源代码 if (systemset != null) { if (string.IsNullOrWhiteSpace(currOpenerOpenID)) { //取得Session里的当前OpenID currOpenerOpenID = context.Session[systemset.WXCurrOpenerOpenIDKey] != null ? context.Session[systemset.WXCurrOpenerOpenIDKey].ToString() : ""; } if (string.IsNullOrWhiteSpace(currOpenerOpenID)) { //如果再为空,由链接上面get参数获取 currOpenerOpenID = context.Request[systemset.WXCurrOpenerOpenIDKey] != null ? context.Request[systemset.WXCurrOpenerOpenIDKey].ToString() : ""; } } #endregion //if (regInfo == null) //{ // regInfo = new WXMemberInfo() { Name = "none", WeixinOpenID = "" }; //} if ((activityInfo != null))// { //var planInfo = bllJuactivity.Get<MonitorPlan>(string.Format("MonitorPlanID={0}", activityInfo.MonitorPlanID)); //if (planInfo == null) //{ // return; //} //else //{ // if (planInfo.PlanStatus == "0")//任务已停止 // { // return; // } //} ToLog(context, " monitorhandler 开始执行GetJuactivityHtml: " + activityInfo.JuActivityID); pageSource = bllJuactivity.GetJuactivityHtml(activityInfo, currOpenerOpenID, context.Request.Url.ToString(), spreadUser, shareUser); ToLog(context, " monitorhandler 执行GetJuactivityHtml完毕: " + activityInfo.JuActivityID); #region 事件记录 //事件 //int OpenCount = 0;//打开人数 //int DistinctOpenCount = 0;//独立IP数量 MonitorEventDetailsInfo detailInfo = new MonitorEventDetailsInfo(); detailInfo.MonitorPlanID = activityInfo.MonitorPlanID; 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.SourceUrl = HttpContext.Current.Request.Url.ToString(); detailInfo.RequesSourcetUrl = HttpContext.Current.Request.UrlReferrer != null?HttpContext.Current.Request.UrlReferrer.ToString() : ""; if (spreadUser != null) { detailInfo.SpreadUserID = spreadUser.UserID; } detailInfo.SpreadUserAutoID = spreadUserAutoID; detailInfo.ShareTimestamp = shareTimestamp; detailInfo.WebsiteOwner = bllJuactivity.WebsiteOwner; detailInfo.ModuleType = activityInfo.ArticleType; if (bllUser.IsLogin) { detailInfo.EventUserID = bllUser.GetCurrUserID(); } if (spreadUser != null)//带推广信息 { //try //{ // if (!string.IsNullOrWhiteSpace(currOpenerOpenID)) // { // //记录触发人 // UserInfo eventUser = new BLLJIMP.BLLUser("").GetUserInfoByOpenId(currOpenerOpenID); // detailInfo.EventUserID = eventUser.UserID; // } //} //catch { } string url = string.Format("http://{0}{1}", context.Request.Url.Host, filePath); MonitorLinkInfo linkInfo; try { linkInfo = bllJuactivity.Get <MonitorLinkInfo>(string.Format(" LinkName='{0}' And MonitorPlanID={1}", spreadUser.UserID, activityInfo.MonitorPlanID)); } catch (Exception ex) { context.Response.Write("ex" + ex.ToString()); return; } if (linkInfo != null) { linkInfo.ActivityName = activityInfo.ActivityName; linkInfo.ThumbnailsPath = activityInfo.ThumbnailsPath; //已经为该用户建立推广链接 detailInfo.LinkID = linkInfo.LinkID; //if (linkInfo.OpenCount != null)//增加打开人数 //{ linkInfo.OpenCount++; //} //else //{ // linkInfo.OpenCount = 1; //} int shareCount = bllJuactivity.GetCount <MonitorEventDetailsInfo>("ShareTimestamp", string.Format(" LinkID ={0} and ShareTimestamp is not null and ShareTimestamp <> '' and ShareTimestamp <> '0' ", linkInfo.LinkID)); linkInfo.ShareCount = shareCount; int ipCount = bllJuactivity.GetCount <MonitorEventDetailsInfo>(" SourceIP ", string.Format(" LinkID = {0} ", linkInfo.LinkID)); linkInfo.DistinctOpenCount = ipCount; bllJuactivity.Update(linkInfo, string.Format(" OpenCount={0},DistinctOpenCount={1},ShareCount={2}", linkInfo.OpenCount, ipCount, shareCount), string.Format("LinkID={0}", linkInfo.LinkID)); } else { //还没有为该用户建立推广链接 MonitorLinkInfo newLinkinfo = new MonitorLinkInfo(); newLinkinfo.LinkID = int.Parse(bllJuactivity.GetGUID(ZentCloud.BLLJIMP.TransacType.MonitorLinkID)); newLinkinfo.MonitorPlanID = activityInfo.MonitorPlanID; newLinkinfo.WXMemberID = memberID; newLinkinfo.LinkName = spreadUser.UserID; newLinkinfo.RealLink = url; newLinkinfo.InsertDate = DateTime.Now; newLinkinfo.OpenCount = 1; newLinkinfo.ActivityName = activityInfo.ActivityName; newLinkinfo.ThumbnailsPath = activityInfo.ThumbnailsPath; newLinkinfo.WebsiteOwner = bllJuactivity.WebsiteOwner; newLinkinfo.DistinctOpenCount = 1; // ip newLinkinfo.ShareCount = 0; //分享数 if (activityInfo.ArticleType == "article") { newLinkinfo.ForwardType = "fans"; newLinkinfo.ActivityId = activityInfo.JuActivityID; } if (!string.IsNullOrEmpty(activityInfo.SignUpActivityID) && activityInfo.ArticleType == "activity") { newLinkinfo.ActivityId = int.Parse(activityInfo.SignUpActivityID); } StringBuilder sqlWhere = new StringBuilder(); sqlWhere.AppendFormat(@" if not exists(select 1 from ZCJ_MonitorLinkInfo where LinkName='{14}' and MonitorPlanID={15} ) begin insert into ZCJ_MonitorLinkInfo (LinkID,MonitorPlanID,WXMemberID,LinkName,RealLink,InsertDate,OpenCount,ActivityName,ThumbnailsPath,WebsiteOwner,DistinctOpenCount,ShareCount,ForwardType,ActivityId) values({0},{1},{2},'{3}','{4}','{5}',{6},'{7}','{8}','{9}',{10},{11},'{12}',{13}) end ", newLinkinfo.LinkID, newLinkinfo.MonitorPlanID, newLinkinfo.WXMemberID, newLinkinfo.LinkName, newLinkinfo.RealLink, newLinkinfo.InsertDate, newLinkinfo.OpenCount, newLinkinfo.ActivityName, newLinkinfo.ThumbnailsPath, newLinkinfo.WebsiteOwner, newLinkinfo.DistinctOpenCount, newLinkinfo.ShareCount, newLinkinfo.ForwardType, newLinkinfo.ActivityId, spreadUser.UserID, activityInfo.MonitorPlanID); if (ZentCloud.ZCDALEngine.DALEngine.ExecuteSql(sqlWhere.ToString()) > 0) { detailInfo.LinkID = newLinkinfo.LinkID; } } } //添加事件详细 //if (!filePath.Contains("?")) //{ bllJuactivity.Add(detailInfo); //DistinctOpenCount = juactivityBll.GetCount<ZentCloud.BLLJIMP.Model.MonitorEventDetailsInfo>("SourceIP", string.Format("LinkID={0} and EventType=0", detailInfo.LinkID)); //juactivityBll.Update(new MonitorLinkInfo(), string.Format(" OpenCount={0},DistinctOpenCount={1}", OpenCount, DistinctOpenCount), string.Format("LinkID={0}", detailInfo.LinkID)); #region 微转发活动加积分 if (bllUser.IsLogin && spreadUser != null) { if (activityInfo.ArticleType == "activity") { if (bllJuactivity.GetCount <MonitorEventDetailsInfo>(string.Format(" MonitorPlanID='{0}' And EventUserID='{1}' And SpreadUserID='{2}' And EventUserID!='{2}'", detailInfo.MonitorPlanID, bllUser.GetCurrUserID(), spreadUser.UserID)) == 1) { string remark = string.Format("转发活动《{0}》", activityInfo.ActivityName); //微转发加积分 bllUser.AddUserScoreDetail(spreadUser.UserID, CommonPlatform.Helper.EnumStringHelper.ToString(ZentCloud.BLLJIMP.Enums.ScoreDefineType.ForwardArticle), spreadUser.WebsiteOwner, null, remark); } } } #endregion //} context.Response.ClearContent(); //处理完成 context.Response.Write(pageSource); //更新微信阅读人数 //bllJuactivity.UpdateUVCount(activityInfo.JuActivityID); bllJuactivity.UpDateIPPVShareCount(activityInfo); bllJuactivity.UpdateActivityForwardPVUV(activityInfo); if (spreadUser != null) { bllMonitor.UpdateUV(activityInfo.MonitorPlanID, spreadUser.UserID); //bllMonitor.UpdateSignUpCount(activityInfo.MonitorPlanID, spreadUser.UserID); } if (!string.IsNullOrWhiteSpace(activityInfo.RedirectUrl)) { context.Response.Redirect(activityInfo.RedirectUrl); } return; #endregion ToLog(context, " monitorhandler 事件记录完毕: " + activityInfo.JuActivityID); } else { context.Response.Write("<html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1\" /></head><body>链接无效。</body></html>"); return; } } } #endregion #region 注释 //#region 微信会员注册 //else if (filePath.StartsWith("/weixin")) //{ // //微信会员注册 // if (filePath.Contains("wx_reg.chtml") && (!filePath.Contains("/weixin/wx_reg.chtml"))) // { // string[] parameters = filePath.Split('/'); // string weixinMemberId = Convert.ToInt32(parameters[2], 16).ToString();// ZCJ_WeixinMemberInfo WeixinMemberID // var weixinmemberinfo = juactivityBll.Get<WeixinMemberInfo>(string.Format("WeixinMemberID={0}", weixinMemberId)); // string RegCode = Common.IOHelper.GetFileStr(context.Server.MapPath("/weixin/wx_reg.htm"), Encoding.UTF8);//注册代码 // if (RegCode.Contains("$CCWXOPENID$")) // { // RegCode = RegCode.Replace("$CCWXOPENID$", weixinmemberinfo.WeixinOpenID); // } // if (RegCode.Contains("$CCWXAID$"))//注册到哪个账户下 // { // RegCode = RegCode.Replace("$CCWXAID$", Convert.ToString(juactivityBll.Get<UserInfo>(string.Format("UserID='{0}'", weixinmemberinfo.UserID)).AutoID, 16)); // } // context.Response.Write(RegCode);//输出注册代码 // //微信会员注册 // } //} //#endregion #endregion //} //catch (Exception ex) //{ // using (StreamWriter sw = new StreamWriter(@"C:\MonitorHandlerException.txt", true, Encoding.UTF8)) // { // sw.WriteLine(string.Format("{0} MonitorHandler拦截处理异常:{1}", DateTime.Now.ToString(), ex.ToString())); // } // context.Response.Write("exception"); //} }
/// <summary> /// 问卷统计及计数 /// </summary> /// <param name="messageInfo"></param> /// <param name="ramark"></param> /// <param name="errMsg"></param> public void QuestionnaireStatistics(MessageInfo messageInfo, out string ramark, out string errMsg) { Console.WriteLine("正在处理问卷统计及计数"); ramark = ""; errMsg = ""; var msgBody = JsonConvert.DeserializeObject <Model.MQ.QuestionnaireStatisticsInfo>(messageInfo.Msg); BLL bll = new BLL(); BLLUser bllUser = new BLLUser(); var QuestionnaireModel = bll.Get <BLLJIMP.Model.Questionnaire>(string.Format("QuestionnaireID={0}", msgBody.QuestionnaireID)); MonitorEventDetailsInfo detailInfo = new MonitorEventDetailsInfo(); detailInfo.MonitorPlanID = msgBody.QuestionnaireID; detailInfo.EventType = 0; detailInfo.EventBrowser = msgBody.EventBrowser; detailInfo.EventBrowserID = msgBody.EventBrowserID; detailInfo.EventBrowserIsBata = msgBody.EventBrowserIsBata; detailInfo.EventBrowserVersion = msgBody.EventBrowserVersion; detailInfo.EventDate = DateTime.Now; detailInfo.EventSysByte = msgBody.EventSysByte; detailInfo.EventSysPlatform = msgBody.EventSysPlatform; detailInfo.SourceIP = msgBody.SourceIP; detailInfo.IPLocation = msgBody.IPLocation; detailInfo.SourceUrl = msgBody.SourceUrl; detailInfo.RequesSourcetUrl = msgBody.RequesSourcetUrl; detailInfo.WebsiteOwner = messageInfo.WebsiteOwner; detailInfo.ModuleType = "question"; detailInfo.EventUserID = msgBody.EventUserID; detailInfo.ShareTimestamp = "1"; int ipCount = bll.GetCount <MonitorEventDetailsInfo>(" SourceIP ", string.Format(" WebsiteOwner='{0}' AND MonitorPlanID={1} AND ShareTimestamp='1' ", messageInfo.WebsiteOwner, msgBody.QuestionnaireID)); int uvCount = bll.GetCount <MonitorEventDetailsInfo>(" EventUserID ", string.Format(" EventUserID is not null AND WebsiteOwner='{0}' AND MonitorPlanID={1} AND ShareTimestamp='1' ", messageInfo.WebsiteOwner, msgBody.QuestionnaireID)); int pvCount = bll.GetCount <MonitorEventDetailsInfo>(string.Format(" WebsiteOwner='{0}' AND MonitorPlanID={1} ", messageInfo.WebsiteOwner, msgBody.QuestionnaireID)); QuestionnaireModel.IP = ipCount; QuestionnaireModel.PV = pvCount; QuestionnaireModel.UV = uvCount; bll.Update(QuestionnaireModel); var spreadUser = bllUser.GetUserInfo(msgBody.SpreadUserId, messageInfo.WebsiteOwner); 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}' ", msgBody.QuestionnaireID, spreadUser.UserID)); linkInfo.DistinctOpenCount = ipCount; int uCount = bll.GetCount <MonitorEventDetailsInfo>(" EventUserId ", string.Format(" MonitorPlanID='{0}' AND SpreadUserID='{1}' ", msgBody.QuestionnaireID, spreadUser.UserID)); int spreadCount = bll.GetCount <MonitorEventDetailsInfo>(string.Format(" MonitorPlanID='{0}' AND EventUserId='{1}' ", msgBody.QuestionnaireID, msgBody.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 = msgBody.CurrfilePath; newLinkinfo.InsertDate = DateTime.Now; newLinkinfo.OpenCount = 1; newLinkinfo.ActivityName = QuestionnaireModel.QuestionnaireName; newLinkinfo.ThumbnailsPath = QuestionnaireModel.QuestionnaireImage; newLinkinfo.WebsiteOwner = messageInfo.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 Console.WriteLine("问卷统计及计数处理完毕"); }
protected void Page_Load(object sender, EventArgs e) { Id = Convert.ToInt32(Request["AutoId"]); shareLink = string.Format("http://{0}{1}?AutoId={2}", Request.Url.Host, Request.FilePath, Id); wxsInfo = bll.Get <BLLJIMP.Model.WXShowInfo>(" AutoId=" + Id); if (wxsInfo != null) { string sourceimg = wxsInfo.ShowImg; wxsInfo.ShowImg = "http://" + Request.Url.Host + wxsInfo.ShowImg; List <BLLJIMP.Model.WXShowImgInfo> wxsInfos = bll.GetList <BLLJIMP.Model.WXShowImgInfo>(" ShowId=" + wxsInfo.AutoId); if (wxsInfos != null) { for (int i = 0; i < wxsInfos.Count; i++) { strInit.AppendFormat("<div class=\"listli\"><img src=\"{0}\" class=\"img\" data-original=\"background-image:url({0}); \"></span>", wxsInfos[i].ImgStr); strInit.AppendFormat("<span class=\"text\" style=\"color:{3};\"><h2 style=\"color:{2};\">{0}</h2>{1}</span>", wxsInfos[i].ShowTitle, wxsInfos[i].ShowContext, wxsInfos[i].ShowTitleColor, wxsInfos[i].ShowContextColor); strInit.AppendFormat("<span class=\"nextbtn\"><span class=\"smallicon\"></span></span></div>"); if (string.IsNullOrEmpty(wxsInfos[i].ShowTitle) && string.IsNullOrEmpty(wxsInfos[i].ShowContext)) { stranimation.Append("case " + i + ":_this.animation(current.find(\".img\"), " + wxsInfos[i].ShowAnimation.ToString() + ", function () {"); stranimation.Append(" _this.animation(current.find(\".nextbtn\"), 99);"); stranimation.Append("});break;"); stranimation.Append("\n"); } else { //stranimation.AppendFormat("case " + i + ":_this.animation(current.find(\".img\"), " + wxsInfos[i].ShowAnimation + ", function () {"); string str = "case " + i + ":"; stranimation.Append(str + "_this.animation(current.find(\".img\")," + wxsInfos[i].ShowAnimation + ", function () {"); stranimation.Append("_this.animation(current.find(\".text\"), 2,"); string s = "function () { "; stranimation.Append(s + "_this.animation(current.find(\".nextbtn\"), 99)});"); stranimation.Append("})"); stranimation.Append(";break;"); stranimation.Append("\n"); } } } if (!string.IsNullOrEmpty(wxsInfo.ShowUrl)) { stranimation.Append("case " + wxsInfos.Count + ":_this.animation(current.find(\".blackpage\"), 15, function (){ "); stranimation.Append("_this.maininitstate++;if(_this.maininitstate"); stranimation.Append(" == 2) { _this.container.css({ \"-webkit-transition\""); stranimation.Append(": \"opacity 1s ease-out\", \"opacity\": \"0\" });"); stranimation.AppendFormat("window.location.href = '{0}';", wxsInfo.ShowUrl); stranimation.Append(" var picanimate1end = function () { _this.container[0].removeEventListener(\"webkitTransitionEnd\", picanimate1end, false);"); stranimation.Append("_this.container.remove();}; _this.container[0].addEventListener(\"webkitTransitionEnd\", picanimate1end, false);"); stranimation.Append(" }}); break;"); stranimation.Append("\n"); } stranimation.Append("default "); stranimation.Append(": _this.animation(current.find(\".img\")"); stranimation.Append(", 1, function () {"); stranimation.Append("_this.animation(current.find(\".text\"), 2,"); stranimation.Append("function () { _this.animation(current.find(\".nextbtn\"), 99)});"); stranimation.Append("});"); MonitorEventDetailsInfo detailInfo = new MonitorEventDetailsInfo(); detailInfo.MonitorPlanID = Id; 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.SourceUrl = HttpContext.Current.Request.Url.ToString(); detailInfo.RequesSourcetUrl = HttpContext.Current.Request.UrlReferrer != null?HttpContext.Current.Request.UrlReferrer.ToString() : ""; detailInfo.WebsiteOwner = bll.WebsiteOwner; detailInfo.ModuleType = "wshow"; 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, Id)); int uvCount = bll.GetCount <MonitorEventDetailsInfo>(" EventUserID ", string.Format(" EventUserID is not null AND WebsiteOwner='{0}' AND MonitorPlanID={1} ", bll.WebsiteOwner, Id)); int pvCount = bll.GetCount <MonitorEventDetailsInfo>(string.Format(" WebsiteOwner='{0}' AND MonitorPlanID={1} ", bll.WebsiteOwner, Id)); wxsInfo.PV = pvCount; wxsInfo.IP = ipCount; wxsInfo.UV = uvCount; wxsInfo.ShowImg = sourceimg; bll.Update(wxsInfo); if (!string.IsNullOrEmpty(Request["sid"])) //有推广人 { if (!string.IsNullOrEmpty(wxsInfo.ShowUrl)) { if (wxsInfo.ShowUrl.EndsWith(".chtml")) { //替换链接 var par = wxsInfo.ShowUrl.Split('/'); wxsInfo.ShowUrl = wxsInfo.ShowUrl.Replace(par[3], string.Format("{0}/{1}", par[3], Request["sid"])); shareLink = string.Format("{0}&sid={1}", shareLink, Request["sid"]); } } } else { if (bll.IsLogin) { if (!string.IsNullOrEmpty(wxsInfo.ShowUrl)) { if (wxsInfo.ShowUrl.EndsWith(".chtml")) { UserInfo CurrentUserInfo = bll.GetCurrentUserInfo(); string CurrentUserIDHex = Convert.ToString(CurrentUserInfo.AutoID, 16); //替换链接 var par = wxsInfo.ShowUrl.Split('/'); wxsInfo.ShowUrl = wxsInfo.ShowUrl.Replace(par[3], string.Format("{0}/{1}", par[3], CurrentUserIDHex)); shareLink = string.Format("{0}&sid={1}", shareLink, CurrentUserIDHex); } } } } } }
ZentCloud.BLLJIMP.Model.UserInfo userInfo; //当前登陆的用户 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { AutoId = Request["AutoId"]; if (!string.IsNullOrEmpty(AutoId)) { GetTheVoteInfo(AutoId); MonitorEventDetailsInfo detailInfo = new MonitorEventDetailsInfo(); detailInfo.MonitorPlanID = int.Parse(AutoId); 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.SourceUrl = HttpContext.Current.Request.Url.ToString(); detailInfo.WebsiteOwner = bll.WebsiteOwner; detailInfo.ModuleType = "thevote"; if (bll.IsLogin) { detailInfo.EventUserID = bll.GetCurrUserID(); } detailInfo.ShareTimestamp = "3"; bll.Add(detailInfo); int ipCount = bll.GetCount <MonitorEventDetailsInfo>(" SourceIP ", string.Format(" WebsiteOwner='{0}' AND MonitorPlanID={1} AND ShareTimestamp='3' ", bll.WebsiteOwner, int.Parse(AutoId))); int uvCount = bll.GetCount <MonitorEventDetailsInfo>(" EventUserID ", string.Format(" EventUserID is not null AND WebsiteOwner='{0}' AND MonitorPlanID={1} AND ShareTimestamp='3' ", bll.WebsiteOwner, int.Parse(AutoId))); int pvCount = bll.GetCount <MonitorEventDetailsInfo>(string.Format(" WebsiteOwner='{0}' AND MonitorPlanID={1} AND ShareTimestamp='3' ", bll.WebsiteOwner, int.Parse(AutoId))); bll.Update(new TheVoteInfo(), string.Format(" IP={0},PV={1},UV={2} ", ipCount, pvCount, uvCount), string.Format(" AutoId={0} ", AutoId)); } else { StringBuilder str = new StringBuilder(); str.AppendFormat("<li>"); str.AppendFormat("<div>{0}</div>", "没有数据"); str.AppendFormat("</li>"); needList.InnerHtml = str.ToString(); } } }
/// <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); }
/// <summary> /// 获取抽奖信息 /// </summary> /// <param name="context"></param> /// <returns></returns> private string GetLottery(HttpContext context) { int id = Convert.ToInt32(context.Request["id"]); if (id == 0) { resp.IsSuccess = false; resp.Msg = "请传入正确的抽奖活动ID"; resp.Status = (int)BLLJIMP.Enums.APIErrCode.NoFollow; return(JsonConvert.SerializeObject(resp)); } if (!bll.IsLogin) { resp.IsSuccess = false; resp.Msg = "请先登录"; resp.Status = (int)BLLJIMP.Enums.APIErrCode.UserIsNotLogin; return(JsonConvert.SerializeObject(resp)); } var model = bll.GetLottery(id); if (model == null) { resp.IsSuccess = false; resp.Msg = "未找到抽奖活动"; resp.Status = (int)BLLJIMP.Enums.APIErrCode.NoFollow; return(JsonConvert.SerializeObject(resp)); } /* * * 返回抽奖活动基本信息 * 返回当前用户抽奖记录 * 返回当前用户中奖情况 * */ List <WXLotteryLogV1> log = new List <WXLotteryLogV1>(); List <WXLotteryRecordV1> winRecord = new List <WXLotteryRecordV1>(); List <WXAwardsV1> awards = new List <WXAwardsV1>(); //隐藏获奖记录,和奖项信息 if (context.Request["hideAward"] != "1") { log = bll.GetUserLotteryLog(id, currentUserInfo.UserID); winRecord = bll.GetWXLotteryRecordList(id, currentUserInfo.UserID); awards = bll.GetAwardsListV1(id); } else { log = bll.GetUserLotteryLog(1, id, currentUserInfo.UserID); } //判断当前用户今天还能摇奖多少次 var luckRest = 0; switch (model.LuckLimitType) { case 0: //总共多少次 luckRest = model.MaxCount - log.Count; break; case 1: //每天多少次 var today = DateTime.Now; var todayCount = log.Count(p => p.InsertDate.Year == today.Year && p.InsertDate.Month == today.Month && p.InsertDate.Day == today.Day); luckRest = model.MaxCount - todayCount; break; default: break; } luckRest += currentUserInfo.LotteryCount; if (luckRest < 0) { luckRest = 0; } string currAwardName = string.Empty; //当前中奖的名称 int currIsCashed = 0; //当前是否已领奖 int currIsSubmitInfo = 0; //当前是否已提交领奖信息 WXLotteryRecordV1 lotteryRecord = new WXLotteryRecordV1(); List <dynamic> recordList = new List <dynamic>(); if (winRecord != null) { var wr = winRecord.Where(p => p.UserId == currentUserInfo.UserID).ToList(); if (wr != null && wr.Count > 0) { lotteryRecord = wr[0];//bll.GetWXLotteryRecordV1(currentUserInfo.UserID, model.LotteryID); currAwardName = lotteryRecord.WXAwardName; currIsCashed = bll.IsUserGetPrizeV1(currentUserInfo.UserID, model.LotteryID) ? 1 : 0; if ((!string.IsNullOrEmpty(lotteryRecord.Name)) && (!string.IsNullOrEmpty(lotteryRecord.Phone))) { currIsSubmitInfo = 1; } } } //var lotteryRecord = winRecord.Where(p => p.UserId == currentUserInfo.UserID).ToList(); //List<dynamic> awardList = new List<dynamic>(); //if (lotteryRecord.Count > 0) //{ // foreach (var item in lotteryRecord) // { // awardList.Add(new // { // cueeAwardName = item.WXAwardName,//当前中奖的名称 // currIsCashed = bll.IsUserGetPrizeV1(currentUserInfo.UserID, item.LotteryId) ? 1 : 0, // currIsSubmitInfo = !string.IsNullOrEmpty(item.Name) && !string.IsNullOrEmpty(item.Phone) ? 1 : 0 // }); // } //} MonitorEventDetailsInfo detailInfo = new MonitorEventDetailsInfo(); detailInfo.MonitorPlanID = id; 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 = ZentCloud.Common.MySpider.GetClientIP(); detailInfo.IPLocation = ZentCloud.Common.MySpider.GetIPLocation(detailInfo.SourceIP); detailInfo.SourceUrl = HttpContext.Current.Request.Url.ToString(); detailInfo.RequesSourcetUrl = HttpContext.Current.Request.UrlReferrer != null?HttpContext.Current.Request.UrlReferrer.ToString() : ""; detailInfo.WebsiteOwner = bll.WebsiteOwner; detailInfo.ModuleType = "shake"; 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, id)); int uvCount = bll.GetCount <MonitorEventDetailsInfo>(" EventUserID ", string.Format(" EventUserID is not null AND WebsiteOwner='{0}' AND MonitorPlanID={1} ", bll.WebsiteOwner, id)); int pvCount = bll.GetCount <MonitorEventDetailsInfo>(string.Format(" WebsiteOwner='{0}' AND MonitorPlanID={1} ", bll.WebsiteOwner, id)); bll.Update(new WXLotteryV1(), string.Format(" IP={0},PV={1},UV={2} ", ipCount, pvCount, uvCount), string.Format(" LotteryID={0} ", id)); resp.IsSuccess = true; //判断活动是否已结束 var awardGameOver = false; if (model.EndTime != null) { if (model.EndTime.Value < DateTime.Now) { awardGameOver = true; } } if (model.Status == 0) { awardGameOver = true; } resp.Result = new { //抽奖活动基本信息 name = model.LotteryName, content = model.LotteryContent, status = model.Status, startTime = Common.DateTimeHelper.DateTimeToStr(model.StartTime), endTime = Common.DateTimeHelper.DateTimeToStr(model.EndTime), shareImg = model.ShareImg, shareDesc = model.ShareDesc, log = log == null ? null : log.Select(p => new { time = p.InsertDate.ToString() }), winRecord = winRecord == null ? null : winRecord.Select(p => new { rid = p.AutoID, id = p.WXAwardsId, token = p.Token, name = p.WXAward.PrizeName, time = p.InsertDateStr, type = p.WXAward.AwardsType, is_reveice = bll.IsUserGetPrizeByRecordIdV1(p.AutoID) ? 1 : 0, org_obj = p.WXAward, record_user_name = p.Name, record_user_phone = p.Phone }), maxCount = model.MaxCount, luckLimitType = model.LuckLimitType, winLimitType = model.WinLimitType, usePoints = model.UsePoints, awards = awards, luckRest = luckRest, toolbarbutton = model.ToolbarButton, websiteownername = bll.GetWebsiteInfoModel().WebsiteName, currIsAward = lotteryRecord != null ? 1 : 0, currAwardName = currAwardName, currIsCashed = currIsCashed, currIsSubmitInfo = currIsSubmitInfo, isGetPrizeFromMobile = model.IsGetPrizeFromMobile, currUserName = currentUserInfo.TrueName, currUserPhone = currentUserInfo.Phone, awardGameOver = awardGameOver }; return(JsonConvert.SerializeObject(resp)); }
protected void Page_Load(object sender, EventArgs e) { try { string request = Request["s"]; //接收的参数 int eventType = 0; //默认打开 //数据验证 if (!string.IsNullOrEmpty(request)) { if (request.EndsWith("teq1")) { eventType = 1;//点击khlf //request = request.TrimEnd('teq1'); request = request.Substring(0, request.IndexOf("teq1")); } MonitorLinkInfo linkInfo = bll.Get <MonitorLinkInfo>(string.Format("EncryptParameter='{0}'", request)); if (linkInfo != null) { MonitorPlan planInfo = bll.Get <MonitorPlan>(string.Format("MonitorPlanID={0}", linkInfo.MonitorPlanID)); if (planInfo.PlanStatus.Equals("1")) { MonitorEventDetailsInfo model = new MonitorEventDetailsInfo(); //model.DetailID = int.Parse(bll.GetGUID(ZentCloud.BLLJIMP.TransacType.MonitorDetailID)); model.MonitorPlanID = planInfo.MonitorPlanID; model.EventType = eventType; model.LinkID = linkInfo.LinkID; model.EventBrowser = HttpContext.Current.Request.Browser.ToString(); model.EventBrowserID = HttpContext.Current.Request.Browser.Id; model.EventBrowserIsBata = HttpContext.Current.Request.Browser.Beta.ToString(); model.EventBrowserVersion = HttpContext.Current.Request.Browser.Version; model.EventDate = DateTime.Now; if (HttpContext.Current.Request.Browser.Win32) { model.EventSysByte = "32位系统"; } else { model.EventSysByte = "64位系统"; } model.EventSysPlatform = HttpContext.Current.Request.Browser.Platform; model.SourceIP = Common.MySpider.GetClientIP(); model.IPLocation = Common.MySpider.GetIPLocation(model.SourceIP); if (Request.UrlReferrer != null) { model.SourceUrl = Request.UrlReferrer.ToString(); } bll.Add(model); if (eventType.Equals(1)) { if (linkInfo != null) { Response.Redirect(linkInfo.RealLink, false); } } } else { } } else { Response.End(); } } } catch (Exception ex) { Response.End(); } }
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(); } }
public void ProcessRequest(HttpContext context) { string lotteryId = context.Request["lottery_id"]; WXLotteryV1 model = bllLottery.GetLottery(int.Parse(lotteryId)); if (model == null) { apiResp.msg = "摇一摇不存在"; apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp)); return; } MonitorEventDetailsInfo detailInfo = new MonitorEventDetailsInfo(); detailInfo.MonitorPlanID = int.Parse(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 = ZentCloud.Common.MySpider.GetClientIP(); detailInfo.IPLocation = ZentCloud.Common.MySpider.GetIPLocation(detailInfo.SourceIP); detailInfo.SourceUrl = HttpContext.Current.Request.Url.ToString(); detailInfo.WebsiteOwner = bll.WebsiteOwner; if (bll.IsLogin) { detailInfo.EventUserID = bll.GetCurrUserID(); } bool eventDetail = bll.Add(detailInfo); int ipCount = bll.GetCount <MonitorEventDetailsInfo>(" SourceIP ", string.Format(" WebsiteOwner='{0}' AND MonitorPlanID={1} ", bll.WebsiteOwner, int.Parse(lotteryId))); int uvCount = bll.GetCount <MonitorEventDetailsInfo>(" EventUserID ", string.Format(" EventUserID is not null AND WebsiteOwner='{0}' AND MonitorPlanID={1} ", bll.WebsiteOwner, int.Parse(lotteryId))); int pvCount = bll.GetCount <MonitorEventDetailsInfo>(string.Format(" WebsiteOwner='{0}' AND MonitorPlanID={1} ", bll.WebsiteOwner, int.Parse(lotteryId))); bll.Update(new WXLotteryV1(), string.Format(" IP={0},PV={1},UV={2} ", ipCount, pvCount, uvCount), string.Format(" LotteryID={0} ", int.Parse(lotteryId))); apiResp.msg = "操作完成"; apiResp.status = true; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp)); }