Beispiel #1
0
 /// <summary>
 /// 是否所有客服都己下线
 /// </summary>
 //public string IsAllKefuOffLine = "false";
 protected void Page_Load(object sender, EventArgs e)
 {
     if (bllUser.IsLogin)
     {
         currentUserInfo = bllUser.GetCurrentUserInfo();
         //if (currentUserInfo.UserID=="jubit")
         //{
         //    currentUserInfo.AutoID = 7984;
         //}
     }
     else
     {
         Response.Redirect("/error/commonmsg.aspx?msg=请用微信打开");
     }
     WebSocketHost = ZentCloud.Common.ConfigHelper.GetConfigString("WebSocketHost");
     config        = bllWebsite.GetCompanyWebsiteConfig();
     if (string.IsNullOrEmpty(config.DistributionQRCodeIcon))
     {
         config.DistributionQRCodeIcon = "/img/icons/kefu.png";
     }
     RecordList  = bll.GetLiveChatDetailList(currentUserInfo.AutoID.ToString());
     WebsiteInfo = bll.GetWebsiteInfoModelFromDataBase(bll.WebsiteOwner);
     //IsAllKefuOffLine = bll.IsAllKefuOffLine(bll.WebsiteOwner).ToString();
     if (!string.IsNullOrEmpty(Request["product_id"]))
     {
         productInfo = bllMall.GetProduct(int.Parse(Request["product_id"]));
     }
 }
