internal static IBindHandler GetHandler(AppUserAccountType type)
        {
            switch (type)
            {
            case AppUserAccountType.Login:
                return(LoginBindHandler.Instance);

            case AppUserAccountType.Email:
                return(EmailBindHandler.Instance);

            case AppUserAccountType.Phone:
                return(MobileBindHandler.Instance);

            default:
                throw new ArgumentException("绑定类型无效:type=" + (int)type);
            }
        }
        /// <summary>
        /// 用户绑定
        /// </summary>
        /// <param name="openIds"></param>
        /// <param name="batch"></param>
        /// <param name="type"></param>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        /// <param name="captcha"></param>
        /// <returns></returns>
        public BindResult Bind(Dictionary <string, string> openIds, string batch, AppUserAccountType type, string userName, string password, string captcha)
        {
            if (openIds == null && openIds.Count <= 0)
            {
                throw new Exception("openIds is empty");
            }
            if (string.IsNullOrWhiteSpace(batch))
            {
                throw new Exception("batch is null or empty");
            }
            if (string.IsNullOrWhiteSpace(userName))
            {
                throw new Exception("userName is null or empty");
            }

            userName = userName.Replace(" ", "");
            var handler = BindHandlerFactory.GetHandler(type);

            return(handler.Bind(openIds, batch, userName, password, captcha));
        }