Ejemplo n.º 1
0
        protected void ChangePwd_Click(object sender, EventArgs e)
        {
            CustomerServiceSettings masterSettings = CustomerServiceManager.GetMasterSettings(false);

            if (string.IsNullOrEmpty(this.txt_phone.Text))
            {
                this.ShowMsg("请输入手机号码!", false);
            }
            if (string.IsNullOrEmpty(this.txt_pwd.Text))
            {
                this.ShowMsg("请输入密码!", false);
            }
            string tokenValue = TokenApi.GetTokenValue(masterSettings.AppId, masterSettings.AppSecret);

            if (!string.IsNullOrEmpty(tokenValue))
            {
                SiteSettings settings2 = SettingsManager.GetMasterSettings(false);
                string       str2      = string.Empty;
                if (!string.IsNullOrEmpty(settings2.DistributorLogoPic))
                {
                    str2 = Globals.DomainName + settings2.DistributorLogoPic;
                }
                string str3 = FormsAuthentication.HashPasswordForStoringInConfigFile(this.txt_pwd.Text, "MD5").ToLower();
                Dictionary <string, string> parameters = new Dictionary <string, string>();
                parameters.Add("unit", this.txt_phone.Text);
                parameters.Add("password", str3);
                parameters.Add("unitname", settings2.SiteName);
                parameters.Add("activated", "1");
                parameters.Add("logo", str2);
                parameters.Add("url", "");
                parameters.Add("tel", settings2.ShopTel);
                parameters.Add("contact", "");
                parameters.Add("location", "");
                string str4 = EnterpriseApi.UpdateEnterprise(tokenValue, parameters);
                if (!string.IsNullOrWhiteSpace(str4))
                {
                    string jsonValue = Common.GetJsonValue(str4, "errcode");
                    string str6      = Common.GetJsonValue(str4, "errmsg");
                    if (jsonValue == "0")
                    {
                        masterSettings.password = this.txt_pwd.Text;
                        CustomerServiceManager.Save(masterSettings);
                        this.ShowMsg("修改密码成功!", true);
                    }
                    else
                    {
                        this.ShowMsg("修改密码失败!(" + str6 + ")", false);
                    }
                }
                else
                {
                    this.ShowMsg("修改密码失败!", false);
                }
                this.enable = settings2.EnableSaleService;
            }
            else
            {
                this.ShowMsg("获取access_token失败!", false);
            }
        }
Ejemplo n.º 2
0
        protected void btnBindUser_Click(object sender, EventArgs e)
        {
            string str  = this.txt_phone.Text.Trim();
            string text = this.txt_pwd.Text;

            if (string.IsNullOrEmpty(str))
            {
                this.ShowMsg("请输入邮箱!", false);
            }
            if (string.IsNullOrEmpty(text))
            {
                this.ShowMsg("请输入密码!", false);
            }
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
            string       str3           = string.Empty;

            if (!string.IsNullOrEmpty(masterSettings.DistributorLogoPic))
            {
                str3 = Globals.DomainName + masterSettings.DistributorLogoPic;
            }
            CustomerServiceSettings settings = CustomerServiceManager.GetMasterSettings(false);
            string tokenValue = TokenApi.GetTokenValue(settings.AppId, settings.AppSecret);
            string str5       = FormsAuthentication.HashPasswordForStoringInConfigFile(text, "MD5").ToLower();

            if (!string.IsNullOrEmpty(tokenValue))
            {
                Dictionary <string, string> parameters = new Dictionary <string, string>();
                parameters.Add("unit", str);
                parameters.Add("password", str5);
                parameters.Add("unitname", masterSettings.SiteName);
                parameters.Add("activated", "1");
                parameters.Add("logo", str3);
                parameters.Add("url", "");
                parameters.Add("tel", masterSettings.ShopTel);
                parameters.Add("contact", "");
                parameters.Add("location", "");
                string str6 = EnterpriseApi.CreateEnterprise(tokenValue, parameters);
                if (!string.IsNullOrWhiteSpace(str6))
                {
                    string jsonValue = Common.GetJsonValue(str6, "errcode");
                    Common.GetJsonValue(str6, "errmsg");
                    if (jsonValue == "10020")
                    {
                        string unitId = EnterpriseApi.GetUnitId(tokenValue, str);
                        if (!string.IsNullOrEmpty(unitId))
                        {
                            settings.unitid   = unitId;
                            settings.unit     = this.txt_phone.Text;
                            settings.password = this.txt_pwd.Text;
                            CustomerServiceManager.Save(settings);
                            this.ShowMsgAndReUrl("绑定成功。", true, "SaleService.aspx");
                        }
                    }
                    else
                    {
                        this.ShowMsgAndReUrl("账号不存在!", true, "SaleService.aspx");
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void ProcessRequest(HttpContext context)
        {
            wid = context.Session[DTKeys.SESSION_WEB_ID] as string;
            if (string.IsNullOrEmpty(wid))
            {
                return;
            }
            context.Response.ContentType = "text/plain";
            int result = 0;

            int.TryParse(context.Request["id"].ToString(), out result);
            if (result > 0)
            {
                CustomerServiceInfo     customer       = CustomerServiceHelper.GetCustomer(result);
                CustomerServiceSettings masterSettings = CustomerServiceManager.GetMasterSettings(false);
                string tokenValue = TokenApi.GetTokenValue(masterSettings.AppId, masterSettings.AppSecret);
                if (!string.IsNullOrEmpty(tokenValue))
                {
                    string str2 = CustomerApi.DeleteCustomer(tokenValue, customer.unit, customer.userver);
                    if (!string.IsNullOrWhiteSpace(str2))
                    {
                        string jsonValue = Common.GetJsonValue(str2, "errcode");
                        string str4      = Common.GetJsonValue(str2, "errmsg");
                        if (jsonValue == "0")
                        {
                            if (CustomerServiceHelper.DeletCustomer(result))
                            {
                                context.Response.Write("{\"type\":\"success\",\"data\":\"\"}");
                            }
                            else
                            {
                                context.Response.Write("{\"type\":\"error\",\"data\":\"删除客服失败!\"}");
                            }
                        }
                        else
                        {
                            context.Response.Write("{\"type\":\"error\",\"data\":\"" + str4 + "\"}");
                        }
                    }
                    else
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"删除客服失败!\"}");
                    }
                }
                else
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"获取access_token失败!\"}");
                }
            }
        }
Ejemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            if (Globals.GetCurrentManagerUserId() <= 0)
            {
                context.Response.Write("{\"type\":\"error\",\"data\":\"请先登录\"}");
                context.Response.End();
            }
            int result = 0;

            int.TryParse(context.Request["id"].ToString(), out result);
            if (result > 0)
            {
                CustomerServiceInfo     customer       = CustomerServiceHelper.GetCustomer(result);
                CustomerServiceSettings masterSettings = CustomerServiceManager.GetMasterSettings(false);
                string tokenValue = TokenApi.GetTokenValue(masterSettings.AppId, masterSettings.AppSecret);
                if (!string.IsNullOrEmpty(tokenValue))
                {
                    string str2 = CustomerApi.DeleteCustomer(tokenValue, customer.unit, customer.userver);
                    if (!string.IsNullOrWhiteSpace(str2))
                    {
                        string jsonValue = Hishop.MeiQia.Api.Util.Common.GetJsonValue(str2, "errcode");
                        string str4      = Hishop.MeiQia.Api.Util.Common.GetJsonValue(str2, "errmsg");
                        if (jsonValue == "0")
                        {
                            if (CustomerServiceHelper.DeletCustomer(result))
                            {
                                context.Response.Write("{\"type\":\"success\",\"data\":\"\"}");
                            }
                            else
                            {
                                context.Response.Write("{\"type\":\"error\",\"data\":\"删除客服失败!\"}");
                            }
                        }
                        else
                        {
                            context.Response.Write("{\"type\":\"error\",\"data\":\"" + str4 + "\"}");
                        }
                    }
                    else
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"删除客服失败!\"}");
                    }
                }
                else
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"获取access_token失败!\"}");
                }
            }
        }
Ejemplo n.º 5
0
        public void ProcessRequest(System.Web.HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int num = 0;

            int.TryParse(context.Request["id"].ToString(), out num);
            if (num > 0)
            {
                CustomerServiceInfo     customer       = CustomerServiceHelper.GetCustomer(num);
                CustomerServiceSettings masterSettings = CustomerServiceManager.GetMasterSettings(false);
                string tokenValue = TokenApi.GetTokenValue(masterSettings.AppId, masterSettings.AppSecret);
                if (!string.IsNullOrEmpty(tokenValue))
                {
                    string text = CustomerApi.DeleteCustomer(tokenValue, customer.unit, customer.userver);
                    if (string.IsNullOrWhiteSpace(text))
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"删除客服失败!\"}");
                        return;
                    }
                    string jsonValue  = Hishop.MeiQia.Api.Util.Common.GetJsonValue(text, "errcode");
                    string jsonValue2 = Hishop.MeiQia.Api.Util.Common.GetJsonValue(text, "errmsg");
                    if (!(jsonValue == "0"))
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"" + jsonValue2 + "\"}");
                        return;
                    }
                    bool flag = CustomerServiceHelper.DeletCustomer(num);
                    if (flag)
                    {
                        context.Response.Write("{\"type\":\"success\",\"data\":\"\"}");
                        return;
                    }
                    context.Response.Write("{\"type\":\"error\",\"data\":\"删除客服失败!\"}");
                    return;
                }
                else
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"获取access_token失败!\"}");
                }
            }
        }
Ejemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
         if (!string.IsNullOrEmpty(masterSettings.MeiQiaEntId))
         {
             base.Response.Redirect("MeiQia.aspx");
         }
         this.enable = masterSettings.EnableSaleService;
         CustomerServiceSettings settings = CustomerServiceManager.GetMasterSettings(false);
         this.txt_phone.Text = settings.unit;
         this.txt_pwd.Attributes["Value"] = settings.password;
         if (!string.IsNullOrEmpty(settings.unit))
         {
             this.txt_phone.Enabled   = false;
             this.OpenAccount.Visible = false;
             this.ChangePwd.Visible   = true;
             this.btnBindUser.Visible = false;
             this.btnClear.Visible    = true;
             if (string.IsNullOrEmpty(settings.unitid))
             {
                 string tokenValue = TokenApi.GetTokenValue(settings.AppId, settings.AppSecret);
                 if (!string.IsNullOrEmpty(tokenValue))
                 {
                     string unitId = EnterpriseApi.GetUnitId(tokenValue, settings.unit);
                     settings.unitid = unitId;
                     CustomerServiceManager.Save(settings);
                 }
             }
         }
         else
         {
             base.Response.Redirect("MeiQia.aspx");
         }
         this.BindCustomers(settings.unit);
     }
 }
Ejemplo n.º 7
0
        protected void OpenAccount_Click(object sender, EventArgs e)
        {
            CustomerServiceSettings masterSettings = CustomerServiceManager.GetMasterSettings(false);

            if (string.IsNullOrEmpty(this.txt_phone.Text))
            {
                this.ShowMsg("请输入手机号码!", false);
            }
            if (string.IsNullOrEmpty(this.txt_pwd.Text))
            {
                this.ShowMsg("请输入密码!", false);
            }
            string tokenValue = TokenApi.GetTokenValue(masterSettings.AppId, masterSettings.AppSecret);

            if (!string.IsNullOrEmpty(tokenValue))
            {
                SiteSettings settings2 = SettingsManager.GetMasterSettings(false);
                string       str2      = string.Empty;
                if (!string.IsNullOrEmpty(settings2.DistributorLogoPic))
                {
                    str2 = Globals.DomainName + settings2.DistributorLogoPic;
                }
                string str3 = FormsAuthentication.HashPasswordForStoringInConfigFile(this.txt_pwd.Text, "MD5").ToLower();
                Dictionary <string, string> parameters = new Dictionary <string, string>();
                parameters.Add("unit", this.txt_phone.Text);
                parameters.Add("password", str3);
                parameters.Add("unitname", settings2.SiteName);
                parameters.Add("activated", "1");
                parameters.Add("logo", str2);
                parameters.Add("url", "");
                parameters.Add("tel", settings2.ShopTel);
                parameters.Add("contact", "");
                parameters.Add("location", "");
                string str4 = EnterpriseApi.CreateEnterprise(tokenValue, parameters);
                if (!string.IsNullOrWhiteSpace(str4))
                {
                    string jsonValue = Common.GetJsonValue(str4, "errcode");
                    string str6      = Common.GetJsonValue(str4, "errmsg");
                    if (jsonValue == "0")
                    {
                        string unitId = EnterpriseApi.GetUnitId(tokenValue, this.txt_phone.Text);
                        if (!string.IsNullOrEmpty(unitId))
                        {
                            masterSettings.unitid   = unitId;
                            masterSettings.unit     = this.txt_phone.Text;
                            masterSettings.password = this.txt_pwd.Text;
                            CustomerServiceManager.Save(masterSettings);
                            this.ShowMsgAndReUrl("开通主账号成功!", true, "saleservice.aspx");
                        }
                        else
                        {
                            this.ShowMsg("获取主账号Id失败!", false);
                        }
                    }
                    else
                    {
                        string str8 = str6;
                        if (str8.Contains("has registered"))
                        {
                            this.ShowMsg("您输入的账号名称已被注册,请更换一个再注册!", false);
                        }
                        else
                        {
                            this.ShowMsg("开通主账号失败!(" + str6 + ")", false);
                        }
                    }
                }
                else
                {
                    this.ShowMsg("开通主账号失败!", false);
                }
                this.enable = settings2.EnableSaleService;
            }
            else
            {
                this.ShowMsg("获取access_token失败!", false);
            }
        }