Beispiel #2
0
        public void ProcessRequest(HttpContext context)
        {
            WebsiteInfo           currentWebSiteInfo = bll.GetWebsiteInfoModelFromDataBase();
            CompanyWebsite_Config websiteConfig      = bllWebSite.GetCompanyWebsiteConfig();

            apiResp.result = new
            {
                website_name              = currentWebSiteInfo.WebsiteName,                                                                                      //站点名称
                distribution_level        = bll.GetDistributionLevel(),                                                                                          //后台配置的几级
                distribution_show_level   = bll.GetDistributionShowLevel(),                                                                                      //会员显示分销级别
                commission_show_name      = string.IsNullOrWhiteSpace(currentWebSiteInfo.CommissionShowName) ? "积分" : currentWebSiteInfo.CommissionShowName,     //佣金显示名称
                distribution_show_name    = string.IsNullOrWhiteSpace(currentWebSiteInfo.DistributionShowName) ? "会员" : currentWebSiteInfo.DistributionShowName, //分销显示名称
                is_show_distribution_rate = currentWebSiteInfo.IsShowDistributionOffLineRate,                                                                    //是否显示分销比例
                share_title          = websiteConfig.WebsiteTitle,                                                                                               //分享标题
                share_desc           = websiteConfig.WebsiteDescription,                                                                                         //分享描述
                share_img_url        = websiteConfig.WebsiteImage,                                                                                               //分享图片
                project_field_list   = bll.GetProjectFieldMapListF(),                                                                                            //项目自定义字段
                slide_type           = currentWebSiteInfo.DistributionOffLineSlideType,                                                                          //广告类型
                is_show_member_score = currentWebSiteInfo.DistributionOffLineIsShowMemberScore,                                                                  //是否显示会员积分
                system_show_name     = currentWebSiteInfo.DistributionOffLineSystemShowName                                                                      //分销系统显示名称
            };

            apiResp.status = true;
            apiResp.msg    = "ok";
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var bll = new BLLJIMP.BLL();

            BLLJIMP.BLLWebSite bllCompanyConfig = new BLLJIMP.BLLWebSite();
            string             curPath          = this.Request.FilePath;

            if (curPath == "/" || curPath.Contains("/login"))
            {
                if ((bll.WebsiteOwner == "hailan" || bll.WebsiteOwner == "hailandev") && bll.IsWeiXinBrowser)
                {
                    this.Response.Redirect("/customize/comeoncloud/Index.aspx?key=MallHome", true);
                }
                var companyConfig = bllCompanyConfig.GetCompanyWebsiteConfig();
                if (companyConfig.IsEnableCustomizeLoginPage == 1)
                {
                    Response.Redirect("/AdminLogin.html");
                }

                if (bll.WebsiteOwner.ToLower() == "stockplayer")
                {
                    this.Response.Redirect("/customize/StockPlayer/Src/Index/Index.aspx", true);
                }

                if (bll.WebsiteOwner.ToLower() == "songhe")
                {
                    this.Response.Redirect("/customize/comeoncloud/Index.aspx?key=MallHome", true);
                }
            }
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var payConfig = bllPay.GetPayConfig();

            if (payConfig != null)
            {
                if ((!string.IsNullOrEmpty(payConfig.WXAppId)) && (!string.IsNullOrEmpty(payConfig.WXMCH_ID)) && (!string.IsNullOrEmpty(payConfig.WXPartnerKey)))
                {
                    isShowWeixin = true;
                }
            }

            if (CurrentUserInfo.WebsiteOwner == "songhe")
            {
                isShowWeixin = false;
            }

            config = bllWebsite.GetCompanyWebsiteConfig();
            if (config == null)
            {
                config = new CompanyWebsite_Config();
            }
            if (Request["ischannel"] != null && Request["ischannel"].ToString() == "1")
            {
                UserInfo channelUserInfo = bllUser.Get <UserInfo>(string.Format("MgrUserId='{0}'", CurrentUserInfo.UserID));
                if (channelUserInfo == null && (!bllDis.IsChannel(CurrentUserInfo)))
                {
                    Response.Redirect("/error/commonmsg.aspx?msg=您还不是渠道身份,无法访问,请联系商家升级为渠道。");
                    return;
                }
                CurrentUserInfo = channelUserInfo;
            }
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var reqUserAutoId = Request["sid"];//分享用户的AutoId

            website = bllUser.GetWebsiteInfoModelFromDataBase();
            config  = bllWebsite.GetCompanyWebsiteConfig();

            if (string.IsNullOrWhiteSpace(reqUserAutoId))
            {
                if (bllUser.WebsiteOwner == "youxiu")
                {
                    var myOrderCount = bllDis.GetMyOrderCount();

                    if (myOrderCount == 0)
                    {
                        //跳转到提示购买页
                        Response.Redirect("/Error/MallDistbIsNotMemberError.aspx");
                        Response.End();
                        return;
                    }
                }

                if (!bllUser.IsDistributionMember(CurrentUserInfo))
                {
                    Response.Redirect("/Error/CommonMsg.aspx?msg=您还不是代言人,代言人才能获取我的二维码");
                    Response.End();
                    return;
                }

                currUser = bllDis.GetCurrentUserInfo();

                sid = currUser.AutoID;

                string currUserShowName = bllUser.GetUserDispalyName(currUser);

                shareTitle = currUserShowName + "邀请您加入 " + website.WXMallName;


                qrcondeUrl = bllDis.CreateUserDistributionImage(currUser.WXOpenId, currUser.WebsiteOwner);

                pageTitle = currUserShowName + "的专属二维码";
            }
            else
            {
                isShare   = true;
                sid       = Convert.ToInt32(reqUserAutoId);
                shareUser = bllUser.GetUserInfoByAutoID(sid);

                qrcondeUrl = bllDis.CreateUserDistributionImage(shareUser.WXOpenId, shareUser.WebsiteOwner);

                pageTitle = bllUser.GetUserDispalyName(shareUser) + "邀请您关注 " + website.WXMallName;
            }

            if (!string.IsNullOrWhiteSpace(qrcondeUrl))
            {
                qrcondeUrl = bllJuActivity.DownLoadImageToOss(qrcondeUrl, bllJuActivity.WebsiteOwner, true);//qrcondeUrl.Replace(Common.ConfigHelper.GetConfigString("WebSitePath"),"");
            }
        }
