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

            //头部图标引用
            ico_css_file = bllWebSite.GetIcoFilePath();
        }
Example #2
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();
        }
Example #3
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";
            }
        }
Example #4
0
        private void GetWebsiteConfig()
        {
            CompanyWebsite_Config config = bllWeisite.GetCompanyWebsiteConfig();

            if (config != null && !string.IsNullOrEmpty(config.WeiXinBindDomain))
            {
                strDomain = config.WeiXinBindDomain;
            }
            else
            {
                strDomain = Request.Url.Authority;
            }
        }
Example #5
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 = "[]";
            }
        }
Example #6
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();
        }
Example #7
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);
        }
Example #8
0
        public void ProcessRequest(HttpContext context)
        {
            int page = Convert.ToInt32(context.Request["page"]);
            int rows = Convert.ToInt32(context.Request["rows"]);

            if (page == 0)
            {
                page = 1;
            }
            if (rows == 0)
            {
                rows = 10;
            }
            string keyword       = context.Request["keyword"];
            string cate_id       = context.Request["cate_id"];
            bool   show_hide     = Convert.ToBoolean(context.Request["show_hide"]);
            string tags          = context.Request["tags"];
            string k1            = context.Request["k1"];
            string k4            = context.Request["k4"];
            string k5            = context.Request["k5"];
            string longitude     = context.Request["longitude"];
            string latitude      = context.Request["latitude"];
            int    range         = Convert.ToInt32(context.Request["range"]);
            int    limitRange    = Convert.ToInt32(context.Request["limit_range"]);
            string city          = context.Request["city"];//城市
            var    companyConfig = bllComopanyConfig.GetCompanyWebsiteConfig();

            if (!string.IsNullOrEmpty(companyConfig.OutletsSearchRange))
            {
                range = Convert.ToInt32(companyConfig.OutletsSearchRange);
                k5    = "1";
            }
            if (limitRange == 0)//不限制搜索范围
            {
                range = int.MaxValue;
            }
            if (cate_id == "0")
            {
                cate_id = "";
            }
            if (longitude == "0")
            {
                longitude = "";
            }
            if (latitude == "0")
            {
                latitude = "";
            }

            int total = 0;
            List <JuActivityInfo> dataList = bllJuActivity.GetOutletsList(rows, page, cate_id, tags, keyword, show_hide,
                                                                          "JuActivityID,ActivityName,ActivityAddress,ThumbnailsPath,Sort,K4,K5,UserLongitude,UserLatitude,Province,City,District", out total,
                                                                          longitude, latitude, range, "range", bllJuActivity.WebsiteOwner, k1, k4, k5, city);

            var rData = from p in dataList
                        select new
            {
                id               = p.JuActivityID,
                title            = p.ActivityName,
                province         = p.Province,
                city             = p.City,
                district         = p.District,
                address          = p.ActivityAddress,
                img              = p.ThumbnailsPath,
                longitude        = p.UserLongitude,
                latitude         = p.UserLatitude,
                distance         = p.Distance,
                distance_formart = DistanceFormart(p.Distance.ToString()),
                supplier_id      = p.K5
            };

            apiResp.result = new
            {
                totalcount = total,
                list       = rData
            };
            apiResp.status = true;
            apiResp.msg    = "查询完成";
            apiResp.code   = (int)APIErrCode.IsSuccess;
            bllJuActivity.ContextResponse(context, apiResp);
        }
Example #9
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();
        }
Example #10
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);
        }
