Beispiel #1
0
        private string GetFriend(HttpContext context)
        {
            int    statusCode;
            string username = context.Request["username"] ?? "";
            var    api      = new EaseMobAPIHelper();
            var    data     = api.AccountGetFriend(username, out statusCode);

            return(ResultJson(ResultType.success, "成功", data));
        }
Beispiel #2
0
        /// <summary>
        /// 批量删除IM用户
        ///删除某个 APP 下指定数量的环信账号。可一次删除 N 个用户,数值可以修改。
        ///建议这个数值在100-500之间,不要过大。
        ///需要注意的是,这里只是批量的一次性删除掉 N个用户,具体删除哪些并没有指定,可以在返回值中查看到哪些用户被删除掉了。
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string DelUser(HttpContext context)
        {
            int statusCode;
            int limit = 50;//指定删除数据的最大条数
            //string username = context.Request["username"] ?? "";
            var api  = new EaseMobAPIHelper();
            var data = api.AccountDelUser(limit, out statusCode);

            return(ResultJson(ResultType.success, "成功", data));
        }
Beispiel #3
0
        //解除 IM 用户的好友关系
        //先删除远程的,再删除本地的
        private string DelFriend(HttpContext context)
        {
            string userid          = context.Request["userid"] ?? "";
            string friend_username = context.Request["friend_username"] ?? "";
            string message         = string.Empty;
            string usercode;
            long   IMFriendID = 0;

            if (string.IsNullOrEmpty(userid))
            {
                return(ResultJson(ResultType.error, "要删除好友的用户ID不能为空", ""));
            }
            if (string.IsNullOrEmpty(friend_username))
            {
                return(ResultJson(ResultType.error, "被删除好友的用户名不能为空", ""));
            }

            UserService userSvc = new UserService();

            IMFriendID = userSvc.GetFriendID(userid, friend_username, out usercode, out message);
            if (IMFriendID == 0)
            {
                return(ResultJson(ResultType.error, message, ""));
            }

            int statusCode;
            var api  = new EaseMobAPIHelper();
            var data = api.AccountDelFriend(usercode, friend_username, out statusCode);

            if (statusCode == 200)
            {
                LogHelper.SaveLog("AccountDelFriend:" + data, "IM");
                var emResult = JsonConvert.DeserializeObject <EaseMobResult>(data);
                if (!string.IsNullOrEmpty(emResult.error) || emResult.error == null)
                {
                    userSvc.DelFriend(IMFriendID, out message);//删除本地好友关系
                    return(ResultJson(ResultType.success, "删除好友成功", data));
                }
                else
                {
                    return(ResultJson(ResultType.error, "删除好友失败", emResult.error));
                }
            }
            else
            {
                return(ResultJson(ResultType.error, "删除好友失败", data));
            }
        }
Beispiel #4
0
        //向IM 用户添加好友
        //先添加本地,再添加远程的,如果远程失败,删除本地的
        private string AddFriend(HttpContext context)
        {
            string userid          = context.Request["userid"] ?? "";
            string friend_username = context.Request["friend_username"] ?? "";
            string message         = string.Empty;
            string usercode        = string.Empty;
            long   IMFriendID      = 0;

            if (string.IsNullOrEmpty(userid))
            {
                return(ResultJson(ResultType.error, "要添加好友的用户ID不能为空", ""));
            }
            if (string.IsNullOrEmpty(friend_username))
            {
                return(ResultJson(ResultType.error, "被添加好友的用户名不能为空", ""));
            }
            UserService userSvc   = new UserService();
            bool        addResult = userSvc.AddFriend(userid, friend_username, out usercode, out IMFriendID, out message);

            if (addResult)
            {
                int statusCode;
                var api  = new EaseMobAPIHelper();
                var data = api.AccountAddFriend(usercode, friend_username, out statusCode);
                if (statusCode == 200)
                {
                    var emResult = JsonConvert.DeserializeObject <EaseMobResult>(data);
                    if (!string.IsNullOrEmpty(emResult.error) || emResult.error == null)
                    {
                        return(ResultJson(ResultType.success, "添加好友成功", data));
                    }
                    else
                    {
                        userSvc.DelFriend(IMFriendID, out message);//环信接口失败要删除好友关系
                        return(ResultJson(ResultType.error, "添加好友失败", emResult.error));
                    }
                }
                else
                {
                    userSvc.DelFriend(IMFriendID, out message);//环信接口失败要删除好友关系
                    return(ResultJson(ResultType.error, "添加好友失败", data));
                }
            }
            return(ResultJson(ResultType.error, message, ""));
        }