Ejemplo n.º 8
0
        public void ProcessRequest(System.Web.HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int num = 0;

            int.TryParse(context.Request["id"].ToString(), out num);
            CustomerServiceSettings masterSettings = CustomerServiceManager.GetMasterSettings(false);
            string unit       = masterSettings.unit;
            string text       = context.Request["userver"].ToString();
            string password   = context.Request["password"].ToString();
            string text2      = context.Request["nickname"].ToString();
            string value      = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");
            string tokenValue = TokenApi.GetTokenValue(masterSettings.AppId, masterSettings.AppSecret);

            if (string.IsNullOrEmpty(tokenValue))
            {
                context.Response.Write("{\"type\":\"error\",\"data\":\"获取access_token失败!\"}");
                return;
            }
            System.Collections.Generic.Dictionary <string, string> dictionary = new System.Collections.Generic.Dictionary <string, string>();
            dictionary.Add("unit", unit);
            dictionary.Add("userver", text);
            dictionary.Add("password", value);
            dictionary.Add("nickname", text2);
            dictionary.Add("realname", "");
            dictionary.Add("level", "");
            dictionary.Add("tel", "");
            string empty = string.Empty;
            CustomerServiceInfo customerServiceInfo = new CustomerServiceInfo();

            if (num != 0)
            {
                string text3 = CustomerApi.UpdateCustomer(tokenValue, dictionary);
                if (string.IsNullOrWhiteSpace(text3))
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"修改客服信息失败!\"}");
                    return;
                }
                string jsonValue  = Hishop.MeiQia.Api.Util.Common.GetJsonValue(text3, "errcode");
                string jsonValue2 = Hishop.MeiQia.Api.Util.Common.GetJsonValue(text3, "errmsg");
                if (!(jsonValue == "0"))
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"" + jsonValue2 + "\"}");
                    return;
                }
                customerServiceInfo          = CustomerServiceHelper.GetCustomer(num);
                customerServiceInfo.unit     = unit;
                customerServiceInfo.userver  = text;
                customerServiceInfo.password = password;
                customerServiceInfo.nickname = text2;
                bool flag = CustomerServiceHelper.UpdateCustomer(customerServiceInfo, ref empty);
                if (flag)
                {
                    context.Response.Write("{\"type\":\"success\",\"data\":\"\"}");
                    return;
                }
                context.Response.Write("{\"type\":\"error\",\"data\":\"" + empty + "\"}");
                return;
            }
            else
            {
                string text4 = CustomerApi.CreateCustomer(tokenValue, dictionary);
                if (string.IsNullOrWhiteSpace(text4))
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"注册客服用户失败!\"}");
                    return;
                }
                string jsonValue3 = Hishop.MeiQia.Api.Util.Common.GetJsonValue(text4, "errcode");
                string jsonValue4 = Hishop.MeiQia.Api.Util.Common.GetJsonValue(text4, "errmsg");
                if (!(jsonValue3 == "0"))
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"" + jsonValue4 + "\"}");
                    return;
                }
                customerServiceInfo.unit     = unit;
                customerServiceInfo.userver  = text;
                customerServiceInfo.password = password;
                customerServiceInfo.nickname = text2;
                int num2 = CustomerServiceHelper.CreateCustomer(customerServiceInfo, ref empty);
                if (num2 > 0)
                {
                    context.Response.Write("{\"type\":\"success\",\"data\":\"\"}");
                    return;
                }
                context.Response.Write("{\"type\":\"error\",\"data\":\"" + empty + "\"}");
                return;
            }
        }
