Beispiel #1
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");
                    }
                }
            }
        }
Beispiel #2
0
 protected override void Render(HtmlTextWriter writer)
 {
     base.Text = "";
     if (SettingsManager.GetMasterSettings(false).EnableSaleService)
     {
         CustomerServiceSettings masterSettings = CustomerServiceManager.GetMasterSettings(false);
         string        str     = string.Empty;
         StringBuilder builder = new StringBuilder();
         string        str2    = string.Empty;
         if ((!string.IsNullOrEmpty(masterSettings.unitid) && !string.IsNullOrEmpty(masterSettings.unit)) && !string.IsNullOrEmpty(masterSettings.password))
         {
             str = string.Format("<script src='//meiqia.com/js/mechat.js?unitid={0}&btn=hide' charset='UTF-8' async='async'></script>", masterSettings.unitid);
             builder.Append("<script type=\"text/javascript\">");
             builder.Append("function mechatFuc()");
             builder.Append("{");
             builder.Append("$.get(\"/Api/Hi_Ajax_OnlineServiceConfig.ashx\", function (data) {");
             builder.Append("if (data != \"\") {");
             builder.Append("$(data).appendTo('head');");
             builder.Append("}");
             builder.Append("mechatClick();");
             builder.Append("});");
             builder.Append("}");
             builder.Append("</script>");
             str2      = "<!-- 在线客服 -->\n<div class=\"customer-service\" style=\"position:fixed;bottom:100px;right:10%;width:38px;height:38px;background:url(/Utility/pics/service.png?v1026) no-repeat;background-size:100%;cursor:pointer;\" onclick=\"javascript:mechatFuc();\"></div>";
             base.Text = str + "\n" + builder.ToString() + "\n" + str2;
         }
     }
     base.Render(writer);
 }
Beispiel #3
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);
            }
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            wid = GetCurWebId();
            if (string.IsNullOrEmpty(wid))
            {
                return;
            }

            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false, wid);

            this.enable = masterSettings.EnableSaleService;
            if (!this.Page.IsPostBack)
            {
                CustomerServiceSettings settings2 = CustomerServiceManager.GetMasterSettings(false);
                this.txt_phone.Text = settings2.unit;
                this.txt_pwd.Attributes["Value"] = settings2.password;
                if (!string.IsNullOrEmpty(settings2.unit))
                {
                    this.txt_phone.Enabled   = false;
                    this.OpenAccount.Visible = false;
                    this.ChangePwd.Visible   = false;
                }
                else
                {
                    this.txt_phone.Enabled   = false; /*true;*/
                    this.OpenAccount.Visible = false; /*true;*/
                    this.ChangePwd.Visible   = false;
                }
                //this.BindCustomers(settings2.unit);
                this.txt_entid.Text = masterSettings.entId;
            }
        }
        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失败!\"}");
                }
            }
        }
Beispiel #6
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失败!\"}");
                }
            }
        }
Beispiel #7
0
        public WxClient(string apiUrl, AccessTokenContainer tokenContainer)
        {
            _apiUrl         = apiUrl;
            _tokenContainer = tokenContainer;

            Menu        = new MenuManager(apiUrl, _tokenContainer);
            Customer    = new CustomerServiceManager(apiUrl, _tokenContainer);
            MassMessage = new MassMessageManager(apiUrl, _tokenContainer);
            Template    = new TemplateManager(apiUrl, _tokenContainer);
            Material    = new MaterialManager(apiUrl, _tokenContainer);
            User        = new UserManager(apiUrl, _tokenContainer);
            Account     = new AccountManager(apiUrl, _tokenContainer);
            Card        = new CardManager(apiUrl, _tokenContainer);
        }
Beispiel #8
0
 protected void btnClear_Click(object sender, EventArgs e)
 {
     try
     {
         CustomerServiceSettings masterSettings = CustomerServiceManager.GetMasterSettings(false);
         if (masterSettings != null)
         {
             masterSettings.unitid   = "";
             masterSettings.unit     = "";
             masterSettings.password = "";
             CustomerServiceManager.Save(masterSettings);
             this.ShowMsgAndReUrl("已回到初始状态,请重新配置在线客服!", true, "SaleService.aspx");
         }
     }
     catch (Exception)
     {
     }
 }
        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失败!\"}");
                }
            }
        }
Beispiel #10
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);
     }
 }
Beispiel #11
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);
            }
        }
Beispiel #12
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;
            }
        }
Beispiel #13
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);
        }
Beispiel #14
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");
                    }
                }
            }
        }
