Пример #1
0
        private void SaveCustomerAppsInfo()
        {
            this.Data = new Dictionary <object, object>();
            int code       = 0;
            int customerid = this.GetFormValue("customerid", 0);

            if (customerid > 0)
            {
                string jsoncontent = Server.UrlDecode(this.GetFormValue("jsoncontent", ""));
                if (!jsoncontent.StrIsNull())
                {
                    System.Text.StringBuilder strCustomHtml = new System.Text.StringBuilder();
                    JContainer jc    = (JContainer)JsonConvert.DeserializeObject(jsoncontent);
                    JToken     token = jc["apps"];
                    List <UserInfoMicroAppModel> listModel = new List <UserInfoMicroAppModel>();
                    for (int i = 0; i < token.Count(); i++)
                    {
                        UserInfoMicroAppModel _am = new UserInfoMicroAppModel();
                        _am.ID            = Convert.ToInt32(token[i]["id"].ToString());
                        _am.AppSecret     = token[i]["appsecret"].ToString();
                        _am.AppID         = token[i]["appid"].ToString();
                        _am.AppType       = Convert.ToInt32(token[i]["apptype"].ToString());
                        _am.AppCustomerID = customerid;
                        listModel.Add(_am);
                    }
                    if (listModel != null && listModel.Count() > 0)
                    {
                        if (IUserInfo.Instance.SetCustomerPullicAccountAppsInfo(listModel))
                        {
                            code = 1;
                        }
                    }
                }
            }
            else
            {
                code = 0;
            }
            this.Data["code"] = code;
            string json = GetJson(this.Data);

            Response.Write(json);
            Response.End();
        }
Пример #2
0
        private void SaveCustomerBaseInfo()
        {
            this.Data = new Dictionary <object, object>();
            int code = 0;

            int customerid = this.GetFormValue("customerid", 0);

            Micro.AdminConfig.Model.UserInfoModel userinfo = new Micro.AdminConfig.Model.UserInfoModel();
            userinfo.UserLoginName       = Server.UrlDecode(this.GetFormValue("loginName", ""));
            userinfo.UserLoginPassword   = this.GetFormValue("loginPwd", "");
            userinfo.UserNickName        = Server.UrlDecode(this.GetFormValue("realName", ""));
            userinfo.UserIndustryType    = this.GetFormValue("industryid", 0);
            userinfo.UserActivate        = this.GetFormValue("activate", 1);
            userinfo.UserBelongManagerID = Convert.ToInt32(CookieHelper.GetCookieVal(Enum.GetName(typeof(CookieKeyValue), CookieKeyValue.UserID)));
            userinfo.UserLastLoginIP     = "0.0.0.0";
            userinfo.UserID     = this.GetFormValue("customerid", 0);
            userinfo.UserRoleID = -2;
            userinfo.UserCityID = this.GetFormValue("cityid", 0);

            userinfo.UserIsSmsService = this.GetFormValue("sms", 0);
            userinfo.UserMoney        = this.GetFormValue("money", "0");
            userinfo.UserPrice        = this.GetFormValue("price", "1");
            userinfo.SubDomain        = this.GetFormValue("myDomain", "");
            string jsoncontent = Server.UrlDecode(this.GetFormValue("jsoncontent", ""));


            int flag = 0;

            if (customerid > 0)
            {
                flag = ICustomer.Instance.UpdateCustomerInfoV2(userinfo);
                ICustomerCommonConfig.Intance.AddDefaultConfig(customerid);
                code = 1;
            }
            else
            {
                userinfo.UserDeveloperUrl   = Server.UrlDecode(this.GetFormValue("developerurl", ""));
                userinfo.UserDeveloperToken = this.GetFormValue("developertoken", "");

                userinfo.UserIsOld = this.GetFormValue("version", 1);
                flag = ICustomer.Instance.AddCustomerInfoV2(userinfo);
                if (flag > 0)
                {
                    ICustomerCommonConfig.Intance.AddDefaultConfig(flag);
                    UserBaseInfoService.Instance.AddDefaultBuddy(userinfo.UserLoginName, EncryptHelper.MD5(userinfo.UserLoginPassword), flag);
                    string strReg = "key=(?<key>.*?)&";
                    Match  m      = Regex.Match(userinfo.UserDeveloperUrl, strReg);
                    if (m.Success)
                    {
                        string key = m.Groups["key"].Value;
                        IUserInfo.Instance.SetDeveloperPatternRecord(key, userinfo.UserDeveloperToken, flag);
                    }

                    code       = 1;
                    customerid = flag;
                }
            }

            if (code == 1)
            {
                if (!jsoncontent.StrIsNull())
                {
                    System.Text.StringBuilder strCustomHtml = new System.Text.StringBuilder();
                    JContainer jc    = (JContainer)JsonConvert.DeserializeObject(jsoncontent);
                    JToken     token = jc["apps"];
                    List <UserInfoMicroAppModel> listModel = new List <UserInfoMicroAppModel>();
                    for (int i = 0; i < token.Count(); i++)
                    {
                        UserInfoMicroAppModel _am = new UserInfoMicroAppModel();
                        _am.ID            = Convert.ToInt32(token[i]["id"].ToString());
                        _am.AppID         = token[i]["appid"].ToString();
                        _am.AppKey        = token[i]["appkey"].ToString();
                        _am.AppSecret     = token[i]["appsecret"].ToString();
                        _am.AppTitle      = token[i]["apptitle"].ToString();
                        _am.AppType       = Convert.ToInt32(token[i]["apptype"].ToString());
                        _am.AppCustomerID = customerid;
                        listModel.Add(_am);
                    }
                    if (listModel != null && listModel.Count() > 0)
                    {
                        IUserInfo.Instance.SetCustomerPullicAccount(listModel);
                    }
                }
            }

            this.Data["code"] = code;
            string json = GetJson(this.Data);

            Response.Write(json);
            Response.End();
        }