Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            nWebsiteConfig = bllWebSite.GetCompanyWebsiteConfig();

            //头部图标引用
            ico_css_file = bllWebSite.GetIcoFilePath();
        }
Esempio n. 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));
        }
Esempio n. 3
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;
            }
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            referrer = this.Request["referrer"];
            CompanyWebsite_Config nWebsiteConfig = bllWebSite.GetCompanyWebsiteConfig();

            memberStandardDescription = nWebsiteConfig.MemberStandardDescription;
            if (nWebsiteConfig.MemberStandard > 1)
            {
                this.Response.Redirect("CompleteUserInfo.aspx?referrer=" + HttpUtility.UrlEncode(referrer));
                return;
            }
            curUser = bllUser.GetCurrentUserInfo();
            if (curUser == null)
            {
                curUser = new UserInfo();
            }
            //if (curUser.IsPhoneVerify == 1)
            //{
            //    this.Response.Redirect("/Error/IsPhoneVerify.htm");
            //    return;
            //}

            //头部图标引用
            ico_css_file = bllWebSite.GetIcoFilePath();
        }
Esempio n. 5
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"]));
     }
 }
Esempio n. 6
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"),"");
            }
        }
Esempio n. 7
0
        public string GetDistributionQRCodeIcon(string websiteOwner)
        {
            CompanyWebsite_Config config = GetColByKey <CompanyWebsite_Config>("WebsiteOwner", websiteOwner, "AutoID,DistributionQRCodeIcon");

            if (config == null)
            {
                return("");
            }
            return(config.DistributionQRCodeIcon);
        }
Esempio n. 8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     config = bll.GetCompanyWebsiteConfig();
     if (config == null)
     {
         config = new CompanyWebsite_Config();
         config.WebsiteTitle       = "膏方专家预约平台";
         config.WebsiteDescription = "膏方专家预约平台";
     }
 }
Esempio n. 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            qrcondeUrl = bllDisb.GetDistributionWxQrcodeLimitUrl(bllDisb.WebsiteOwner);
            qrcondeUrl = bllWeixin.CompoundImageLogoToOss(qrcondeUrl, bllWebsite.WebsiteOwner);

            website = bllDisb.GetWebsiteInfoModelFromDataBase();
            config  = bllWebsite.GetCompanyWebsiteConfig();
            if (string.IsNullOrWhiteSpace(website.DistributionShareQrcodeBgImg))
            {
                website.DistributionShareQrcodeBgImg = "http://files.comeoncloud.net/img/gxfc.png";
            }
        }
Esempio n. 10
0
        public CompanyWebsite_Config GetCompanyWebsiteConfig(string websiteOwner)
        {
            var data = Get <CompanyWebsite_Config>(string.Format("WebsiteOwner='{0}'", websiteOwner));

            if (data == null)
            {
                data = new CompanyWebsite_Config();
            }

            FilterCompanyWebsiteConfig(ref data, websiteOwner);

            return(data);
        }
Esempio n. 11
0
        private void GetWebsiteConfig()
        {
            CompanyWebsite_Config config = bllWeisite.GetCompanyWebsiteConfig();

            if (config != null && !string.IsNullOrEmpty(config.WeiXinBindDomain))
            {
                strDomain = config.WeiXinBindDomain;
            }
            else
            {
                strDomain = Request.Url.Authority;
            }
        }
Esempio n. 12
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);
            }
        }
Esempio n. 13
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();
            }
        }
Esempio n. 14
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();
                    }
                }
            }
        }
Esempio n. 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //currWebSiteUserInfo = this.userBll.GetUserInfo(userBll.WebsiteOwner);
            currWebSiteInfo = bllMall.GetWebsiteInfoModelFromDataBase();
            if (string.IsNullOrEmpty(currWebSiteInfo.ProductImgRatio1))
            {
                currWebSiteInfo.ProductImgRatio1 = (600).ToString();
            }
            if (string.IsNullOrEmpty(currWebSiteInfo.ProductImgRatio2))
            {
                currWebSiteInfo.ProductImgRatio2 = (600).ToString();
            }
            WXMallIndexUrl = string.Format("http://{0}/customize/comeoncloud/Index.aspx?key=MallHome", Request.Url.Host);
            if (currWebSiteInfo != null)
            {
                if (currWebSiteInfo.MallTemplateId.Equals(1))//外卖
                {
                    WXMallIndexUrl = string.Format("http://{0}/App/Cation/wap/mall/IndexV2.aspx", Request.Url.Host);
                }
            }

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

            slides      = bllSlide.GetCurrWebsiteAllTypeList();
            scoreConfig = bllScore.GetScoreConfig();
            if (scoreConfig == null)
            {
                scoreConfig = new BLLJIMP.Model.ScoreConfig();
            }
            CompanyWebsiteConfig = bllWebsite.GetCompanyWebsiteConfig();

            StoreSinceTimeJson = CompanyWebsiteConfig.StoreSinceTimeJson;
            if (string.IsNullOrEmpty(StoreSinceTimeJson))
            {
                StoreSinceTimeJson = "[]";
            }

            HomeDeliveryTimeJson = CompanyWebsiteConfig.HomeDeliveryTimeJson;
            if (string.IsNullOrEmpty(HomeDeliveryTimeJson))
            {
                HomeDeliveryTimeJson = "[]";
            }
        }
Esempio n. 16
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));
        }
Esempio n. 17
0
        /// <summary>
        /// 获取工具栏列表
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string GetToolBarList(HttpContext context)
        {
            CompanyWebsite_Config         companyConfig = bllWebsite.GetCompanyWebsiteConfig();
            List <CompanyWebsite_ToolBar> dataList      = bllCompanyWebSite.GetToolBarList(int.MaxValue, 1, bllCompanyWebSite.WebsiteOwner, "nav", companyConfig.BottomToolbars, false);

            for (int i = 0; i < dataList.Count; i++)
            {
                if (dataList[i].ToolBarType.Equals("电话"))
                {
                    dataList[i].ToolBarTypeValue = string.Format("tel:{0}", dataList[i].ToolBarTypeValue);
                }
                if (dataList[i].ToolBarType.Equals("短信"))
                {
                    dataList[i].ToolBarTypeValue = string.Format("sms:{0}", dataList[i].ToolBarTypeValue);
                }
                dataList[i].ToolBarTypeValue = ReplaceArticleUrl(context, dataList[i].ToolBarTypeValue);
            }
            return(Common.JSONHelper.ObjectToJson(dataList));
        }