Beispiel #5
0
        private string GetEaseMobUserList(HttpContext context)
        {
            string limit  = context.Request["limit"] ?? "";
            string cursor = context.Request["cursor"] ?? "";

            int statusCode;
            var api  = new EaseMobAPIHelper();
            var data = api.AccountGetList(limit, cursor, out statusCode);

            if (statusCode == 200)
            {
                return(ResultJson(ResultType.success, "初始成功", data));
            }
            else
            {
                return(ResultJson(ResultType.error, "初始异常", data));
            }
        }
Beispiel #6
0
        //初始环信 ,注册第一个账户
        private string InitEaseMob(HttpContext context)
        {
            string username = context.Request["username"] ?? "";
            string password = context.Request["password"] ?? "";

            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
            {
                return(ResultJson(ResultType.error, "请输入用户名和密码", ""));
            }

            int statusCode;
            var api  = new EaseMobAPIHelper();
            var data = api.AccountCreate(username, password, out statusCode);

            if (statusCode == 200)
            {
                return(ResultJson(ResultType.success, "初始成功", data));
            }
            else
            {
                return(ResultJson(ResultType.error, "初始异常", data));
            }
        }
Beispiel #7
0
        //快速注册
        private string FastRegister(HttpContext context)
        {
            string message     = string.Empty;
            string HX_Password = string.Empty;
            int    smstype     = 1; //注册

            string jsondata = context.Request["data"] ?? "";

            LogHelper.SaveLog(jsondata, "FastRegister");

            if (string.IsNullOrEmpty(jsondata))
            {
                return(ResultJson(ResultType.error, "数据段为空", ""));
            }

            RegisterModel rModel = null;

            try
            {
                jsondata = AESEncrypt.Decrypt(jsondata);
                rModel   = JsonConvert.DeserializeObject <RegisterModel>(jsondata);
            }
            catch
            {
                return(ResultJson(ResultType.error, "数据异常", ""));
            }

            if (string.IsNullOrEmpty(rModel.username) || string.IsNullOrEmpty(rModel.password))
            {
                return(ResultJson(ResultType.error, "请输入用户名和密码", ""));
            }

            if (string.IsNullOrEmpty(rModel.invitecode))
            {
                return(ResultJson(ResultType.error, "请输入邀请码", ""));
            }
            UserService userSvc = new UserService();

            #region 注册验证验证码
            long validid = userSvc.CheckSMSCode(rModel.phone, rModel.smscode, smstype);
            if (validid < 0)
            {
                return(ResultJson(ResultType.error, "验证码错误", ""));
            }
            #endregion

            int  statusCode;
            long NewUserId;

            bool result = userSvc.Register(rModel.username, rModel.sex, rModel.phone, rModel.password, rModel.paypassword, validid, rModel.invitecode, rModel.nickname, out NewUserId, out HX_Password, out message);
            if (result)
            {
                var api  = new EaseMobAPIHelper();
                var data = api.AccountCreate(rModel.username, HX_Password, out statusCode);

                if (statusCode == 200)
                {
                    var emResult = JsonConvert.DeserializeObject <EaseMobResult>(data);
                    if (!string.IsNullOrEmpty(emResult.error) || emResult.error == null)
                    {
                        return(ResultJson(ResultType.success, "注册成功", ""));
                    }
                    else
                    {
                        userSvc.RegisterDel(NewUserId);
                        return(ResultJson(ResultType.error, "注册失败", emResult.error));
                    }
                }
                else
                {
                    userSvc.RegisterDel(NewUserId);
                    return(ResultJson(ResultType.error, "注册失败", data));
                }
            }
            else
            {
                return(ResultJson(ResultType.error, message, ""));
            }
        }