Beispiel #6
0
        /// <summary>
        /// 获取幻灯片
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string GetProjectorList(HttpContext context)
        {
            CompanyWebsite_Config companyConfig = bllWebsite.GetCompanyWebsiteConfig();
            var dataList = bllSlide.ListByType(companyConfig.ShopAdType, bll.WebsiteOwner);
            List <CompanyWebsite_Navigate> resultList = new List <CompanyWebsite_Navigate>();

            foreach (var item in dataList)
            {
                CompanyWebsite_Navigate nav = new CompanyWebsite_Navigate();
                nav.AutoID            = item.AutoID;
                nav.NavigateName      = item.LinkText;
                nav.NavigateImage     = bll.GetImgUrl(item.ImageUrl);
                nav.NavigateType      = item.Type;
                nav.NavigateTypeValue = item.Link;
                nav.PlayIndex         = item.Sort;
                resultList.Add(nav);
            }
            return(Common.JSONHelper.ObjectToJson(resultList));
        }
Beispiel #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     config = bll.GetCompanyWebsiteConfig();
     if (config == null)
     {
         config = new CompanyWebsite_Config();
         config.WebsiteTitle       = "膏方专家预约平台";
         config.WebsiteDescription = "膏方专家预约平台";
     }
 }
Beispiel #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            config = bll.GetCompanyWebsiteConfig();

            toolBars = bllCompanyWebSite.GetToolBarList(int.MaxValue, 1, bllCompanyWebSite.WebsiteOwner, null, null, false)
                       .OrderBy(p => p.KeyType).Select(p => p.KeyType).Distinct().ToList();
            slides = bllSlide.GetCurrWebsiteAllTypeList();

            #region 会员标准字段
            List <TableFieldMapping> baseFieldList = bllTableFieldMap.GetTableFieldMap(null, "ZCJ_UserInfo");
            List <TableFieldMapping> webFieldList  = bllTableFieldMap.GetTableFieldMap(bllTableFieldMap.WebsiteOwner, "ZCJ_UserInfo", null, null, true);
            foreach (var item in baseFieldList)
            {
                if (fieldList.Exists(p => p.Value == item.Field))
                {
                    continue;
                }
                TableFieldMapping nWebFieldItem = webFieldList.FirstOrDefault(p => p.Field == item.Field);
                fieldList.Add(new ListItem
                {
                    Value    = item.Field,
                    Text     = nWebFieldItem == null ? item.MappingName : nWebFieldItem.MappingName,
                    Selected = nWebFieldItem != null && nWebFieldItem.IsDelete == 0 ? true:false
                });
            }
            List <string> baseFieldStringList = baseFieldList.Select(p => p.Field).ToList();
            foreach (var item in webFieldList.Where(p => !baseFieldStringList.Contains(p.Field)))
            {
                if (fieldList.Exists(p => p.Value == item.Field))
                {
                    continue;
                }
                fieldList.Add(new ListItem
                {
                    Value    = item.Field,
                    Text     = item.MappingName,
                    Selected = item.IsDelete == 0 ? true : false
                });
            }
            #endregion 会员标准字段

            currentWebsiteInfo = bll.GetWebsiteInfoModelFromDataBase();

            List <CompanyWebsite_ToolBar> dataList = bll.GetColList <CompanyWebsite_ToolBar>(int.MaxValue, 1, string.Format(" WebsiteOwner = '{0}'", bll.WebsiteOwner), "AutoID,KeyType,BaseID");
            ArticleGroups = dataList.OrderBy(p => p.KeyType).Select(p => p.KeyType).Distinct().ToList();

            if (!string.IsNullOrEmpty(config.LoginConfigJson))
            {
                JTokenLogin = JToken.Parse(config.LoginConfigJson);
            }
        }