Esempio n. 18
0
        /// <summary>
        /// 申请提现
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string ApplyWithrawCash(HttpContext context)
        {
            string  bankCardId = context.Request["BankCardId"];
            string  amount     = context.Request["Amount"];
            string  type       = context.Request["type"];//到账方式 0银行卡 1微信 2账户余额
            string  msg        = "";
            decimal mount      = 0;

            CompanyWebsite_Config config = bllWebsite.GetCompanyWebsiteConfig();

            if (!decimal.TryParse(amount, out mount))
            {
                resp.Msg = "提现金额为整数";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            if (config.LowestAmount > 0)
            {
                if (mount < config.LowestAmount)
                {
                    resp.Msg = "最低提现金额为:" + config.LowestAmount;
                    return(Common.JSONHelper.ObjectToJson(resp));
                }
            }
            var currentUserInfo = bllUser.GetCurrentUserInfo();

            if (context.Request["ischannel"] != null && context.Request["ischannel"].ToString() == "1")
            {
                UserInfo channelUserInfo = bllUser.Get <UserInfo>(string.Format("MgrUserId='{0}'", currentUserInfo.UserID));
                if (channelUserInfo != null)
                {
                    currentUserInfo          = channelUserInfo;
                    currentUserInfo.TrueName = channelUserInfo.ChannelName;
                }
            }
            if (bllDis.ApplyWithrawCash(currentUserInfo, bankCardId, amount, currentUserInfo.WebsiteOwner, int.Parse(type), out msg))
            {
                resp.Status = 1;
            }
            resp.Msg = msg;
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Esempio n. 19
0
        /// <summary>
        /// 填充默认配置,当配置项为空的时候不让它为空
        /// </summary>
        /// <param name="config"></param>
        public void FilterCompanyWebsiteConfig(ref CompanyWebsite_Config config, string websiteOwner = "")
        {
            var currentWebsiteInfo = new WebsiteInfo();

            if (string.IsNullOrWhiteSpace(websiteOwner))
            {
                currentWebsiteInfo = GetWebsiteInfoModelFromDataBase();
            }
            else
            {
                currentWebsiteInfo = GetWebsiteInfoModelFromDataBase(websiteOwner);
            }
            if (string.IsNullOrWhiteSpace(config.WebsiteTitle))
            {
                config.WebsiteTitle = currentWebsiteInfo.WebsiteName;
            }
            if (string.IsNullOrWhiteSpace(config.WebsiteDescription))
            {
                config.WebsiteDescription = "欢迎访问" + currentWebsiteInfo.WebsiteName;
            }
            if (string.IsNullOrWhiteSpace(config.Copyright))
            {
                config.Copyright = currentWebsiteInfo.WebsiteName + "@" + DateTime.Now.Year;
            }
            if (string.IsNullOrWhiteSpace(config.DistributionQRCodeIcon))
            {
                //config.DistributionQRCodeIcon = "http://open-files.comeoncloud.net/www/fuqijiaoyu/jubit/image/20160526/399F479B65E04BAA9B4AB8B35793F1C6.png";
            }
            else
            {
                //处理已经把图片变为至云之家的站点数据
                if (currentWebsiteInfo.WebsiteOwner != "comeoncloud" && config.DistributionQRCodeIcon == "http://open-files.comeoncloud.net/www/fuqijiaoyu/jubit/image/20160526/399F479B65E04BAA9B4AB8B35793F1C6.png")
                {
                    config.DistributionQRCodeIcon = "";
                }
            }
            if (string.IsNullOrWhiteSpace(config.WeixinAccountNickName))
            {
                config.WeixinAccountNickName = currentWebsiteInfo.WebsiteName;
            }
        }
Esempio n. 20
0
        /// <summary>
        /// 获取导航列表
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string GetNavigateList(HttpContext context)
        {
            CompanyWebsite_Config          companyConfig = bllWebsite.GetCompanyWebsiteConfig();
            List <CompanyWebsite_ToolBar>  dataList      = bllCompanyWebSite.GetToolBarList(int.MaxValue, 1, bllCompanyWebSite.WebsiteOwner, "nav", companyConfig.ShopNavGroupName, false);
            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.ToolBarName;
                nav.NavigateImage     = bll.GetImgUrl(item.ImageUrl);
                nav.IconClass         = item.ToolBarImage;
                nav.NavigateTypeValue = ReplaceArticleUrl(context, item.ToolBarTypeValue);
                //nav.NavigateType = item.KeyType;
                nav.NavigateType = item.ToolBarType;
                nav.PlayIndex    = item.PlayIndex;
                resultList.Add(nav);
            }
            return(Common.JSONHelper.ObjectToJson(resultList));
        }
Esempio n. 21
0
        public ArticeCategoryTypeResponse GetTypeConfig(string websiteOwner, string categoryType)
        {
            ArticleCategoryTypeConfig nCategoryTypeConfig = GetArticleCategoryTypeConfig(websiteOwner, categoryType);

            CompanyWebsite_Config nWebsiteConfig = Get <CompanyWebsite_Config>(string.Format("WebsiteOwner='{0}'", websiteOwner));
            var apply_url = "/App/Member/Wap/PhoneVerify.aspx?referrer=" + System.Web.HttpUtility.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString());

            if (nWebsiteConfig != null && (nWebsiteConfig.MemberStandard == 2 || nWebsiteConfig.MemberStandard == 3))
            {
                apply_url = "/App/Member/Wap/CompleteUserInfo.aspx?referrer=" + System.Web.HttpUtility.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString());
            }
            UserInfo curUser = GetCurrentUserInfo();

            return(new ArticeCategoryTypeResponse
            {
                time_set_method = nCategoryTypeConfig.TimeSetMethod,
                time_set_style = nCategoryTypeConfig.TimeSetStyle,
                spend_method = nCategoryTypeConfig.SpendMethod,
                title = nCategoryTypeConfig.CategoryTypeTitle,
                home_title = nCategoryTypeConfig.CategoryTypeHomeTitle,
                order_list_title = nCategoryTypeConfig.CategoryTypeOrderListTitle,
                order_detail_title = nCategoryTypeConfig.CategoryTypeOrderDetailTitle,
                category_type = nCategoryTypeConfig.CategoryType,
                category_name = nCategoryTypeConfig.CategoryTypeDispalyName,
                stock_name = nCategoryTypeConfig.CategoryTypeStockName,
                slide_width = nCategoryTypeConfig.SlideWidth,
                slide_height = nCategoryTypeConfig.SlideHeight,
                is_login = curUser != null ? true : false,
                is_member = IsMember(),
                truename = curUser != null ? curUser.TrueName : "",
                phone = curUser != null ? curUser.Phone : "",
                access_level = curUser != null ? curUser.AccessLevel : 0,
                apply_url = apply_url,
                nopms_url = "/Error/NoPmsMobile.htm",
                share_title = nCategoryTypeConfig.ShareTitle,
                share_img = nCategoryTypeConfig.ShareImg,
                share_desc = nCategoryTypeConfig.ShareDesc,
                share_link = nCategoryTypeConfig.ShareLink
            });
        }
Esempio n. 22
0
        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;
        }
Esempio n. 23
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");
            //}
        }
Esempio n. 24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            referrer = this.Request["referrer"];
            UserInfo curUser = bllUser.GetCurrentUserInfo();

            if (curUser == null)
            {
                curUser = new UserInfo();
            }
            CompanyWebsite_Config nWebsiteConfig = bllWebSite.GetCompanyWebsiteConfig();

            memberStandardDescription = nWebsiteConfig.MemberStandardDescription;
            if (nWebsiteConfig.MemberStandard == 1)
            {
                this.Response.Redirect("PhoneVerify.aspx?referrer=" + HttpUtility.UrlEncode(referrer));
                return;
            }
            pageName = "完善资料";
            if (nWebsiteConfig.MemberStandard == 3)
            {
                pageName = "会员注册";
                referrer = "/Error/IsInApply.htm";
                if (curUser.MemberApplyStatus == 1)
                {
                    this.Response.Redirect("/Error/IsInApply.htm");
                    return;
                }
            }

            List <TableFieldMapping> listFieldList = bllTableFieldMap.GetTableFieldMap(bllTableFieldMap.WebsiteOwner, "ZCJ_UserInfo");
            List <string>            DefFields     = new List <string>()
            {
                "AutoID", "UserID", "Password", "UserType", "TrueName", "Phone", "Avatar"
            };

            #region 照片
            TableFieldMapping AvatarField = listFieldList.FirstOrDefault(p => p.Field.Equals("Avatar"));
            if (AvatarField != null)
            {
                //curUser.IsPhoneVerify
                formField.Add(new TableFieldMapping()
                {
                    Field = "Avatar", MappingName = AvatarField.MappingName, FieldType = AvatarField.FieldType, Disabled = 0, Value = curUser.Avatar, FieldIsNull = AvatarField.FieldIsNull
                });
            }
            #endregion
            #region 姓名
            TableFieldMapping TrueNameField = listFieldList.FirstOrDefault(p => p.Field.Equals("TrueName"));
            if (TrueNameField == null)
            {
                formField.Add(new TableFieldMapping()
                {
                    Field = "TrueName", MappingName = "姓名", Disabled = 0, Value = curUser.TrueName, FieldIsNull = 1
                });
            }
            else
            {
                formField.Add(new TableFieldMapping()
                {
                    Field = "TrueName", MappingName = TrueNameField.MappingName, Disabled = 0, Value = curUser.TrueName, FieldIsNull = TrueNameField.FieldIsNull
                });
            }
            #endregion
            #region 手机
            TableFieldMapping PhoneField = listFieldList.FirstOrDefault(p => p.Field.Equals("Phone"));
            if (PhoneField == null)
            {
                //curUser.IsPhoneVerify
                formField.Add(new TableFieldMapping()
                {
                    Field = "Phone", MappingName = "手机", Disabled = 0, Value = curUser.Phone, FieldIsNull = 1
                });
            }
            else
            {
                formField.Add(new TableFieldMapping()
                {
                    Field = "Phone", MappingName = PhoneField.MappingName, Disabled = 0, Value = curUser.Phone, FieldIsNull = PhoneField.FieldIsNull
                });
            }
            #endregion
            //#region 公司
            //TableFieldMapping CompanyField = listFieldList.FirstOrDefault(p => p.Field.Equals("Company"));
            //if (CompanyField != null)
            //{
            //    formField.Add(new TableFieldMapping() { Field = "Company", MappingName = CompanyField.MappingName, Disabled = 0, Value = curUser.Company, FieldIsNull = CompanyField.FieldIsNull });
            //}
            //#endregion
            //#region 职位
            //TableFieldMapping PostionField = listFieldList.FirstOrDefault(p => p.Field.Equals("Postion"));
            //if (PostionField != null)
            //{
            //    formField.Add(new TableFieldMapping() { Field = "Postion", MappingName = PostionField.MappingName, Disabled = 0, Value = curUser.Postion, FieldIsNull = PostionField.FieldIsNull });
            //}
            //#endregion
            JObject          jtCurUser     = JObject.FromObject(curUser);
            List <JProperty> listPropertys = jtCurUser.Properties().ToList();
            foreach (var item in listFieldList.Where(p => !DefFields.Contains(p.Field)).OrderBy(p => p.Sort))
            {
                if (!listPropertys.Exists(p => p.Name.Equals(item.Field)))
                {
                    continue;
                }
                formField.Add(new TableFieldMapping()
                {
                    Field = item.Field, MappingName = item.MappingName, FieldType = item.FieldType, Disabled = 0, Value = jtCurUser[item.Field].ToString(), FieldIsNull = item.FieldIsNull
                });
            }

            //头部图标引用
            ico_css_file = bllWebSite.GetIcoFilePath();
        }