Beispiel #8
0
        //注册 步骤3 验证邀请码,身份证,姓名
        //private string RegisterStep3(HttpContext context)
        //{
        //    string message = string.Empty;

        //    string jsondata = context.Request["data"] ?? "";
        //    LogHelper.SaveLog("RegisterStep3:" + jsondata, "RegisterStep");
        //    RegisterModel rModel = null;
        //    try
        //    {
        //        jsondata = AESEncrypt.Decrypt(jsondata);
        //        rModel = JsonConvert.DeserializeObject<RegisterModel>(jsondata);
        //    }
        //    catch
        //    {
        //        return ResultJson(ResultType.error, "数据异常", "");
        //    }

        //    //string phone = context.Request["phone"] ?? "";
        //    //string invitecode = context.Request["invitecode"] ?? ""; //邀请码
        //    //string idencode = context.Request["idencode"] ?? "";
        //    //string idenname = context.Request["idenname"] ?? "";

        //    if (string.IsNullOrEmpty(rModel.invitecode) || rModel.invitecode.Length != 4)
        //        return ResultJson(ResultType.error, "邀请码错误", "");

        //    if (string.IsNullOrEmpty(rModel.idencode))//|| recommendcode.Length != 18)
        //        return ResultJson(ResultType.error, "身份证错误", "");

        //    if (string.IsNullOrEmpty(rModel.idenname) || rModel.idenname.Length < 2)
        //        return ResultJson(ResultType.error, "姓名错误", "");

        //    UserService userSvc = new UserService();
        //    if (!userSvc.ExistsInviteCode(rModel.invitecode, out message))
        //    {
        //        return ResultJson(ResultType.error, "邀请码无效", "");
        //    }

        //    return ResultJson(ResultType.success, "验证通过", "");

        //}
        //注册 步骤4
        private string RegisterStep3(HttpContext context)
        {
            string message     = string.Empty;
            string HX_Password = string.Empty;

            string jsondata = context.Request["data"] ?? "";

            LogHelper.SaveLog("RegisterStep3:" + jsondata, "RegisterStep");
            if (string.IsNullOrEmpty(jsondata))
            {
                return(ResultJson(ResultType.error, "数据段为空", ""));
            }

            RegisterModel rModel = null;

            try
            {
                jsondata = AESEncrypt.Decrypt(jsondata);
                rModel   = JsonConvert.DeserializeObject <RegisterModel>(jsondata);
            }
            catch
            {
                return(ResultJson(ResultType.error, "数据异常", ""));
            }

            int  statusCode;
            long NewUserId = 0;

            rModel.username    = rModel.phone;
            rModel.password    = PageValidate.GetMd5("111111"); // rModel.phone+ rModel.invitecode);
            rModel.paypassword = PageValidate.GetMd5("111111"); //PageValidate.GetMd5(rModel.phone+ rModel.invitecode);
            UserService userSvc = new UserService();
            bool        result  = userSvc.Register(rModel.username, rModel.sex, rModel.phone, rModel.password, rModel.paypassword, int.Parse(rModel.smsValid), rModel.invitecode, rModel.nickname, out NewUserId, out HX_Password, out message);

            if (result)
            {
                var api  = new EaseMobAPIHelper();
                var data = api.AccountCreate(rModel.username, HX_Password, out statusCode);

                if (statusCode == 200)
                {
                    bool flag;
                    var  emResult = JsonConvert.DeserializeObject <EaseMobResult>(data);
                    if (!string.IsNullOrEmpty(emResult.error) || emResult.error == null)
                    {
                        var token = userSvc.Login(rModel.username, rModel.password, rModel.smscode, 1, out flag, out message);
                        SortedDictionary <string, object> values = new SortedDictionary <string, object>();
                        values.Add("logininfo", token);
                        values.Add("giveinfo", userSvc.GetGiveCalcPower());

                        return(ResultJson(ResultType.success, "注册成功", values));
                    }
                    else
                    {
                        userSvc.RegisterDel(NewUserId);
                        LogHelper.SaveLog("AccountCreate DeserializeObject:" + data, "EaseMobAPI");
                        return(ResultJson(ResultType.error, "注册失败!", emResult.error));
                    }
                }
                else
                {
                    userSvc.RegisterDel(NewUserId);
                    LogHelper.SaveLog("AccountCreate statusCode:" + statusCode, "EaseMobAPI");
                    return(ResultJson(ResultType.error, "注册失败!!", data));
                }
            }
            else
            {
                return(ResultJson(ResultType.error, message, ""));
            }
        }