Ejemplo n.º 9
0
        protected void OpenAccount_Click(object sender, System.EventArgs e)
        {
            CustomerServiceSettings masterSettings = CustomerServiceManager.GetMasterSettings(false);

            if (string.IsNullOrEmpty(this.txt_phone.Text))
            {
                this.ShowMsg("请输入手机号码!", false);
            }
            if (string.IsNullOrEmpty(this.txt_pwd.Text))
            {
                this.ShowMsg("请输入密码!", false);
            }
            string tokenValue = TokenApi.GetTokenValue(masterSettings.AppId, masterSettings.AppSecret);

            if (!string.IsNullOrEmpty(tokenValue))
            {
                SiteSettings masterSettings2 = SettingsManager.GetMasterSettings(false);
                string       value           = string.Empty;
                if (!string.IsNullOrEmpty(masterSettings2.DistributorLogoPic))
                {
                    value = Globals.DomainName + masterSettings2.DistributorLogoPic;
                }
                string value2 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.txt_pwd.Text, "MD5").ToLower();
                string text   = EnterpriseApi.CreateEnterprise(tokenValue, new System.Collections.Generic.Dictionary <string, string>
                {
                    {
                        "unit",
                        this.txt_phone.Text
                    },
                    {
                        "password",
                        value2
                    },
                    {
                        "unitname",
                        masterSettings2.SiteName
                    },
                    {
                        "activated",
                        "1"
                    },
                    {
                        "logo",
                        value
                    },
                    {
                        "url",
                        ""
                    },
                    {
                        "tel",
                        masterSettings2.ShopTel
                    },
                    {
                        "contact",
                        ""
                    },
                    {
                        "location",
                        ""
                    }
                });
                if (!string.IsNullOrWhiteSpace(text))
                {
                    string jsonValue  = Hishop.MeiQia.Api.Util.Common.GetJsonValue(text, "errcode");
                    string jsonValue2 = Hishop.MeiQia.Api.Util.Common.GetJsonValue(text, "errmsg");
                    if (jsonValue == "0")
                    {
                        string unitId = EnterpriseApi.GetUnitId(tokenValue, this.txt_phone.Text);
                        if (!string.IsNullOrEmpty(unitId))
                        {
                            masterSettings.unitid   = unitId;
                            masterSettings.unit     = this.txt_phone.Text;
                            masterSettings.password = this.txt_pwd.Text;
                            CustomerServiceManager.Save(masterSettings);
                            this.ShowMsgAndReUrl("开通主账号成功!", true, "saleservice.aspx");
                        }
                        else
                        {
                            this.ShowMsg("获取主账号Id失败!", false);
                        }
                    }
                    else
                    {
                        string text2 = jsonValue2;
                        if (text2.Contains("has registered"))
                        {
                            this.ShowMsg("您输入的账号名称已被注册,请更换一个再注册!", false);
                        }
                        else
                        {
                            this.ShowMsg("开通主账号失败!(" + jsonValue2 + ")", false);
                        }
                    }
                }
                else
                {
                    this.ShowMsg("开通主账号失败!", false);
                }
                this.enable = masterSettings2.EnableSaleService;
                return;
            }
            this.ShowMsg("获取access_token失败!", false);
        }
Ejemplo n.º 10
0
        protected void btnBindUser_Click(object sender, System.EventArgs e)
        {
            string text  = this.txt_phone.Text.Trim();
            string text2 = this.txt_pwd.Text;

            if (string.IsNullOrEmpty(text))
            {
                this.ShowMsg("请输入邮箱!", false);
            }
            if (string.IsNullOrEmpty(text2))
            {
                this.ShowMsg("请输入密码!", false);
            }
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
            string       value          = string.Empty;

            if (!string.IsNullOrEmpty(masterSettings.DistributorLogoPic))
            {
                value = Globals.DomainName + masterSettings.DistributorLogoPic;
            }
            CustomerServiceSettings masterSettings2 = CustomerServiceManager.GetMasterSettings(false);
            string tokenValue = TokenApi.GetTokenValue(masterSettings2.AppId, masterSettings2.AppSecret);
            string value2     = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(text2, "MD5").ToLower();

            if (!string.IsNullOrEmpty(tokenValue))
            {
                string text3 = EnterpriseApi.CreateEnterprise(tokenValue, new System.Collections.Generic.Dictionary <string, string>
                {
                    {
                        "unit",
                        text
                    },
                    {
                        "password",
                        value2
                    },
                    {
                        "unitname",
                        masterSettings.SiteName
                    },
                    {
                        "activated",
                        "1"
                    },
                    {
                        "logo",
                        value
                    },
                    {
                        "url",
                        ""
                    },
                    {
                        "tel",
                        masterSettings.ShopTel
                    },
                    {
                        "contact",
                        ""
                    },
                    {
                        "location",
                        ""
                    }
                });
                if (!string.IsNullOrWhiteSpace(text3))
                {
                    string jsonValue = Hishop.MeiQia.Api.Util.Common.GetJsonValue(text3, "errcode");
                    Hishop.MeiQia.Api.Util.Common.GetJsonValue(text3, "errmsg");
                    if (jsonValue == "10020")
                    {
                        string unitId = EnterpriseApi.GetUnitId(tokenValue, text);
                        if (!string.IsNullOrEmpty(unitId))
                        {
                            masterSettings2.unitid   = unitId;
                            masterSettings2.unit     = this.txt_phone.Text;
                            masterSettings2.password = this.txt_pwd.Text;
                            CustomerServiceManager.Save(masterSettings2);
                            this.ShowMsgAndReUrl("绑定成功。", true, "SaleService.aspx");
                            return;
                        }
                    }
                    else
                    {
                        this.ShowMsgAndReUrl("账号不存在!", true, "SaleService.aspx");
                    }
                }
            }
        }