Example #11
0
        public void ProcessRequest(HttpContext context)
        {
            string code  = context.Request["code"];
            string Phone = context.Request["Phone"];

            string wxOpenId;

            UserInfo CurrentUserInfo = bllUser.GetCurrentUserInfo();

            #region 判断手机格式
            if (!MyRegex.PhoneNumLogicJudge(Phone))
            {
                apiResp.code = (int)APIErrCode.PhoneFormatError;
                apiResp.msg  = "手机格式错误";
                bllTableFieldMap.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

            #region 账号检查 未登录时检查已有账号
            if (CurrentUserInfo == null)
            {
                if (context.Session["currWXOpenId"] == null)
                {
                    apiResp.code = (int)APIErrCode.UserIsNotLogin;
                    apiResp.msg  = "请先登录";
                    bllSms.ContextResponse(context, apiResp);
                    return;
                }
                wxOpenId = context.Session["currWXOpenId"].ToString();
                UserInfo curUser = bllUser.GetUserInfoByOpenId(wxOpenId);
                if (curUser != null)
                {
                    apiResp.code = (int)APIErrCode.OperateFail;
                    apiResp.msg  = "微信已绑定有账号";
                    bllSms.ContextResponse(context, apiResp);
                    return;
                }
                curUser = bllUser.GetUserInfoByAllPhone(Phone);
                if (curUser != null)
                {
                    apiResp.code = (int)APIErrCode.OperateFail;
                    apiResp.msg  = "微信已绑定有账号";
                    bllSms.ContextResponse(context, apiResp);
                    return;
                }
            }
            #endregion

            #region 判断手机是否已被使用
            UserInfo model = bllUser.GetUserInfoByPhone(Phone);
            if (model != null)
            {
                if (model.UserID != CurrentUserInfo.UserID)
                {
                    apiResp.code = (int)APIErrCode.OperateFail;
                    apiResp.msg  = "手机号码已被其他账号使用,请联系管理员";
                    bllSms.ContextResponse(context, apiResp);
                    return;
                }
            }
            #endregion

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

            List <TableFieldMapping> listFieldList = bllTableFieldMap.GetTableFieldMapByTableName(bllTableFieldMap.WebsiteOwner, "ZCJ_UserInfo");

            List <string> DefFields = new List <string>()
            {
                "AutoID", "UserID", "Password", "UserType", "TrueName", "Phone"
            };

            #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);
            List <JProperty> listPropertys = jtCurUser.Properties().ToList();
            foreach (var item in listFieldList.Where(p => p.FieldIsNull == 1 && !DefFields.Contains(p.Field)).OrderBy(p => p.Sort))
            {
                if (!listPropertys.Exists(p => p.Name.Equals(item.Field)))
                {
                    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.Update(CurrentUserInfo))
            {
                apiResp.status = true;
                apiResp.code   = (int)APIErrCode.IsSuccess;
                apiResp.msg    = "提交完成";
            }
            else
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "提交失败";
            }
            bllUser.ContextResponse(context, apiResp);
        }
Example #12
0
        public void ProcessRequest(HttpContext context)
        {
            string phone = context.Request["phone"];
            string code  = context.Request["code"];

            #region 判断手机格式
            if (!MyRegex.PhoneNumLogicJudge(phone))
            {
                apiResp.code = (int)APIErrCode.PhoneFormatError;
                apiResp.msg  = "手机格式错误";
                bllSms.ContextResponse(context, apiResp);
                return;
            }
            #endregion
            #region 判断手机是否已被使用,且是否是当前账号
            UserInfo model = bllUser.GetUserInfoByPhone(phone);
            if (model != null)
            {
                if (model.UserID != CurrentUserInfo.UserID)
                {
                    apiResp.code = (int)APIErrCode.OperateFail;
                    apiResp.msg  = "手机号码已被其他账号使用,请联系管理员";
                    bllSms.ContextResponse(context, apiResp);
                    return;
                }
                //if (model.IsPhoneVerify == 1)
                //{
                //    apiResp.code = (int)APIErrCode.OperateFail;
                //    apiResp.msg = "手机号码已验证";
                //    bllSms.ContextResponse(context, apiResp);
                //    return;
                //}
            }
            #endregion
            #region 判断验证码是否正确
            SmsVerificationCode sms = bllSms.GetLastSmsVerificationCode(phone);
            if (sms.VerificationCode != code)
            {
                apiResp.code = (int)APIErrCode.CheckCodeErr;
                apiResp.msg  = "验证码错误";
                bllSms.ContextResponse(context, apiResp);
                return;
            }
            #endregion
            CurrentUserInfo.Phone         = phone;
            CurrentUserInfo.IsPhoneVerify = 1;
            CompanyWebsite_Config nWebsiteConfig = bllWebSite.GetCompanyWebsiteConfig();
            if (nWebsiteConfig.MemberStandard == 1)
            {
                if (CurrentUserInfo.AccessLevel < 1)
                {
                    CurrentUserInfo.AccessLevel     = 1;
                    CurrentUserInfo.MemberStartTime = DateTime.Now;
                }
                //CurrentUserInfo.MemberApplyStatus = 9;
            }
            if (bllUser.Update(CurrentUserInfo))
            {
                apiResp.status = true;
                apiResp.code   = (int)APIErrCode.IsSuccess;
                apiResp.msg    = "手机验证完成";
            }
            else
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "验证失败";
            }
            bllSms.ContextResponse(context, apiResp);
        }