Esempio n. 25
0
        public void ProcessRequest(HttpContext context)
        {
            string   code            = context.Request["code"];
            string   Phone           = context.Request["Phone"];
            UserInfo CurrentUserInfo = bllUser.GetCurrentUserInfo();


            #region 检查是否已登录
            if (CurrentUserInfo != null)
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "本功能仅供新用户使用";
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            #endregion
            #region 检查是否微信服务号
            if (context.Session["currWXOpenId"] == null)
            {
                apiResp.code = (int)APIErrCode.UserIsNotLogin;
                apiResp.msg  = "本功能仅供微信服务号使用";
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            #endregion
            string wxOpenId = context.Session["currWXOpenId"].ToString();
            CurrentUserInfo = bllUser.GetUserInfoByOpenId(wxOpenId);
            if (CurrentUserInfo != null)
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "OpenId已被绑定";
                bllUser.ContextResponse(context, apiResp);
                return;
            }

            #region 判断手机格式
            if (!MyRegex.PhoneNumLogicJudge(Phone))
            {
                apiResp.code = (int)APIErrCode.PhoneFormatError;
                apiResp.msg  = "手机格式错误";
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            #endregion
            #region 判断手机是否已被使用
            UserInfo model = bllUser.GetUserInfoByPhone(Phone);
            if (model != null)
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "手机号码已被其他账号使用,请联系管理员";
                bllSms.ContextResponse(context, apiResp);
                return;
            }
            #endregion
            #region 判断验证码是否正确
            SmsVerificationCode sms = bllSms.GetLastSmsVerificationCode(Phone);
            if (sms == null || sms.VerificationCode != code)
            {
                apiResp.code = (int)APIErrCode.CheckCodeErr;
                apiResp.msg  = "验证码错误";
                bllSms.ContextResponse(context, apiResp);
                return;
            }
            #endregion

            List <TableFieldMapping> listFieldList = bllTableFieldMap.GetTableFieldMapByWebsite(bllTableFieldMap.WebsiteOwner, "ZCJ_UserInfo", null, null, "0", null);
            List <string>            defFields     = new List <string>()
            {
                "AutoID", "UserID", "Password", "UserType", "TrueName", "Phone"
            };

            #region 账号检查 未登录时检查已有账号
            CurrentUserInfo = bllUser.GetUserInfoByAllPhone(Phone);
            if (CurrentUserInfo != null)
            {
                List <string> tempFields = new List <string>()
                {
                    "Phone1", "Phone2", "Phone3"
                };
                List <GetCompleteField.ResultField> resultList = new List <GetCompleteField.ResultField>();
                #region 取姓名
                TableFieldMapping AcountTrueNameField = listFieldList.FirstOrDefault(p => p.Field.Equals("TrueName"));

                if (AcountTrueNameField == null)
                {
                    resultList.Add(new GetCompleteField.ResultField {
                        field = "TrueName", field_name = "姓名", type = "txt", no_null = 1, value = CurrentUserInfo.TrueName, read_only = 0
                    });
                }
                else
                {
                    resultList.Add(new GetCompleteField.ResultField {
                        field = "TrueName", field_name = AcountTrueNameField.MappingName, type = "txt", no_null = AcountTrueNameField.FieldIsNull, value = CurrentUserInfo.TrueName, read_only = AcountTrueNameField.IsReadOnly
                    });
                }
                #endregion
                #region 取手机
                if (!string.IsNullOrWhiteSpace(CurrentUserInfo.Phone1))
                {
                    TableFieldMapping AcountPhone1Field = listFieldList.FirstOrDefault(p => p.Field.Equals("Phone1"));
                    if (AcountPhone1Field == null)
                    {
                        resultList.Add(new GetCompleteField.ResultField {
                            field = "TrueName", field_name = "手机", type = "txt", no_null = 1, value = CurrentUserInfo.Phone1, read_only = 0
                        });
                    }
                    else
                    {
                        resultList.Add(new GetCompleteField.ResultField {
                            field = "TrueName", field_name = AcountPhone1Field.MappingName, type = "txt", no_null = AcountPhone1Field.FieldIsNull, value = CurrentUserInfo.Phone1, read_only = AcountPhone1Field.IsReadOnly
                        });
                    }
                }
                if (!string.IsNullOrWhiteSpace(CurrentUserInfo.Phone2))
                {
                    TableFieldMapping AcountPhone2Field = listFieldList.FirstOrDefault(p => p.Field.Equals("Phone2"));
                    if (AcountPhone2Field == null)
                    {
                        resultList.Add(new GetCompleteField.ResultField {
                            field = "Phone2", field_name = "手机", type = "txt", no_null = 1, value = CurrentUserInfo.Phone2, read_only = 0
                        });
                    }
                    else
                    {
                        resultList.Add(new GetCompleteField.ResultField {
                            field = "Phone2", field_name = AcountPhone2Field.MappingName, type = "txt", no_null = AcountPhone2Field.FieldIsNull, value = CurrentUserInfo.Phone2, read_only = AcountPhone2Field.IsReadOnly
                        });
                    }
                }
                if (!string.IsNullOrWhiteSpace(CurrentUserInfo.Phone3))
                {
                    TableFieldMapping AcountPhone3Field = listFieldList.FirstOrDefault(p => p.Field.Equals("Phone3"));
                    if (AcountPhone3Field == null)
                    {
                        resultList.Add(new GetCompleteField.ResultField {
                            field = "Phone3", field_name = "手机", type = "txt", no_null = 1, value = CurrentUserInfo.Phone3, read_only = 0
                        });
                    }
                    else
                    {
                        resultList.Add(new GetCompleteField.ResultField {
                            field = "Phone3", field_name = AcountPhone3Field.MappingName, type = "txt", no_null = AcountPhone3Field.FieldIsNull, value = CurrentUserInfo.Phone3, read_only = AcountPhone3Field.IsReadOnly
                        });
                    }
                }
                #endregion
                #region 取其他信息
                JObject tCurUser = JObject.FromObject(CurrentUserInfo);
                foreach (var item in listFieldList.Where(p => !defFields.Contains(p.Field) && !tempFields.Contains(p.Field)))
                {
                    if (tCurUser[item.Field] == null)
                    {
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(tCurUser[item.Field].ToString()))
                    {
                        continue;
                    }
                    string FieldType = string.IsNullOrWhiteSpace(item.FieldType) ? "txt" : item.FieldType;
                    resultList.Add(new GetCompleteField.ResultField {
                        field = item.Field, field_name = item.MappingName, type = FieldType, no_null = item.FieldIsNull, value = tCurUser[item.Field].ToString(), read_only = item.IsReadOnly
                    });
                }
                #endregion

                apiResp.code   = (int)APIErrCode.HaveHistoryAcount;
                apiResp.msg    = "注册手机已存在账号";
                apiResp.result = new
                {
                    have_acount = true,
                    id          = CurrentUserInfo.AutoID,
                    info_list   = resultList
                };
                bllSms.ContextResponse(context, apiResp);
                return;
            }
            else
            {
                CurrentUserInfo = new UserInfo();
                string guidString = Guid.NewGuid().ToString();
                CurrentUserInfo.UserID        = string.Format("WXUser{0}", guidString); //Guid
                CurrentUserInfo.Password      = guidString.Substring(0, 8);             //Guid
                CurrentUserInfo.WXHeadimgurl  = string.Format("http://{0}", context.Request.Url.Authority) + "/img/persion.png";
                CurrentUserInfo.WebsiteOwner  = bllUser.WebsiteOwner;
                CurrentUserInfo.UserType      = 2;
                CurrentUserInfo.WXOpenId      = wxOpenId;
                CurrentUserInfo.Regtime       = DateTime.Now;
                CurrentUserInfo.LastLoginDate = DateTime.Now;
            }
            #endregion


            //string oldPhone = CurrentUserInfo.Phone;
            CurrentUserInfo = bllTableFieldMap.ConvertRequestToModel <UserInfo>(CurrentUserInfo);
            //if(CurrentUserInfo.IsPhoneVerify == 1) CurrentUserInfo.Phone = oldPhone;

            #region 默认信息检查 姓名
            TableFieldMapping TrueNameField = listFieldList.FirstOrDefault(p => p.Field.Equals("TrueName"));
            if ((TrueNameField == null || TrueNameField.FieldIsNull == 1) && string.IsNullOrWhiteSpace(CurrentUserInfo.TrueName))
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "请完善姓名";
                bllTableFieldMap.ContextResponse(context, apiResp);
                return;
            }
            #endregion

            JObject jtCurUser = JObject.FromObject(CurrentUserInfo);
            foreach (var item in listFieldList.Where(p => p.FieldIsNull == 1 && !defFields.Contains(p.Field)).OrderBy(p => p.Sort))
            {
                if (jtCurUser[item.Field] == null)
                {
                    continue;
                }
                if (string.IsNullOrWhiteSpace(jtCurUser[item.Field].ToString()))
                {
                    apiResp.code = (int)APIErrCode.OperateFail;
                    apiResp.msg  = "请完善" + item.MappingName;
                    bllTableFieldMap.ContextResponse(context, apiResp);
                    return;
                }
                if (!string.IsNullOrWhiteSpace(item.FormatValiFunc))
                {
                    #region 检查数据格式
                    //检查数据格式
                    if (item.FormatValiFunc == "number")
                    {
                        if (!MyRegex.IsNumber(jtCurUser[item.Field].ToString()))
                        {
                            apiResp.code = (int)APIErrCode.OperateFail;
                            apiResp.msg  = string.Format("{0}格式不正确", item.MappingName);
                            bllTableFieldMap.ContextResponse(context, apiResp);
                            return;
                        }
                    }
                    if (item.FormatValiFunc == "phone")//email检查
                    {
                        if (!MyRegex.PhoneNumLogicJudge(jtCurUser[item.Field].ToString()))
                        {
                            apiResp.code = (int)APIErrCode.OperateFail;
                            apiResp.msg  = string.Format("{0}格式不正确", item.MappingName);
                            bllTableFieldMap.ContextResponse(context, apiResp);
                            return;
                        }
                    }
                    if (item.FormatValiFunc == "email")//email检查
                    {
                        if (!MyRegex.EmailLogicJudge(jtCurUser[item.Field].ToString()))
                        {
                            apiResp.code = (int)APIErrCode.OperateFail;
                            apiResp.msg  = string.Format("{0}格式不正确", item.MappingName);
                            bllTableFieldMap.ContextResponse(context, apiResp);
                            return;
                        }
                    }
                    if (item.FormatValiFunc == "url")                                                                                                             //url检查
                    {
                        System.Text.RegularExpressions.Regex regUrl = new System.Text.RegularExpressions.Regex(@"http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"); //网址
                        System.Text.RegularExpressions.Match match  = regUrl.Match(jtCurUser[item.Field].ToString());
                        if (!match.Success)
                        {
                            apiResp.code = (int)APIErrCode.OperateFail;
                            apiResp.msg  = string.Format("{0}格式不正确", item.MappingName);
                            bllTableFieldMap.ContextResponse(context, apiResp);
                            return;
                        }
                    }
                    #endregion
                }
            }
            CurrentUserInfo.IsPhoneVerify = 1;
            CompanyWebsite_Config nWebsiteConfig = bllWebSite.GetCompanyWebsiteConfig();
            if (nWebsiteConfig.MemberStandard == 2)
            {
                if (CurrentUserInfo.AccessLevel < 1)
                {
                    CurrentUserInfo.AccessLevel     = 1;
                    CurrentUserInfo.MemberStartTime = DateTime.Now;
                }
                //CurrentUserInfo.MemberApplyStatus = 9;
            }
            else if (nWebsiteConfig.MemberStandard == 3)
            {
                CurrentUserInfo.MemberApplyStatus = 1;
                CurrentUserInfo.MemberApplyTime   = DateTime.Now;
            }
            if (bllUser.Add(CurrentUserInfo))
            {
                apiResp.status = true;
                apiResp.code   = (int)APIErrCode.IsSuccess;
                apiResp.msg    = "提交完成";

                context.Session[ZentCloud.Common.SessionKey.UserID]     = CurrentUserInfo.UserID;
                context.Session[ZentCloud.Common.SessionKey.LoginStatu] = 1; //设置登录状态
            }
            else
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "提交失败";
            }
            bllUser.ContextResponse(context, apiResp);
        }