Beispiel #15
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失败!\"}");
            }
        }
        protected override void Render(HtmlTextWriter writer)
        {
            base.Text = "";
            SiteSettings  masterSettings = SettingsManager.GetMasterSettings(false);
            StringBuilder builder        = new StringBuilder();
            bool          flag           = false;
            string        str            = string.Empty;
            string        str2           = string.Empty;

            if (masterSettings.EnableSaleService)
            {
                if (!string.IsNullOrEmpty(masterSettings.MeiQiaEntId))
                {
                    flag = true;
                    string     str3          = "name: '游客'";
                    MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                    if (currentMember == null)
                    {
                        string getCurrentWXOpenId = Globals.GetCurrentWXOpenId;
                        if (!string.IsNullOrEmpty(getCurrentWXOpenId))
                        {
                            currentMember = MemberProcessor.GetOpenIdMember(getCurrentWXOpenId, "wx");
                        }
                    }
                    if (currentMember != null)
                    {
                        StringBuilder builder2 = new StringBuilder();
                        builder2.Append("name: '" + (string.IsNullOrEmpty(currentMember.RealName) ? currentMember.UserName : currentMember.RealName) + "'");
                        if (!string.IsNullOrEmpty(currentMember.Email))
                        {
                            builder2.Append(",email: '" + currentMember.Email + "'");
                        }
                        if (!string.IsNullOrEmpty(currentMember.Address))
                        {
                            builder2.Append(",address: '" + currentMember.Address.Replace("'", "’") + "'");
                        }
                        if (!string.IsNullOrEmpty(currentMember.CellPhone))
                        {
                            builder2.Append(",tel: '" + currentMember.CellPhone + "'");
                        }
                        if (!string.IsNullOrEmpty(currentMember.QQ))
                        {
                            builder2.Append(",qq: '" + currentMember.QQ + "'");
                        }
                        MemberGradeInfo memberGrade = MemberProcessor.GetMemberGrade(currentMember.GradeId);
                        builder2.Append(",会员帐号: '" + currentMember.UserBindName + "【" + ((memberGrade != null) ? memberGrade.Name : "普通会员") + "】'");
                        builder2.Append(",注册日期: '" + currentMember.CreateDate.ToString("yyyy-MM-dd") + "'");
                        builder2.Append(",订单量: '" + currentMember.OrderNumber + "'");
                        builder2.Append(",积分: '" + currentMember.Points + "'");
                        if (currentMember.LastOrderDate.HasValue)
                        {
                            builder2.Append(",最近下单: '" + currentMember.LastOrderDate.Value.ToString("yyyy-MM-dd") + "'");
                        }
                        DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(currentMember.UserId);
                        if (userIdDistributors != null)
                        {
                            DistributorGradeInfo distributorGradeInfo = DistributorGradeBrower.GetDistributorGradeInfo(userIdDistributors.DistriGradeId);
                            string           str5            = "0.00";
                            DistributorsInfo distributorInfo = DistributorsBrower.GetDistributorInfo(userIdDistributors.UserId);
                            if (distributorInfo != null)
                            {
                                str5 = distributorInfo.ReferralBlance.ToString("F2");
                            }
                            string    str6 = "0";
                            string    str7 = "0";
                            DataTable distributorsSubStoreNum = VShopHelper.GetDistributorsSubStoreNum(userIdDistributors.UserId);
                            if ((distributorsSubStoreNum != null) || (distributorsSubStoreNum.Rows.Count > 0))
                            {
                                str6 = distributorsSubStoreNum.Rows[0]["firstV"].ToString();
                                str7 = distributorsSubStoreNum.Rows[0]["secondV"].ToString();
                            }
                            builder2.Append(",店铺名称: '" + userIdDistributors.StoreName + "【" + distributorGradeInfo.Name + "】'");
                            builder2.Append(",销售额: '¥" + userIdDistributors.OrdersTotal.ToString("F2") + "'");
                            builder2.Append(",佣金信息: '¥" + str5 + "(待提现¥" + userIdDistributors.ReferralBlance.ToString("F2") + ",已提现¥" + userIdDistributors.ReferralRequestBalance.ToString("F2") + ")'");
                            builder2.Append(",comment: '" + ("一级分店数" + str6 + ",二级分店数" + str7) + "'");
                        }
                        str3 = builder2.ToString();
                    }
                    str  = "<script>function MeiQiaInit() {$('#meiqia_serviceico').show();}(function(m, ei, q, i, a, j, s) {m[a] = m[a] || function() {(m[a].a = m[a].a || []).push(arguments)};j = ei.createElement(q),s = ei.getElementsByTagName(q)[0];j.async = true;j.charset = 'UTF-8';j.src = i + '?v=' + new Date().getUTCDate();s.parentNode.insertBefore(j, s);})(window, document, 'script', '//static.meiqia.com/dist/meiqia.js', '_MEIQIA');_MEIQIA('entId', " + masterSettings.MeiQiaEntId + ");_MEIQIA('withoutBtn');_MEIQIA('metadata', {" + str3 + "});</script><script>_MEIQIA('allSet', MeiQiaInit);</script>";
                    str2 = "<!-- 在线客服 -->\n<div class=\"customer-service\" id=\"meiqia_serviceico\" style=\"position:fixed;bottom:100px;right:10%;width:38px;height:38px;background:url(/Utility/pics/service.png?v1026) no-repeat;background-size:100%;cursor:pointer;display:none\" onclick=\"javascript:_MEIQIA._SHOWPANEL();\"></div>";
                }
                else
                {
                    CustomerServiceSettings settings2 = CustomerServiceManager.GetMasterSettings(false);
                    if ((!string.IsNullOrEmpty(settings2.unitid) && !string.IsNullOrEmpty(settings2.unit)) && !string.IsNullOrEmpty(settings2.password))
                    {
                        str  = string.Format("<script src='//meiqia.com/js/mechat.js?unitid={0}&btn=hide' charset='UTF-8' async='async'></script>", settings2.unitid);
                        flag = true;
                        builder.Append("<script type=\"text/javascript\">");
                        builder.Append("function mechatFuc()");
                        builder.Append("{");
                        builder.Append("$.get(\"/Api/Hi_Ajax_OnlineServiceConfig.ashx\", function (data) {");
                        builder.Append("if (data != \"\") {");
                        builder.Append("$(data).appendTo('head');");
                        builder.Append("}");
                        builder.Append("mechatClick();");
                        builder.Append("});");
                        builder.Append("}");
                        builder.Append("</script>");
                        str2 = "<!-- 在线客服 -->\n<div class=\"customer-service\" style=\"position:fixed;bottom:100px;right:10%;width:38px;height:38px;background:url(/Utility/pics/service.png?v1026) no-repeat;background-size:100%;cursor:pointer;\" onclick=\"javascript:mechatFuc();\"></div>";
                    }
                }
                if (flag)
                {
                    base.Text = str + "\n" + builder.ToString() + "\n" + str2;
                }
            }
            base.Render(writer);
        }