Beispiel #9
0
        //private void BindProvince()
        //{
        //    bind_DropDownList(dropProvince, provinceBLL.GetList("").Tables[0], "provinceID", "province"); //銀行省份
        //}

        /// <summary>
        /// 绑定密保问题
        /// </summary>
        //public void BindQuestion()
        //{
        //    dropQuestion.Items.Add(new ListItem(GetLanguage("PleaseSselect"), "0"));
        //    dropQuestion.Items.Add(new ListItem(GetLanguage("YourNameIs"), "1"));
        //    dropQuestion.Items.Add(new ListItem(GetLanguage("YourHome"), "2"));
        //    dropQuestion.Items.Add(new ListItem(GetLanguage("YourPeople"), "3"));
        //}

        /// <summary>
        /// 绑定银行
        /// </summary>
        //private void BindBank()
        //{
        //    string strBandName = banknameBLL.GetModel(1).BankName;
        //    string[] s = strBandName.Split('|');

        //    //dropBank.Items.Clear();
        //    strBandName = s[0];
        //    if (s.Length < 2)
        //    {
        //        return;
        //    }
        //    if (currentCulture == "en-us")
        //    {
        //        strBandName = s[1];
        //    }
        //    string[] a = strBandName.Split(',');
        //    ListItem list = new ListItem();
        //    list.Value = "0";
        //    list.Text = GetLanguage("PleaseSselect");//"-请选择-"
        //    this.dropBank.Items.Add(list);
        //    foreach (string b in a)
        //    {
        //        ListItem item = new ListItem();
        //        item.Value = b;
        //        item.Text = b;
        //        this.dropBank.Items.Add(item);
        //    }
        //}

        /// <summary>
        /// 提交
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (RegValidate())
            {
                string phone = txtUserCode.Value.Trim().ToString();
                if (CheckSMSCode(phone, Text2.Value.Trim().ToString(), 1) < 0)                    //验证短信验证码
                {
                    MessageBox.ShowBox(this.Page, "", "验证码错误", Library.Enums.ModalTypes.warning); //注册失败,该会员编号已存在,请重新注册!
                    return;
                }
                lgk.Model.tb_user userInfo      = new lgk.Model.tb_user();
                lgk.Model.tb_user recommendInfo = userBLL.GetModel(GetUserID(this.txtRecommendCode.Value.Trim())); //推荐用户
                                                                                                                   //lgk.Model.tb_user parentInfo = userBLL.GetModel(GetUserID(this.txtParentCode.Value.Trim()));//父节点用户
                                                                                                                   //lgk.Model.tb_user agentInfo = userBLL.GetModel(GetUserID(txtAgentCode.Value.Trim()));//报单会员

                userInfo.UserCode        = txtUserCode.Value.Trim();                                               //会员编号
                userInfo.LevelID         = 1;
                userInfo.RecommendID     = recommendInfo.UserID;                                                   //推荐人ID
                userInfo.RecommendCode   = recommendInfo.UserCode;                                                 //推荐人编号
                userInfo.RecommendPath   = recommendInfo.RecommendPath;                                            //路径
                userInfo.RecommendGenera = Convert.ToInt32(recommendInfo.RecommendGenera + 1);                     //(推荐代数)第几代
                userInfo.User001         = 0;                                                                      //---职务级别

                userInfo.ParentID      = 0;                                                                        //父节点ID
                userInfo.ParentCode    = "-";                                                                      //父节点編號
                userInfo.UserPath      = "-";                                                                      //路径
                userInfo.Layer         = 0;                                                                        //属于多少层
                userInfo.LeftBalance   = 0;
                userInfo.LeftNewScore  = 0;
                userInfo.RightBalance  = 0;
                userInfo.RightNewScore = 0;
                userInfo.LeftScore     = 0;
                userInfo.RightScore    = 0;

                userInfo.Location = 0;
                userInfo.User007  = "";

                userInfo.IsOpend  = 0;                                                              //是否启用 0-未激活,1-新注册, 2-已激活
                userInfo.IsLock   = 0;                                                              //是否被冻結(0-否,1-冻結)
                userInfo.IsAgent  = 0;                                                              //是否报單中心(0-否,1-是)
                userInfo.User006  = "" /*txtAgentCode.Value.Trim()*/;
                userInfo.AgentsID = 0 /*agentBLL.GetAgentsID(txtAgentCode.Value.Trim(),1)*/;        //
                                                                                                    //userInfo.QQnumer = txtQQnumer.Value.Trim();//QQ
                                                                                                    //userInfo.Email = txtEmail.Value.Trim();//电子邮箱

                userInfo.Emoney          = 0;                                                       //云盾
                userInfo.BonusAccount    = 0;                                                       //现金积分
                userInfo.AllBonusAccount = 0;                                                       //累计现金积分账户
                userInfo.StockAccount    = 0;                                                       //复投积分
                userInfo.ShopAccount     = 0;                                                       //云图
                userInfo.StockMoney      = 0;                                                       //投资积分

                userInfo.RegTime        = DateTime.Now;                                             //注册時間
                userInfo.GLmoney        = 0;                                                        //日分红累计,封顶使用
                userInfo.BillCount      = 1;                                                        //注册单数
                userInfo.Password       = PageValidate.GetMd5(this.txtPassword.Value.Trim());       //一级密码
                userInfo.SecondPassword = PageValidate.GetMd5(this.txtSecondPassword.Value.Trim()); //二级密码
                userInfo.ThreePassword  = PageValidate.GetMd5(Util.CreateNo());

                userInfo.BankAccount     = "";                                            // this.txtBankAccount.Value.Trim();// "銀行賬號";
                userInfo.BankAccountUser = "";                                            // this.txtBankAccountUser.Value.Trim();// "開户姓名";
                userInfo.BankName        = "";                                            // this.dropBank.SelectedValue;// "開户銀行";
                userInfo.BankBranch      = "";                                            // this.txtBankBranch.Value.Trim();// "支行名稱";
                userInfo.BankInProvince  = "";                                            // dropProvince.SelectedItem.Text;// "銀行所在省份";
                userInfo.BankInCity      = "";                                            // "銀行所在城市";

                userInfo.NiceName = txtNiceName.Value.Trim(); /*string.Empty;*/           //昵称
                userInfo.TrueName = "";                                                   // "姓名";
                userInfo.IdenCode = "";                                                   // "身份证號";
                string strPhoneNum = this.txtUserCode.Value.Trim();
                userInfo.PhoneNum = string.IsNullOrEmpty(strPhoneNum) ? "" : strPhoneNum; // "手机號碼";
                userInfo.Address  = "" /*txtAddress.Value*/;                              //聯系地址
                                                                                          //userInfo.QQnumer = txtQQnumer.Value.Trim();
                                                                                          //userInfo.Email = "";
                userInfo.User002 = 0;                                                     //推广连接注册
                userInfo.User003 = 0;                                                     //推荐人数
                userInfo.User004 = 0;                                                     //投资单数标识
                userInfo.User005 = "";                                                    //资料修改标识
                userInfo.User007 = Util.GetUniqueIndentifier(20);
                userInfo.User008 = Util.GetUniqueIndentifier(4).ToUpper();                //邀请码
                userInfo.User010 = "";                                                    // txtAlipay.Value.Trim(); //支付宝
                                                                                          //int iQuestion = 0;
                                                                                          //int.TryParse(dropQuestion.SelectedValue, out iQuestion);
                                                                                          //string strQuestion = iQuestion > 0 && iQuestion <= 3 ? dropQuestion.SelectedItem.Text : string.Empty;
                                                                                          //userInfo.SafetyCodeQuestion = strQuestion;//密保问题
                                                                                          //userInfo.SafetyCodeAnswer = string.IsNullOrEmpty(strQuestion) ? string.Empty : txtAnswer.Text.Trim();//密保答案
                userInfo.User011 = 0;
                userInfo.User013 = 0;                                                     //
                userInfo.User018 = 0;                                                     //

                userInfo.RegMoney = 0;



                long iUID = GetUserID(txtUserCode.Value.Trim());
                if (iUID > 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "hideloading", "hideloading();", true);
                    MessageBox.ShowBox(this.Page, GetLanguage("RegistrationFails"), Library.Enums.ModalTypes.error);        //注册失败,该会员编号已存在,请重新注册!
                }

                else
                {
                    if (userBLL.Add(userInfo) > 0)
                    {
                        long userid = GetUserID(userInfo.UserCode);
                        int  statusCode;
                        var  api  = new EaseMobAPIHelper();
                        var  data = api.AccountCreate(userInfo.UserCode, userInfo.ThreePassword, out statusCode);

                        if (statusCode == 200)
                        {
                            var emResult = JsonConvert.DeserializeObject <APPService.EaseMobResult>(data);
                            if (!string.IsNullOrEmpty(emResult.error) || emResult.error == null)
                            {
                                int flag = flag_ActivationUser(GetUserID(userInfo.UserCode), 0);
                                if (flag != 0)
                                {
                                    userBLL.Delete(userid);

                                    if (flag == -1)
                                    {
                                        userBLL.Delete(userid);
                                        MessageBox.ShowBox(this.Page, "", GetLanguage("ActivationUserFail"), Library.Enums.ModalTypes.error);        //激活会员失败
                                    }
                                    else
                                    {
                                        userBLL.Delete(userid);
                                        MessageBox.ShowBox(this.Page, "", GetLanguage("RegOpenMust"), Library.Enums.ModalTypes.error);        //云盾不足
                                    }
                                }
                                else
                                {
                                    MessageBox.ShowBox(this.Page, "", "注册成功", Library.Enums.ModalTypes.success);        //注册成功
                                    return;
                                }
                            }
                            else
                            {
                                userBLL.Delete(userid);
                                MessageBox.ShowBox(this.Page, "", "网络繁忙,注册失败.", Library.Enums.ModalTypes.error);        //注册失败
                            }
                        }
                        else
                        {
                            userBLL.Delete(userid);
                            LogHelper.SaveLog(data, "LinkRegister");
                            MessageBox.ShowBox(this.Page, "", "网络异常,注册失败", Library.Enums.ModalTypes.error);        //注册失败
                        }
                    }
                }
            }
        }