Esempio n. 26
0
        public void ProcessRequest(HttpContext context)
        {
            //string strPsmIds = "0";
            //List<long> psmIds = bllMenuper.GetUserAllPmsID(bllMenuper.GetCurrentUserInfo().UserID);
            //if (psmIds.Count() > 0) strPsmIds = MyStringHelper.ListToStr(psmIds, "'", ",");
            //List<string> strList = new List<string>();
            //var pmsList = bllMenuper.GetList<PermissionInfo>(string.Format(" PermissionKey>'' AND PermissionID in ({0})", strPsmIds));
            //if (pmsList != null) strList = pmsList.Select(p => p.PermissionKey).ToList();



            var websiteInfo          = bll.GetWebsiteInfoModelFromDataBase();
            var companyWebsiteConfig = bll.Get <CompanyWebsite_Config>(string.Format(" WebsiteOwner='{0}'", bll.WebsiteOwner));

            if (companyWebsiteConfig == null)
            {
                companyWebsiteConfig = new CompanyWebsite_Config();
            }
            apiResp.status = true;
            apiResp.msg    = "ok";
            apiResp.result = new
            {
                #region 商城配置
                malll = new
                {
                    is_enable_account_amount_pay = websiteInfo.IsEnableAccountAmountPay == 1 ? true : false,                  //是否开启余额支付功能
                    account_amount_pay_showname  = websiteInfo.AccountAmountPayShowName,                                      //余额支付前端显示名称
                    groubuy_index_url            = companyWebsiteConfig == null ? "" : companyWebsiteConfig.GroupBuyIndexUrl, //团购首页链接
                    score_show_name      = string.IsNullOrEmpty(websiteInfo.ScorePayShowName) ? "积分" : websiteInfo.ScorePayShowName,
                    cardcoupon_show_name = string.IsNullOrEmpty(websiteInfo.CardCouponShowName) ? "优惠券" : websiteInfo.CardCouponShowName,
                    is_open_group        = websiteInfo.IsOpenGroup == 1?true:false,                              //是否允许用户开团
                    is_show_product_sale = websiteInfo.IsShowProductSaleCount == 1?true:false,                   //是否显示商品销量
                    is_show_name_phone   = websiteInfo.IsNeedMallOrderCreaterNamePhone == 1?true:false,          //是否需要姓名手机选项
                    rname                      = websiteInfo.NeedMallOrderCreaterNamePhoneRName,                 //自定义名称
                    is_show_stock              = websiteInfo.IsShowStock == 1?true:false,                        //是否显示库存
                    is_show_stock_value        = websiteInfo.IsShowStockValue,                                   // 库存对比value
                    order_cancel_minute        = websiteInfo.OrderCancelMinute,                                  //订单取消时间
                    is_customize_mall_head     = websiteInfo.IsCustomizeMallHead,                                //商城自定义头部
                    customize_mall_head_config = websiteInfo.CustomizeMallHeadConfig,                            //商城自定义头部配置
                    score_pay_redio            = websiteInfo.MallScorePayRatio,                                  //积分支付比例
                    shop_cart_along_settlement = companyWebsiteConfig.ShopCartAlongSettlement,                   //购物车单独结算
                    is_store_since             = companyWebsiteConfig.IsStoreSince,                              //是否开启门店自提
                    store_since_time           = GetStoreSinceTime(companyWebsiteConfig.StoreSinceTimeJson),     //门点自提时间段 小时
                    is_home_delivery           = companyWebsiteConfig.IsHomeDelivery,                            //是否送货上门
                    earliest_delivery_time     = companyWebsiteConfig.EarliestDeliveryTime,                      //最早送货时间  下单后几个小时
                    home_delivery_time         = GetHomeDeliveryTime(companyWebsiteConfig.HomeDeliveryTimeJson), //送货上门时间段 小时
                    is_auto_assisn_order       = companyWebsiteConfig.IsAutoAssignOrder,                         //是否自动分单
                    is_out_pay                 = companyWebsiteConfig.IsOutPay,                                  //是否外部第三方支付
                    express_range              = companyWebsiteConfig.ExpressRange,                              //快递发货:同城Y米以外
                    store_express_range        = companyWebsiteConfig.StoreExpressRange,                         //门店自提 多少米以外
                    store_since_discount       = companyWebsiteConfig.StoreSinceDiscount                         //自提优惠
                },
                #endregion

                #region 权限列表配置

                // permission_list = strList

                #endregion

                //is_union_hongware = websiteInfo.IsUnionHongware == 1 ? true : false,//是否绑定宏巍
                //前端无限再跳转到宏巍个人中心,直接返回false
                is_union_hongware = false,

                user_bind_url      = websiteInfo.UserBindUrl,      //用户绑定URL
                address_select_url = websiteInfo.AddressSelectUrl, //用户收货地址URL
                hongwei_orgcode    = GetOrgCode(websiteInfo),
                wx_appid           = websiteInfo.WeixinAppId,
                is_claim_mall_order_arrival_time = websiteInfo.IsClaimMallOrderArrivalTime,
                has_wx_pay  = bllPay.IsWeixinPay(),
                has_ali_pay = bllPay.IsAliPay(),
                has_jd_pay  = bllPay.IsJDPay(),
                mall_order_pay_success_url = websiteInfo.MallOrderPaySuccessUrl,
                login_page_config          = websiteInfo.LoginPageConfig,
                is_disable_kefu            = companyWebsiteConfig.IsDisableKefu,
                kefu_url   = !string.IsNullOrEmpty(companyWebsiteConfig.KefuUrl)?companyWebsiteConfig.KefuUrl:"",
                kefu_image = !string.IsNullOrEmpty(companyWebsiteConfig.KefuImage) ? companyWebsiteConfig.KefuImage : ""
            };
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
        }
