/// <summary> /// 获取签名 /// </summary> /// <param name="url">网址</param> /// <param name="apiKeyInfo">取用的Api密钥</param> /// <returns></returns> public static string GetSign(string url, ApiKeyInfo apiKeyInfo = null) { if (apiKeyInfo == null) { apiKeyInfo = AndroidKey; } string result; if (url.StartsWith("http")) { url.Substring(url.IndexOf("?", 4) + 1); } List <string> list = url.Split('&').ToList(); list.Sort(); StringBuilder stringBuilder = new StringBuilder(); foreach (string str1 in list) { stringBuilder.Append((stringBuilder.Length > 0 ? "&" : string.Empty)); stringBuilder.Append(str1); } stringBuilder.Append(apiKeyInfo.Secret); result = MD5Tool.GetMd5String(stringBuilder.ToString()).ToLower(); System.Diagnostics.Debug.WriteLine("sign=" + result); return(result); }