Beispiel #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            config = bllWebSite.GetCompanyWebsiteConfig();
            if (config == null)
            {
                config = new CompanyWebsite_Config();
                config.WebsiteTitle       = "膏方专家预约平台";
                config.WebsiteDescription = "膏方专家预约平台";
            }



            if (string.IsNullOrEmpty(Request["id"]))
            {
                Response.Write("id 参数必传");
                Response.End();
            }
            model = bllMall.GetProduct(Request["id"]);
            if (model == null)
            {
                Response.Write("id 参数错误");
                Response.End();
            }
            config.WebsiteTitle = string.Format("中医专家-{0}-膏方预约平台已开通!", model.PName);
            if (model.IsOnSale == "0")
            {
                config.WebsiteTitle = string.Format("中医专家-{0}-膏方预约平台即将开通!", model.PName);
            }

            StringBuilder sbWhere = new StringBuilder();

            sbWhere.AppendFormat("  WebsiteOwner='{0}' And TableName ='ZCJ_WXMallOrderInfo' Order by Sort DESC", bllMall.WebsiteOwner);
            fieldList = bllMall.GetList <TableFieldMapping>(sbWhere.ToString());

            categoryList = bllMall.GetCategoryList().Where(p => p.PreID == 0).Where(p => p.Type == "BookingDoctorFuYou").ToList();

            if (!string.IsNullOrEmpty(model.CategoryId))
            {
                categoryId = model.CategoryId;
                WXMallCategory category = bllMall.Get <WXMallCategory>(string.Format(" AutoID={0}", model.CategoryId));
                if (category != null)
                {
                    if (category.PreID > 0)
                    {
                        categoryId = bllMall.Get <WXMallCategory>(string.Format(" AutoID={0}", category.PreID)).AutoID.ToString();
                    }
                }
            }
        }
Beispiel #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var reqSid = Request["sid"];//分享用户的AutoId
                if (!string.IsNullOrEmpty(reqSid))
                {
                    shareUser = bllUser.GetUserInfoByAutoID(int.Parse(reqSid));
                }

                var reqUserAutoId = Request["autoid"];

                currUser = bllUser.GetUserInfoByAutoID(int.Parse(reqUserAutoId));

                website = bllUser.GetWebsiteInfoModelFromDataBase(currUser.WebsiteOwner);

                config = bllWebsite.GetCompanyWebsiteConfig(currUser.WebsiteOwner);

                if (string.IsNullOrWhiteSpace(website.DistributionShareQrcodeBgImg))
                {
                    website.DistributionShareQrcodeBgImg = "http://files.comeoncloud.net/img/gxfc.png";
                }

                string currUserShowName = bllUser.GetUserDispalyName(currUser);

                shareTitle = currUserShowName + "邀请您加入 " + website.WXMallName;

                if (!string.IsNullOrWhiteSpace(reqUserAutoId))
                {
                    bllWeixin.GetDistributionWxQrcodeLimit(out qrcondeUrl, currUser);
                    if (!string.IsNullOrEmpty(config.DistributionQRCodeIcon) && !string.IsNullOrEmpty(qrcondeUrl))
                    {
                        try
                        {
                            qrcondeUrl = bllWeixin.GetQRCodeImg(qrcondeUrl, config.DistributionQRCodeIcon);
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                    pageTitle = currUserShowName + "的专属二维码";
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
                Response.End();
            }
        }
Beispiel #11
0
        public void ProcessRequest(HttpContext context)
        {
            var companyConfig = bllWebsite.GetCompanyWebsiteConfig();

            if (!string.IsNullOrEmpty(companyConfig.LoginConfigJson))
            {
                JToken JToken = JToken.Parse(companyConfig.LoginConfigJson);
                apiResp.status = true;
                apiResp.msg    = "ok";
                apiResp.result = new
                {
                    logo                       = companyConfig.WebsiteImage,
                    system_name                = JToken["system_name"] != null?JToken["system_name"].ToString():"",
                    background_image           = JToken["background_image"] != null ? JToken["background_image"].ToString() : "",
                    login_btn_background_color = JToken["login_btn_background_color"] != null ? JToken["login_btn_background_color"].ToString() : "",
                };
            }


            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var reqUserAutoId = Request["sid"];//分享用户的AutoId

            website = bllUser.GetWebsiteInfoModelFromDataBase();
            CompanyWebsite_Config config = bllWebsite.GetCompanyWebsiteConfig();

            if (string.IsNullOrWhiteSpace(website.DistributionShareQrcodeBgImg))
            {
                website.DistributionShareQrcodeBgImg = "http://files.comeoncloud.net/img/gxfc.png";
            }
            channelUser = bllUser.GetUserInfoByAutoID(Convert.ToInt32(reqUserAutoId));
            if (!(bllDis.IsChannel(channelUser)))
            {
                Response.End();
            }
            qrcondeUrl = bllDis.GetDistributionWxQrcodeLimitUrl(channelUser.UserID, "channel");
            if (!string.IsNullOrEmpty(config.DistributionQRCodeIcon) && !string.IsNullOrEmpty(qrcondeUrl))
            {
                qrcondeUrl = bllWeixin.GetQRCodeImg(qrcondeUrl, config.DistributionQRCodeIcon);
            }
            pageTitle = bllUser.GetUserDispalyName(channelUser) + "邀请您关注 " + website.WXMallName;
        }
Beispiel #13
0
        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");
            //}
        }