Esempio n. 27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            UserInfo curUser = bllUser.GetCurrentUserInfo();

            if (curUser != null)
            {
                //this.Response.Redirect("/Error/CommonMsg.aspx?msg=" + HttpUtility.UrlEncode("本功能仅供新用户使用"));
                this.Response.Redirect("/customize/comeoncloud/Index.aspx?key=MallHome");
                return;
            }
            curUser = new UserInfo();
            CompanyWebsite_Config nWebsiteConfig = bllWebSite.GetCompanyWebsiteConfig();

            memberStandardDescription = nWebsiteConfig.MemberStandardDescription;
            pageName = "会员注册";

            List <TableFieldMapping> listFieldList = bllTableFieldMap.GetTableFieldMapByWebsite(bllTableFieldMap.WebsiteOwner, "ZCJ_UserInfo", null, null, "0", null);
            List <string>            DefFields     = new List <string>()
            {
                "AutoID", "UserID", "Password", "UserType", "TrueName", "Phone", "Avatar"
            };

            #region 照片
            TableFieldMapping AvatarField = listFieldList.FirstOrDefault(p => p.Field.Equals("Avatar"));
            if (AvatarField != null)
            {
                //curUser.IsPhoneVerify
                formField.Add(new TableFieldMapping()
                {
                    Field = "Avatar", MappingName = AvatarField.MappingName, FieldType = AvatarField.FieldType, Disabled = 0, Value = curUser.Avatar, FieldIsNull = AvatarField.FieldIsNull
                });
            }
            #endregion
            #region 姓名
            TableFieldMapping TrueNameField = listFieldList.FirstOrDefault(p => p.Field.Equals("TrueName"));
            if (TrueNameField == null)
            {
                formField.Add(new TableFieldMapping()
                {
                    Field = "TrueName", MappingName = "姓名", Disabled = 0, Value = curUser.TrueName, FieldIsNull = 1
                });
            }
            else
            {
                formField.Add(new TableFieldMapping()
                {
                    Field = "TrueName", MappingName = TrueNameField.MappingName, Disabled = 0, Value = curUser.TrueName, FieldIsNull = TrueNameField.FieldIsNull
                });
            }
            #endregion
            #region 手机
            TableFieldMapping PhoneField = listFieldList.FirstOrDefault(p => p.Field.Equals("Phone"));
            if (PhoneField == null)
            {
                //curUser.IsPhoneVerify
                formField.Add(new TableFieldMapping()
                {
                    Field = "Phone", MappingName = "手机", Disabled = 0, Value = curUser.Phone, FieldIsNull = 1
                });
            }
            else
            {
                formField.Add(new TableFieldMapping()
                {
                    Field = "Phone", MappingName = PhoneField.MappingName, Disabled = 0, Value = curUser.Phone, FieldIsNull = PhoneField.FieldIsNull
                });
            }
            #endregion
            JObject          jtCurUser     = JObject.FromObject(curUser);
            List <JProperty> listPropertys = jtCurUser.Properties().ToList();
            foreach (var item in listFieldList.Where(p => !DefFields.Contains(p.Field)).OrderBy(p => p.Sort))
            {
                if (!listPropertys.Exists(p => p.Name.Equals(item.Field)))
                {
                    continue;
                }
                formField.Add(new TableFieldMapping()
                {
                    Field = item.Field, MappingName = item.MappingName, FieldType = item.FieldType, Disabled = 0, Value = jtCurUser[item.Field].ToString(), FieldIsNull = item.FieldIsNull
                });
            }

            //头部图标引用
            ico_css_file = bllWebSite.GetIcoFilePath();
        }