Ejemplo n.º 11
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            if (Globals.GetCurrentManagerUserId() <= 0)
            {
                context.Response.Write("{\"type\":\"error\",\"data\":\"请先登录\"}");
                context.Response.End();
            }
            int result = 0;

            int.TryParse(context.Request["id"].ToString(), out result);
            CustomerServiceSettings masterSettings = CustomerServiceManager.GetMasterSettings(false);
            string unit       = masterSettings.unit;
            string str2       = context.Request["userver"].ToString();
            string password   = context.Request["password"].ToString();
            string str4       = context.Request["nickname"].ToString();
            string str5       = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");
            string tokenValue = TokenApi.GetTokenValue(masterSettings.AppId, masterSettings.AppSecret);

            if (!string.IsNullOrEmpty(tokenValue))
            {
                Dictionary <string, string> parameters = new Dictionary <string, string>();
                parameters.Add("unit", unit);
                parameters.Add("userver", str2);
                parameters.Add("password", str5);
                parameters.Add("nickname", str4);
                parameters.Add("realname", "");
                parameters.Add("level", "");
                parameters.Add("tel", "");
                string msg = string.Empty;
                CustomerServiceInfo customer = new CustomerServiceInfo();
                if (result != 0)
                {
                    string str8 = CustomerApi.UpdateCustomer(tokenValue, parameters);
                    if (!string.IsNullOrWhiteSpace(str8))
                    {
                        string jsonValue = Hishop.MeiQia.Api.Util.Common.GetJsonValue(str8, "errcode");
                        string str10     = Hishop.MeiQia.Api.Util.Common.GetJsonValue(str8, "errmsg");
                        if (jsonValue == "0")
                        {
                            customer          = CustomerServiceHelper.GetCustomer(result);
                            customer.unit     = unit;
                            customer.userver  = str2;
                            customer.password = password;
                            customer.nickname = str4;
                            if (CustomerServiceHelper.UpdateCustomer(customer, ref msg))
                            {
                                context.Response.Write("{\"type\":\"success\",\"data\":\"\"}");
                            }
                            else
                            {
                                context.Response.Write("{\"type\":\"error\",\"data\":\"" + msg + "\"}");
                            }
                        }
                        else
                        {
                            context.Response.Write("{\"type\":\"error\",\"data\":\"" + str10 + "\"}");
                        }
                    }
                    else
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"修改客服信息失败!\"}");
                    }
                }
                else
                {
                    string str11 = CustomerApi.CreateCustomer(tokenValue, parameters);
                    if (!string.IsNullOrWhiteSpace(str11))
                    {
                        string str12 = Hishop.MeiQia.Api.Util.Common.GetJsonValue(str11, "errcode");
                        string str13 = Hishop.MeiQia.Api.Util.Common.GetJsonValue(str11, "errmsg");
                        if (str12 == "0")
                        {
                            customer.unit     = unit;
                            customer.userver  = str2;
                            customer.password = password;
                            customer.nickname = str4;
                            if (CustomerServiceHelper.CreateCustomer(customer, ref msg) > 0)
                            {
                                context.Response.Write("{\"type\":\"success\",\"data\":\"\"}");
                            }
                            else
                            {
                                context.Response.Write("{\"type\":\"error\",\"data\":\"" + msg + "\"}");
                            }
                        }
                        else
                        {
                            context.Response.Write("{\"type\":\"error\",\"data\":\"" + str13 + "\"}");
                        }
                    }
                    else
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"注册客服用户失败!\"}");
                    }
                }
            }
            else
            {
                context.Response.Write("{\"type\":\"error\",\"data\":\"获取access_token失败!\"}");
            }
        }