Beispiel #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (!Request.UserAgent.ToLower().Contains("micromessenger"))
            //{
            //    // ToLog("非微信浏览器进入不执行授权");
            //    Response.Write("请用微信浏览器打开");
            //    Response.End();
            //    return;//非微信浏览器进入不执行授权
            //}
            if (!bllUser.IsLogin)
            {
                Response.Write("请用微信打开");
                Response.End();
                return;
            }
            var website = bll.GetWebsiteInfoModelFromDataBase();
            CompanyWebsite_Config companyWebsiteConfig = bllWebSite.GetCompanyWebsiteConfig();;
            string   indexStr        = File.ReadAllText(this.Server.MapPath(@"\App\Distribution\m\app.html"));
            UserInfo CurrentUserInfo = bllUser.GetCurrentUserInfo();

            if (indexStr.Contains("'$$CURRENTUSERINFO$$'"))
            {
                var websiteLogo = companyWebsiteConfig.WebsiteImage;
                if (string.IsNullOrEmpty(websiteLogo))
                {
                    websiteLogo = ConfigHelper.GetConfigString("WebsiteLogo");
                }
                else
                {
                    websiteLogo = bll.GetImgUrl(websiteLogo);
                }

                string nextLevelName          = string.Empty;
                double distanceNextLevelScore = 0;

                UserLevelConfig currUserLevel = bll.GetUserLevel(CurrentUserInfo, out nextLevelName, out distanceNextLevelScore);


                apiResp.result = new
                {
                    user_show_name         = bllUser.GetUserDispalyName(CurrentUserInfo),
                    website_logo           = websiteLogo,
                    website_name           = website.WebsiteName,
                    is_distribution_member = IsDistributionMember(CurrentUserInfo, website),                                   //是否是分销会员
                    recommend_id           = CurrentUserInfo.AutoID,                                                           //我的推荐码
                    recommend_count        = bll.GetUserCommendCount(CurrentUserInfo.UserID),                                  //推荐人数
                    nick_name    = CurrentUserInfo.WXNickname,                                                                 //昵称
                    true_name    = CurrentUserInfo.TrueName,                                                                   //真实姓名
                    head_img_url = bllUser.GetUserDispalyAvatar(CurrentUserInfo),                                              //头像
                    history_commission_total_amount = CurrentUserInfo.HistoryDistributionOffLineTotalAmount,                   //累计佣金
                    can_use_amount            = bll.GetUserCanUseAmount(CurrentUserInfo),                                      //可提现金额
                    level_name                = currUserLevel.LevelString,
                    direct_rate               = bll.GetUserLevel(CurrentUserInfo).DistributionRateLevel0,                      //直销佣金比例
                    direct_sale_amount        = bll.GetDirectSaleAmount(CurrentUserInfo.UserID),                               //累计直接销售
                    down_user_total_count     = bll.GetDownUserTotalCount(CurrentUserInfo.UserID, bll.GetDistributionLevel()), //下级用户总和
                    down_user_level1_count    = bll.GetDownUserCount(CurrentUserInfo.UserID, 1),                               //一级分销用户数
                    down_user_level2_count    = bll.GetDownUserCount(CurrentUserInfo.UserID, 2),                               //二级分销用户数
                    down_user_level3_count    = bll.GetDownUserCount(CurrentUserInfo.UserID, 3),                               //三级分销用户数
                    distribution_level1_rate  = bll.GetUserLevel(CurrentUserInfo).DistributionRateLevel1,                      //一级分销佣金比例
                    distribution_level2_rate  = bll.GetUserLevel(CurrentUserInfo).DistributionRateLevel2,                      //二级分销佣金比例
                    distribution_level3_rate  = bll.GetUserLevel(CurrentUserInfo).DistributionRateLevel3,                      //三级分销佣金比例
                    next_level_name           = nextLevelName,                                                                 //下个等级名称
                    distance_next_level_score = distanceNextLevelScore                                                         //距离下个等级的积分
                };
                apiResp.status = true;
                apiResp.msg    = "ok";
                indexStr       = indexStr.Replace("'$$CURRENTUSERINFO$$'", ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
            }

            if (indexStr.Contains("'$$fx-websiteConfig$$'"))
            {
                dynamic websiteConfigResult = new
                {
                    website_name              = website.WebsiteName,                                                                           //站点名称
                    distribution_level        = bll.GetDistributionLevel(),                                                                    //后台配置的几级
                    distribution_show_level   = bll.GetDistributionShowLevel(),                                                                //会员显示分销级别
                    commission_show_name      = string.IsNullOrWhiteSpace(website.CommissionShowName) ? "积分" : website.CommissionShowName,     //佣金显示名称
                    distribution_show_name    = string.IsNullOrWhiteSpace(website.DistributionShowName) ? "会员" : website.DistributionShowName, //分销显示名称
                    is_show_distribution_rate = website.IsShowDistributionOffLineRate,                                                         //是否显示分销比例
                    share_title          = companyWebsiteConfig.WebsiteTitle,                                                                  //分享标题
                    share_desc           = companyWebsiteConfig.WebsiteDescription,                                                            //分享描述
                    share_img_url        = companyWebsiteConfig.WebsiteImage,                                                                  //分享图片
                    project_field_list   = bll.GetProjectFieldMapListF(),                                                                      //项目自定义字段
                    slide_type           = website.DistributionOffLineSlideType,
                    is_show_member_score = website.DistributionOffLineIsShowMemberScore
                };

                indexStr = indexStr.Replace("'$$fx-websiteConfig$$'", ZentCloud.Common.JSONHelper.ObjectToJson(websiteConfigResult));
            }

            if (indexStr.Contains("$$fx-wrapApplyHeader$$"))
            {
                indexStr = indexStr.Replace("$$fx-wrapApplyHeader$$", website.DistributionOffLineDescription);
            }

            if (indexStr.Contains("$$fx-wrapApplyWaitInfo$$"))
            {
                indexStr = indexStr.Replace("$$fx-wrapApplyWaitInfo$$", website.DistributionOffLineApplyWaitInfo);
            }

            //直接返回广告数组
            if (indexStr.Contains("'$$fx-slides$$'") && !string.IsNullOrWhiteSpace(website.DistributionOffLineSlideType))
            {
                string slideType = website.DistributionOffLineSlideType;
                System.Text.StringBuilder sbWhere = new System.Text.StringBuilder(string.Format(" WebsiteOwner='{0}'", bll.WebsiteOwner));
                if (!string.IsNullOrEmpty(slideType))
                {
                    sbWhere.AppendFormat(" And Type='{0}'", slideType);
                }
                sbWhere.Append(" order by Sort DESC");
                var sourceData = bll.GetList <BLLJIMP.Model.Slide>(sbWhere.ToString());
                var list       = from p in sourceData
                                 select new
                {
                    img_url    = bll.GetImgUrl(p.ImageUrl),
                    link       = p.Link,
                    slide_type = p.Type,
                    link_text  = p.LinkText
                };

                var data = new
                {
                    totalcount = sourceData.Count,
                    proportion = bllKeyValue.GetSlideProportion(slideType),
                    list       = list,//列表
                };

                indexStr = indexStr.Replace("'$$fx-slides$$'", ZentCloud.Common.JSONHelper.ObjectToJson(data));
            }

            this.Response.Write(indexStr);
        }