Пример #1
0
        /// <summary>
        /// 获取用户信息返回给客户端,客户端与其他信息组成扩展字段发送给网易云信平台
        /// </summary>
        /// <returns></returns>
        protected string GetExtendParam()
        {
            string result = string.Format("{0}-{1}-{2}-{3}", userid, (int)platform, systemtype, appVersion);

            result = NH.Commons.DataConvert.ConvertStringToBase64(result);
            if (DataConvert.ConvertStringToByte(result).Length < 1024)
            {
                return(result);
            }
            else
            {
                return(string.Empty);
            }
        }
Пример #2
0
        /// <summary>
        /// 获取用户信息返回给客户端,客户端与其他信息组成扩展字段发送给网易云信平台
        /// </summary>
        /// <param name="tokenBase64">Token值</param>
        /// <param name="platform">平台类型: 3妈妈FM; 4育儿大师专家版; 8育儿大师用户版;</param>
        /// <param name="systemType">系统类型:0表示未知,1表示IOS; 2表示Andriod; 3表示windowPhone,4表示H5专家登录,5表示H5用户登录</param>
        /// <param name="appVersion">app版本号</param>
        /// <returns></returns>
        protected string GetExtendParam(string tokenBase64, int platform, int systemType, string appVersion)
        {
            string result = null;

            NH.Entity.Model.Token token = NH.Service.Api.TokenService.GetInstance().GetToken(tokenBase64);
            if (token != null)
            {
                if (!token.IsOverdue && token.IsValidSecretKey && token.UserID > 0)
                {
                    string[] array = { userid.ToString(), "-", platform.ToString(), "-", systemtype.ToString(), "-", appVersion };
                    result = NH.Commons.DataConvert.ConvertStringToBase64(string.Concat(array));
                    if (DataConvert.ConvertStringToByte(result).Length < 1024)
                    {
                        return(result);
                    }
                }
            }
            return(result);
        }