Beispiel #10
0
        //private void BindProvince()
        //{
        //    bind_DropDownList(dropProvince, provinceBLL.GetList("").Tables[0], "provinceID", "province"); //銀行省份
        //}

        /// <summary>
        /// 绑定密保问题
        /// </summary>
        //public void BindQuestion()
        //{
        //    dropQuestion.Items.Add(new ListItem(GetLanguage("PleaseSselect"), "0"));
        //    dropQuestion.Items.Add(new ListItem(GetLanguage("YourNameIs"), "1"));
        //    dropQuestion.Items.Add(new ListItem(GetLanguage("YourHome"), "2"));
        //    dropQuestion.Items.Add(new ListItem(GetLanguage("YourPeople"), "3"));
        //}

        /// <summary>
        /// 绑定银行
        /// </summary>
        //private void BindBank()
        //{
        //    string strBandName = banknameBLL.GetModel(1).BankName;
        //    string[] s = strBandName.Split('|');

        //    //dropBank.Items.Clear();
        //    strBandName = s[0];
        //    if (s.Length < 2)
        //    {
        //        return;
        //    }
        //    if (currentCulture == "en-us")
        //    {
        //        strBandName = s[1];
        //    }
        //    string[] a = strBandName.Split(',');
        //    ListItem list = new ListItem();
        //    list.Value = "0";
        //    list.Text = GetLanguage("PleaseSselect");//"-请选择-"
        //    this.dropBank.Items.Add(list);
        //    foreach (string b in a)
        //    {
        //        ListItem item = new ListItem();
        //        item.Value = b;
        //        item.Text = b;
        //        this.dropBank.Items.Add(item);
        //    }
        //}

        /// <summary>
        /// 提交
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (RegValidate())
            {
                string phone = txtUserCode.Value.Trim().ToString();
                if (CheckSMSCode(phone, txtVerifCode.Value.Trim().ToString(), 1) < 0)             //验证短信验证码
                {
                    MessageBox.ShowBox(this.Page, "", "验证码错误", Library.Enums.ModalTypes.warning); //注册失败,该会员编号已存在,请重新注册!
                    return;
                }
                lgk.Model.tb_user userInfo      = new lgk.Model.tb_user();
                lgk.Model.tb_user recommendInfo = userBLL.GetModel(GetUserID(this.txtRecommendCode.Text.Trim()));//推荐用户
                //lgk.Model.tb_user parentInfo = userBLL.GetModel(GetUserID(this.txtParentCode.Value.Trim()));//父节点用户
                //lgk.Model.tb_user agentInfo = userBLL.GetModel(GetUserID(txtAgentCode.Value.Trim()));//报单会员

                userInfo.UserCode    = txtUserCode.Value.Trim();                                    //会员编号
                userInfo.LevelID     = 1;
                userInfo.RecommendID = recommendInfo.UserID;                                        //推荐人ID
                userInfo.Location    = iLocation;                                                   //区域

                userInfo.RegTime        = DateTime.Now;                                             //注册時間
                userInfo.Password       = PageValidate.GetMd5(this.txtPassword.Value.Trim());       //一级密码
                userInfo.SecondPassword = PageValidate.GetMd5(this.txtSecondPassword.Value.Trim()); //二级密码
                userInfo.ThreePassword  = PageValidate.GetMd5(Util.CreateNo());

                userInfo.NiceName = txtNiceName.Value.Trim();
                userInfo.TrueName = "";                                                   // "姓名";
                userInfo.IdenCode = "";                                                   // "身份证號";
                string strPhoneNum = this.txtUserCode.Value.Trim();
                userInfo.PhoneNum = string.IsNullOrEmpty(strPhoneNum) ? "" : strPhoneNum; // "手机號碼";
                userInfo.Address  = "";                                                   //聯系地址

                //userInfo.User007 = Util.GetUniqueIndentifier(20);
                //userInfo.User008 = Util.GetUniqueIndentifier(4).ToUpper();//邀请码
                //userInfo.User010 = "";// txtAlipay.Value.Trim(); //支付宝

                long iUID = GetUserID(txtUserCode.Value.Trim());
                if (iUID > 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "hideloading", "hideloading();", true);
                    MessageBox.ShowBox(this.Page, GetLanguage("RegistrationFails"), Library.Enums.ModalTypes.error);//注册失败,该会员编号已存在,请重新注册!
                }
                else
                {
                    string msg = userBLL.proc_RegisterUser(userInfo);
                    if (msg == "ok")
                    {
                        long userid = GetUserID(userInfo.UserCode);
                        int  statusCode;
                        var  api = new EaseMobAPIHelper();
                        if (System.Configuration.ConfigurationManager.AppSettings["ACCOUNTSYNC_SWITCH"] != "Open")
                        {
                            var data = api.AccountCreate(userInfo.UserCode, userInfo.ThreePassword, out statusCode);

                            if (statusCode == 200)
                            {
                                var emResult = JsonConvert.DeserializeObject <APPService.EaseMobResult>(data);
                                if (!string.IsNullOrEmpty(emResult.error) || emResult.error == null)
                                {
                                    MessageBox.ShowBox(this.Page, "", "注册成功", Library.Enums.ModalTypes.success);//注册成功
                                    return;
                                }
                                else
                                {
                                    userBLL.Delete(userid);
                                    MessageBox.ShowBox(this.Page, "", "网络繁忙,注册失败.", Library.Enums.ModalTypes.error);//注册失败
                                }
                            }
                            else
                            {
                                userBLL.Delete(userid);
                                LogHelper.SaveLog(data, "LinkRegister");
                                MessageBox.ShowBox(this.Page, "", "网络繁忙,请稍后重试", Library.Enums.ModalTypes.error);//注册失败
                            }
                        }
                        else
                        {
                            MessageBox.ShowBox(this.Page, "", "注册成功", Library.Enums.ModalTypes.success);//注册成功
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.ShowBox(this.Page, "", msg, Library.Enums.ModalTypes.error);//注册失败
                    }
                }
            }
        }