Esempio n. 28
0
        public void ProcessRequest(HttpContext context)
        {
            string   id              = context.Request["id"];
            string   Phone           = context.Request["Phone"];
            UserInfo CurrentUserInfo = bllUser.GetCurrentUserInfo();

            #region 检查是否已登录
            if (CurrentUserInfo != null)
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "本功能仅供新用户使用";
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            #endregion
            #region 检查是否微信服务号
            if (context.Session["currWXOpenId"] == null)
            {
                apiResp.code = (int)APIErrCode.UserIsNotLogin;
                apiResp.msg  = "本功能仅供微信服务号使用";
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            #endregion
            string wxOpenId = context.Session["currWXOpenId"].ToString();
            CurrentUserInfo = bllUser.GetUserInfoByOpenId(wxOpenId);
            if (CurrentUserInfo != null)
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "OpenId已被绑定";
                bllUser.ContextResponse(context, apiResp);
                return;
            }

            #region 判断手机格式
            if (!MyRegex.PhoneNumLogicJudge(Phone))
            {
                apiResp.code = (int)APIErrCode.PhoneFormatError;
                apiResp.msg  = "手机格式错误";
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            #endregion
            #region 判断手机是否已被使用
            UserInfo model = bllUser.GetUserInfoByPhone(Phone);
            if (model != null)
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "手机号码已被其他账号使用,请联系管理员";
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            #endregion
            CurrentUserInfo = bllUser.GetUserInfoByAutoID(Convert.ToInt32(id), bllUser.WebsiteOwner);
            if (CurrentUserInfo == null)
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "绑定账号未找到";
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            if (!string.IsNullOrWhiteSpace(CurrentUserInfo.WXOpenId) && CurrentUserInfo.WXOpenId != wxOpenId)
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "账号已有其他微信绑定";
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            List <string> pmsString = new List <string>();

            pmsString.Add(string.Format("Phone='{0}'", Phone));
            pmsString.Add(string.Format("WXOpenId='{0}'", wxOpenId));
            pmsString.Add(string.Format("IsPhoneVerify='{0}'", 1));
            CompanyWebsite_Config nWebsiteConfig = bllWebSite.GetCompanyWebsiteConfig();
            if (nWebsiteConfig.MemberStandard == 3)
            {
                pmsString.Add(string.Format("MemberApplyStatus='{0}'", 1));
                pmsString.Add(string.Format("MemberApplyTime='{0}'", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
            }
            else
            {
                if (CurrentUserInfo.AccessLevel < 1)
                {
                    CurrentUserInfo.AccessLevel     = 1;
                    CurrentUserInfo.MemberStartTime = DateTime.Now;
                }
                pmsString.Add(string.Format("AccessLevel='{0}'", CurrentUserInfo.AccessLevel));
                pmsString.Add(string.Format("MemberStartTime='{0}'", CurrentUserInfo.MemberStartTime.ToString("yyyy-MM-dd HH:mm:ss")));
                //CurrentUserInfo.MemberApplyStatus = 9;
            }

            if (bllUser.Update(new UserInfo(),
                               ZentCloud.Common.MyStringHelper.ListToStr(pmsString, "", ","),
                               string.Format("AutoID={0}", CurrentUserInfo.AutoID.ToString())) > 0)
            {
                apiResp.status = true;
                apiResp.code   = (int)APIErrCode.IsSuccess;
                apiResp.msg    = "提交完成";

                context.Session[ZentCloud.Common.SessionKey.UserID]     = CurrentUserInfo.UserID;
                context.Session[ZentCloud.Common.SessionKey.LoginStatu] = 1; //设置登录状态
            }
            else
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "提交失败";
            }
            bllUser.ContextResponse(context, apiResp);
        }
Esempio n. 29
0
        //        public static string GetMemberUID()
        //        {
        //            return GetZCUID("MemberUID");
        //        }

        //        public string GetGUID()
        //        {
        //            return GetZCUID("GUID");
        //        }

        //        protected string GetZCUID(string colName)
        //        {
        //            string strSql = string.Format(@"update ZCUID set {0} = {0} + 1
        //                             select {0} from ZCUID", colName);
        //            BLLTransaction tran = new BLLTransaction();
        //            DataSet ds = ZCDALEngine.DALEngine.Query(strSql);
        //            tran.Commit();
        //            return ds.Tables[0].Rows[0][colName].ToString();
        //        }

        //public static string GetName(string mobile, string userID)
        //{
        //    object name = GetSingle("ZCJ_MemberInfo", "Name", string.Format("Mobile = '{0}' and UserID = '{1}'", mobile, userID));
        //    return name == null ? "" : name.ToString();
        //}

        //public static List<Model.MemberInfo> GetMemberListFromExcel(string fullName, string sheetName, string ownerid)
        //{
        //    DataSet ds = Common.OfficeDataOp.ExcelToDataSet(fullName, sheetName);
        //    List<Model.MemberInfo> memberList = new List<Model.MemberInfo>();
        //    for (int i = 0; i < ds.Tables[0].Rows.Count; i++ )
        //    {
        //        Model.MemberInfo member = new Model.MemberInfo();
        //        Type t = member.GetType();
        //        PropertyInfo[] properties = t.GetProperties();
        //        foreach (PropertyInfo p in properties)
        //        {
        //            if (ModelAttrToExcelColumns.ContainsKey(p.Name) && ds.Tables[0].Columns.Contains(ModelAttrToExcelColumns[p.Name]))
        //            {
        //                //Convert.ChangeType(ds.Tables[0].Rows[i][ModelAttrToExcelColumns[p.Name]].ToString(),p.PropertyType)
        //                p.SetValue(member, ds.Tables[0].Rows[i][ModelAttrToExcelColumns[p.Name]].ToString(), null);
        //            }
        //        }
        //        if (member.Mobile != null && member.Mobile.Trim() != string.Empty)
        //        {
        //            member.MemberId = GetMemberUID();
        //            member.OwnerId = ownerid;
        //            memberList.Add(member);
        //        }

        //    }
        //    return memberList;
        //}

        ///// <summary>
        ///// 检查用户是否拥有指定客户分组权限
        ///// </summary>
        ///// <param name="groupID"></param>
        ///// <param name="userID"></param>
        ///// <returns></returns>
        //public bool CheckGroupIDAndUser(string groupID, string userID)
        //{

        //    if (string.IsNullOrWhiteSpace(groupID))
        //        return false;

        //    if (groupID != "0")
        //    {
        //        if (GetCount<Model.MemberGroupInfo>(string.Format(" GroupID = '{0}' AND UserID = '{1}'", groupID, userID)) < 1)
        //        {
        //            return false;
        //        }
        //    }

        //    return true;
        //}

        //public List<Model.MemberInfo> GetMemberListFromExcel(string fullName, string userID)
        //{
        //    List<Model.MemberInfo> memberList = new List<Model.MemberInfo>();

        //    try
        //    {
        //        List<DataSet> dsList = Common.OfficeDataOp.ExcelToDataSetList(fullName);
        //        foreach (DataSet ds in dsList)
        //        {
        //            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        //            {
        //                bool tmpInsert = false;
        //                Model.MemberInfo member = new Model.MemberInfo();
        //                Type t = member.GetType();
        //                PropertyInfo[] properties = t.GetProperties();
        //                foreach (PropertyInfo p in properties)
        //                {
        //                    if (ModelAttrToExcelColumns.ContainsKey(p.Name) && ds.Tables[0].Columns.Contains(ModelAttrToExcelColumns[p.Name]))
        //                    {
        //                        //Convert.ChangeType(ds.Tables[0].Rows[i][ModelAttrToExcelColumns[p.Name]].ToString(),p.PropertyType)
        //                        string strValue = ds.Tables[0].Rows[i][ModelAttrToExcelColumns[p.Name]].ToString();
        //                        if (string.IsNullOrWhiteSpace(strValue))
        //                            continue;
        //                        strValue = strValue.Trim();
        //                        p.SetValue(member, strValue, null);
        //                        if (!tmpInsert)
        //                            tmpInsert = true;
        //                    }

        //                    //if (member.Mobile != null && member.Mobile.Trim() != string.Empty)
        //                    //{
        //                    //    string tmp = ds.Tables[0].Rows[i][2].ToString();
        //                    //    if (tmp != "")
        //                    //    {

        //                    //    }
        //                    //}
        //                }

        //                //if (member.Mobile != null && member.Mobile.Trim() != string.Empty)
        //                //{
        //                //    member.MemberID = GetGUID(TransacType.MemberAdd);
        //                //    member.UserID = userID;
        //                //    memberList.Add(member);
        //                //}

        //                if (tmpInsert)
        //                {
        //                    //member.MemberID = GetGUID(TransacType.MemberAdd);

        //                    try
        //                    {
        //                        member.Mobile = Common.StringHelper.RemoveSpace(member.Mobile);
        //                        member.Email = Common.StringHelper.RemoveSpace(member.Email);

        //                        member.UserID = userID;
        //                        memberList.Add(member);
        //                    }
        //                    catch (Exception ex)
        //                    {

        //                        throw ex;
        //                    }
        //                }

        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {

        //        throw ex;
        //    }

        //    return memberList;
        //}


        //public int ImportMemberList(List<ZentCloud.BLLJIMP.Model.MemberInfo> list, string userID, string groupID)
        //{
        //    int result = 0;
        //    try
        //    {
        //        if (list.Count.Equals(0))
        //            return result;

        //        string basePath = @"\\192.168.1.143\BulkFiles";

        //        string connstr = Common.ConfigHelper.GetConfigString("ConnectionString");

        //        //构造文件内容存入临时文件
        //        string tmpFileName = Guid.NewGuid().ToString() + ".txt";
        //        string tmpFilePath = string.Format("{0}\\{1}", basePath, tmpFileName);

        //        StringBuilder strContent = new StringBuilder();
        //        strContent.Append("Name,Sex,Mobile,Email,QQ,Tel,Company,Title,WeiboID,WeiboScreenName, Address,MemberID,Mobile2,Mobile3,Email2,Email3\n");
        //        foreach (ZentCloud.BLLJIMP.Model.MemberInfo item in list)
        //        {
        //            strContent.AppendFormat("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15}\n",
        //                    item.Name != null ? item.Name.Replace(",", ",") : "",
        //                    item.Sex != null ? item.Sex.Replace(",", ",") : "",
        //                    item.Mobile != null ? item.Mobile.Replace(",", ",") : "",
        //                    item.Email != null ? item.Email.Replace(",", ",") : "",
        //                    item.QQ != null ? item.QQ.Replace(",", ",") : "",
        //                    item.Tel != null ? item.Tel.Replace(",", ",") : "",
        //                    item.Company != null ? item.Company.Replace(",", ",") : "",
        //                    item.Title != null ? item.Title.Replace(",", ",") : "",
        //                    item.WeiboID != null ? item.WeiboID.Replace(",", ",") : "",
        //                    item.WeiboScreenName != null ? item.WeiboScreenName.Replace(",", ",") : "",
        //                    item.Address != null ? item.Address.Replace(",", ",") : "",
        //                    GetGUID(TransacType.MemberAdd),//item.MemberID
        //                    item.Mobile2 != null ? item.Mobile2.Replace(",", ",") : "",
        //                    item.Mobile3 != null ? item.Mobile3.Replace(",", ",") : "",
        //                    item.Email2 != null ? item.Email2.Replace(",", ",") : "",
        //                    item.Email3 != null ? item.Email3.Replace(",", ",") : ""
        //                );
        //        }

        //        using (StreamWriter sw = new StreamWriter(tmpFilePath, false, Encoding.GetEncoding("gb2312")))
        //        {
        //            sw.Write(strContent.ToString());
        //        }

        //        //导入数据
        //        Common.ImportDataHelper impHelper = new Common.ImportDataHelper();

        //        result = impHelper.BulkImport(
        //            connstr,
        //            @"C:\BulkFiles\" + tmpFileName,
        //            @"C:\BulkFiles\MemberFormat.xml",
        //            "ZCJ_MemberInfo",
        //            " MemberID,Name,Sex,Mobile,Email,QQ,Tel,Company,Title,WeiboID,WeiboScreenName, Address,MemberType,UserID,GroupID,Mobile2,Mobile3,Email2,Email3",
        //            string.Format("MemberID,Name,Sex,Mobile,Email,QQ,Tel,Company,Title,WeiboID,WeiboScreenName, Address,0,'{0}','{1}',Mobile2,Mobile3,Email2,Email3", userID, groupID),
        //            "",
        //            80000,
        //            2
        //            );

        //        //清除临时文件
        //        if (File.Exists(tmpFilePath))
        //            File.Delete(tmpFilePath);
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }
        //    return result;
        //}

        ///// <summary>
        ///// 根据会员集合创建datatable
        ///// </summary>
        ///// <param name="list"></param>
        ///// <returns></returns>
        //public DataTable CreateMemberDataTableByList(List<ZentCloud.BLLJIMP.Model.MemberInfo> list)
        //{
        //    DataTable dt = new DataTable();

        //    foreach (var item in ModelAttrToExcelColumns)
        //    {
        //        dt.Columns.Add(item.Value);
        //    }

        //    foreach (var i in list)
        //    {
        //        DataRow dr = dt.NewRow();
        //        foreach (var j in i.GetType().GetProperties())//利用反射赋值
        //        {
        //            object value = j.GetValue(i, null);
        //            if (ModelAttrToExcelColumns.Keys.Contains(j.Name))
        //            {
        //                dr[ModelAttrToExcelColumns[j.Name]] = value;
        //            }
        //        }
        //        dt.Rows.Add(dr);
        //    }

        //    return dt;
        //}

        //public static Dictionary<string, string> ModelAttrToExcelColumns = new Dictionary<string, string>()
        //{
        //    {"Name","姓名"},
        //    {"Sex","性别"},
        //    {"Mobile","手机"},
        //    {"Email","电子邮件"},
        //    {"QQ","QQ"},
        //    {"Tel","电话"},
        //    {"Company","公司"},
        //    {"Title","职务"},
        //    {"WeiboID","微博ID"},
        //    {"WeiboScreenName","微博昵称"},
        //    {"Address","地址"},
        //    {"Email2","电子邮件2"},
        //    {"Email3","电子邮件3"},
        //    {"Mobile2","手机2"},
        //    {"Mobile3","手机3"}
        //};

        public string GetMemberWhere(string websiteOwner, string keyWord, string tagName, string haveTrueName,
                                     string haveWxNickNameAndTrueName, string isFans, string isReg, string isDisOnLineUser, string isDisOffLineUser, string isPhoneReg, string isName,
                                     string isPhone, string isEmail, string isWxnickName, string isMember, string userAutoId, string isOrAnd, string userType = "",
                                     string noDistributionOwner = "", string isApp = "")
        {
            StringBuilder sbWhere = new StringBuilder();

            sbWhere.AppendFormat("WebsiteOwner = '{0}' And UserId !='{0}' And ISNULL(PermissionGroupID,'') = ''  ", websiteOwner);

            if (!string.IsNullOrEmpty(userAutoId))//用户自动编号
            {
                sbWhere.AppendFormat(" And AutoId={0} ", userAutoId);
            }
            if (!string.IsNullOrEmpty(userType))
            {
                sbWhere.AppendFormat(" And UserType={0} ", userType);
            }
            if (!string.IsNullOrEmpty(noDistributionOwner) && noDistributionOwner == "1")//查出不是分销员
            {
                sbWhere.AppendFormat(" AND MemberLevel=0 ");
            }
            if (!string.IsNullOrEmpty(keyWord))
            {
                //sbWhere.AppendFormat("And ( UserID  like'%{0}%' ", keyWord);
                sbWhere.AppendFormat("And ( ");
                sbWhere.AppendFormat(" TrueName  like'{0}%' ", keyWord);
                sbWhere.AppendFormat(" OR Company  like'{0}%' ", keyWord);
                //sbWhere.AppendFormat("OR Postion  like'{0}%' ", keyWord);
                sbWhere.AppendFormat(" OR Phone  like'{0}%' ", keyWord);
                sbWhere.AppendFormat(" OR WXOpenId  ='{0}' ", keyWord);
                int tmpAutoId = 0;
                if (int.TryParse(keyWord, out tmpAutoId))
                {
                    sbWhere.AppendFormat(" OR AutoId  = {0} ", tmpAutoId);
                }

                if (keyWord.Contains(","))//逗号分隔
                {
                    foreach (var item in keyWord.Split(','))
                    {
                        sbWhere.AppendFormat(" OR WXProvince  like'{0}%' ", item);
                        sbWhere.AppendFormat(" OR WXCity  like'{0}%' ", item);
                        sbWhere.AppendFormat(" OR TrueName  like'{0}%' ", item);
                    }
                }
                else
                {
                    sbWhere.AppendFormat(" OR WXProvince  like'{0}%' ", keyWord);
                    sbWhere.AppendFormat(" OR WXCity  like'{0}%' ", keyWord);
                }
                sbWhere.AppendFormat("OR WXNickName  like'%{0}%' )", keyWord);
                //sbWhere.AppendFormat("OR Email  like'{0}%' )", keyWord);
            }

            #region 标签搜索
            if (!string.IsNullOrEmpty(tagName))
            {
                List <string> tagNameArray = tagName.Split(',').Where(p => !string.IsNullOrWhiteSpace(p)).ToList();
                sbWhere.AppendFormat(" AND( ");
                for (int i = 0; i < tagNameArray.Count; i++)
                {
                    if (i == 0)
                    {
                        sbWhere.AppendFormat(" TagName like '%{0}%' ", tagNameArray[i]);
                    }
                    else
                    {
                        sbWhere.AppendFormat(" OR TagName like '%{0}%' ", tagNameArray[i]);
                    }
                }
                sbWhere.AppendFormat(") ");
            }
            #endregion



            StringBuilder advancedQuery = new StringBuilder();

            string advancedQueryOrAnd = isOrAnd == "1" ? "AND" : "OR";



            #region 高级筛选
            if (isOrAnd == "1")
            {
                #region AND查询

                if (!string.IsNullOrEmpty(haveTrueName))
                {
                    advancedQuery.AppendFormat(" {0} TrueName > ''", advancedQueryOrAnd);
                }

                //if (!string.IsNullOrEmpty(isDisOffLineUser))//业务分销会员
                //{
                //    advancedQuery.AppendFormat(" {0} DistributionOffLinePreUserId > ''", advancedQueryOrAnd);
                //}

                if (!string.IsNullOrEmpty(isDisOnLineUser))//商城分销会员
                {
                    advancedQuery.AppendFormat(" {0} DistributionOwner > ''", advancedQueryOrAnd);
                }
                if (!string.IsNullOrEmpty(isFans))//粉丝
                {
                    advancedQuery.AppendFormat(" {0} IsWeixinFollower={1} ", advancedQueryOrAnd, isFans);
                }
                if (!string.IsNullOrEmpty(isReg))//注册会员
                {
                    advancedQuery.AppendFormat(" {0} (TrueName>'' or WXNickname>'')", advancedQueryOrAnd);
                }
                if (!string.IsNullOrEmpty(isPhoneReg))//是否手机认证会员
                {
                    advancedQuery.AppendFormat(" {0} (Phone > '' And IsPhoneVerify=1)", advancedQueryOrAnd);
                }
                if (!string.IsNullOrEmpty(isName))//姓名
                {
                    advancedQuery.AppendFormat(" {0} TrueName>''  ", advancedQueryOrAnd);
                }
                if (!string.IsNullOrEmpty(isPhone))//手机
                {
                    advancedQuery.AppendFormat(" {0} Phone>'' ", advancedQueryOrAnd);
                }
                if (!string.IsNullOrEmpty(isEmail))//邮箱
                {
                    advancedQuery.AppendFormat(" {0} Email>'' ", advancedQueryOrAnd);
                }
                if (!string.IsNullOrEmpty(isWxnickName))//昵称
                {
                    advancedQuery.AppendFormat(" {0} WxnickName>'' ", advancedQueryOrAnd);
                }

                if (!string.IsNullOrEmpty(haveWxNickNameAndTrueName))
                {
                    advancedQuery.AppendFormat(" AND TrueName > '' And WXNickname > ''");
                }
                if (!string.IsNullOrEmpty(isMember))//昵称
                {
                    CompanyWebsite_Config nWebsiteConfig = GetByKey <CompanyWebsite_Config>("WebsiteOwner", websiteOwner);
                    int    memberStandard       = nWebsiteConfig == null ? 0 : nWebsiteConfig.MemberStandard;
                    string memberStandardFields = "";
                    if (memberStandard == 2 || memberStandard == 3)
                    {
                        List <TableFieldMapping> listFieldList = bllTableFieldMap.GetTableFieldMap(bllTableFieldMap.WebsiteOwner, "ZCJ_UserInfo");
                        if (listFieldList.Count > 0)
                        {
                            memberStandardFields = ZentCloud.Common.MyStringHelper.ListToStr(listFieldList.Select(p => p.Field).ToList(), "", ",");
                        }
                    }
                    List <string> memberStandardFieldList = new List <string>();
                    if (!string.IsNullOrWhiteSpace(memberStandardFields))
                    {
                        memberStandardFieldList = memberStandardFields.Split(',').Where(p => p.Trim().Equals("")).ToList();
                    }

                    StringBuilder strIsMember = new StringBuilder();

                    if (memberStandard == 1)
                    {
                        strIsMember.AppendFormat(" AND Phone > '' ");
                        strIsMember.AppendFormat(" AND IsPhoneVerify = 1 ");
                    }
                    else if (memberStandard == 2 || memberStandard == 3)
                    {
                        strIsMember.AppendFormat(" AND IsPhoneVerify = 1 ");
                        if (memberStandard == 3)
                        {
                            strIsMember.AppendFormat(" AND MemberApplyStatus = 9 ");
                        }

                        foreach (string field in memberStandardFieldList)
                        {
                            strIsMember.AppendFormat(" AND {0} > '' ", field);
                        }
                    }
                    strIsMember.AppendFormat(" And AccessLevel>0 ");

                    if (strIsMember.Length > 0)
                    {
                        advancedQuery.AppendFormat(" {0} (** ", advancedQueryOrAnd);
                        advancedQuery.Append(strIsMember.ToString().TrimStart());
                        advancedQuery.Append(" )");
                    }
                }
                if (!string.IsNullOrWhiteSpace(isApp))
                {
                    advancedQuery.AppendFormat(" {0} EXISTS (SELECT 1 FROM [ZCJ_AppPushClient] WHERE UserID=[ZCJ_UserInfo].UserID AND WebsiteOwner='{1}') ",
                                               advancedQueryOrAnd, websiteOwner);
                }
                if (advancedQuery.Length > 0)
                {
                    sbWhere.Append(" And (** ");
                    sbWhere.Append(advancedQuery.ToString().TrimStart());
                    sbWhere.Append(" )");
                }
                #endregion
            }
            else
            {
                //or查询

                //有姓名  注册会员
                if (!string.IsNullOrEmpty(haveTrueName) || !string.IsNullOrEmpty(isReg) || !string.IsNullOrEmpty(isName))
                {
                    advancedQuery.AppendFormat(" UNION SELECT AutoId  FROM [ZCJ_UserInfo]  WHERE  [TrueName] > '' And WebsiteOwner='{0}' ", websiteOwner);
                }

                //昵称
                if (!string.IsNullOrEmpty(isWxnickName))
                {
                    advancedQuery.AppendFormat(" UNION SELECT AutoId  FROM [ZCJ_UserInfo]  WHERE  [WxnickName] > '' And WebsiteOwner='{0}' ", websiteOwner);
                }

                //if (!string.IsNullOrEmpty(haveWxNickNameAndTrueName))
                //{
                //    advancedQuery.AppendFormat(" AND TrueName > '' And WXNickname > ''");
                //}

                //商城分销会员
                if (!string.IsNullOrEmpty(isDisOnLineUser))
                {
                    advancedQuery.AppendFormat(" UNION SELECT AutoId  FROM [ZCJ_UserInfo]  WHERE  [DistributionOwner] > '' And WebsiteOwner='{0}' ", websiteOwner);
                }


                if (!string.IsNullOrEmpty(isFans) && isFans == "1")//粉丝
                {
                    advancedQuery.AppendFormat(" UNION SELECT AutoId  FROM [ZCJ_UserInfo]  WHERE  [IsWeixinFollower] = 1  And WebsiteOwner='{0}' ", websiteOwner);
                }

                if (!string.IsNullOrEmpty(isPhoneReg))//是否手机认证会员
                {
                    advancedQuery.AppendFormat(" UNION SELECT AutoId  FROM [ZCJ_UserInfo]  WHERE  [Phone] > '' And [IsPhoneVerify] = 1  And WebsiteOwner='{0}' ", websiteOwner);
                }

                if (!string.IsNullOrEmpty(isPhone))//手机
                {
                    advancedQuery.AppendFormat(" UNION SELECT AutoId  FROM [ZCJ_UserInfo]  WHERE  [Phone] > ''  And WebsiteOwner='{0}' ", websiteOwner);
                }

                if (!string.IsNullOrEmpty(isEmail))//邮箱
                {
                    advancedQuery.AppendFormat(" UNION SELECT AutoId  FROM [ZCJ_UserInfo]  WHERE  [Email] > ''  And WebsiteOwner='{0}' ", websiteOwner);
                }

                if (!string.IsNullOrEmpty(isMember))//昵称
                {
                    CompanyWebsite_Config nWebsiteConfig = GetByKey <CompanyWebsite_Config>("WebsiteOwner", websiteOwner);
                    int    memberStandard       = nWebsiteConfig == null ? 0 : nWebsiteConfig.MemberStandard;
                    string memberStandardFields = "";
                    if (memberStandard == 2 || memberStandard == 3)
                    {
                        List <TableFieldMapping> listFieldList = bllTableFieldMap.GetTableFieldMap(bllTableFieldMap.WebsiteOwner, "ZCJ_UserInfo");
                        if (listFieldList.Count > 0)
                        {
                            memberStandardFields = ZentCloud.Common.MyStringHelper.ListToStr(listFieldList.Select(p => p.Field).ToList(), "", ",");
                        }
                    }
                    List <string> memberStandardFieldList = new List <string>();
                    if (!string.IsNullOrWhiteSpace(memberStandardFields))
                    {
                        memberStandardFieldList = memberStandardFields.Split(',').Where(p => p.Trim().Equals("")).ToList();
                    }

                    StringBuilder strIsMember = new StringBuilder();

                    if (memberStandard == 1)
                    {
                        strIsMember.AppendFormat(" AND Phone > '' ");
                        strIsMember.AppendFormat(" AND IsPhoneVerify = 1 ");
                    }
                    else if (memberStandard == 2 || memberStandard == 3)
                    {
                        strIsMember.AppendFormat(" AND IsPhoneVerify = 1 ");
                        if (memberStandard == 3)
                        {
                            strIsMember.AppendFormat(" AND MemberApplyStatus = 9 ");
                        }

                        foreach (string field in memberStandardFieldList)
                        {
                            strIsMember.AppendFormat(" AND {0} > '' ", field);
                        }
                    }
                    strIsMember.AppendFormat(" And AccessLevel>0 ");

                    if (strIsMember.Length > 0)
                    {
                        advancedQuery.AppendFormat(" UNION SELECT AutoId  FROM [ZCJ_UserInfo]  WHERE  WebsiteOwner='{1}' {0} ",
                                                   strIsMember.ToString(), websiteOwner);
                    }
                }
                if (!string.IsNullOrEmpty(isApp))//有登录App
                {
                    advancedQuery.AppendFormat(" UNION SELECT AutoId  FROM [ZCJ_UserInfo]  WHERE WebsiteOwner='{0}' And EXISTS (SELECT 1 FROM [ZCJ_AppPushClient] WHERE UserID=[ZCJ_UserInfo].UserID AND WebsiteOwner='{0}') ", websiteOwner);
                }
                if (advancedQuery.Length > 0)
                {
                    sbWhere.AppendFormat(" AND AutoId IN ( {0} ) ", advancedQuery.ToString().Substring(6));
                }
            }
            #endregion

            string result = sbWhere.ToString().ToUpper();

            result = result.Replace("  ", " ").Replace("(** AND", " ( ").Replace("(** OR", " ( ");

            return(result);
        }
Esempio n. 30
0
        /// <summary>
        /// 获取商城所有配置
        /// </summary>
        /// <returns></returns>
        public string GetMallConfigList()
        {
            var                   sourceList     = GetList <KeyVauleDataInfo>(string.Format(" WebsiteOwner='{0}' And DataType='MallConfig'", WebsiteOwner));
            WebsiteInfo           websiteInfo    = GetWebsiteInfoModelFromDataBase();
            CompanyWebsite_Config nWebsiteConfig = Get <CompanyWebsite_Config>(string.Format("WebsiteOwner='{0}'", WebsiteOwner));
            var                   apply_url      = "/App/Member/Wap/PhoneVerify.aspx?referrer=" + System.Web.HttpUtility.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString());

            if (nWebsiteConfig != null && (nWebsiteConfig.MemberStandard == 2 || nWebsiteConfig.MemberStandard == 3))
            {
                apply_url = "/App/Member/Wap/CompleteUserInfo.aspx?referrer=" + System.Web.HttpUtility.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString());
            }
            UserInfo curUser = GetCurrentUserInfo();

            if (nWebsiteConfig == null)
            {
                nWebsiteConfig = new CompanyWebsite_Config();
            }
            var shopConfig = new
            {
                mall_name            = nWebsiteConfig.WebsiteTitle,
                mall_desc            = nWebsiteConfig.WebsiteDescription,
                mall_logo            = nWebsiteConfig.WebsiteImage,
                product_img_ratio1   = string.IsNullOrWhiteSpace(websiteInfo.ProductImgRatio1)? "600": websiteInfo.ProductImgRatio1,
                product_img_ratio2   = string.IsNullOrWhiteSpace(websiteInfo.ProductImgRatio2)? "600": websiteInfo.ProductImgRatio2,
                nav_group_name       = websiteInfo.ShopNavGroupName,
                foottool             = websiteInfo.ShopFoottool,
                slide_name           = websiteInfo.ShopAdType,
                is_login             = curUser != null ? true : false,
                is_show_oldprice     = websiteInfo.IsShowOldPrice == 1? true : false,
                is_show_stock        = websiteInfo.IsShowStock == 1 ? true : false,
                is_member            = IsMember(),
                access_level         = curUser != null?curUser.AccessLevel:0,
                apply_url            = apply_url,
                nopms_url            = "/Error/NoPmsMobile.htm",
                website_version      = new BLLWebSite().GetWebsiteVersion(WebsiteOwner),
                my_cardcoupons_title = nWebsiteConfig.MyCardCouponsTitle,
                mall_desc_top        = websiteInfo.MallDescTop,
                mall_desc_bottom     = websiteInfo.MallDescBottom
            };

            JObject config = new JObject();

            if (sourceList.Count > 0)
            {
                try
                {
                    config["mallconfig"] = JObject.Parse(sourceList[0].DataValue);
                }
                catch (Exception)
                {
                }
            }

            JObject mallConfig = JObject.FromObject(shopConfig);

            config["mallconfignew"] = mallConfig;
            return(config.ToString());

            //var list = from p in sourceList
            //           select new
            //           {

            //               key = p.DataKey,
            //               value = p.DataValue
            //           };
            //return list;
        }