参数说明:
access_token:是公众号的access_token
encrypt_code:是通过wx.addCard()得到的code的值,
具体的代码如下:
public static string DecryptCode(string access_token, string encrypt_code)
{
var url = string.Format("https://api.weixin.qq.com/card/code/decrypt?access_token={0}", access_token);
var client = new HttpClient();
var sb = new StringBuilder();
sb.Append("{")
.Append('"' + "encrypt_code" + '"' + ":").Append(encrypt_code)
.Append("}");
var result = client.PostAsync(url, new StringContent(sb.ToString())).Result;
if (result.IsSuccessStatusCode) return string.Empty;
return DynamicJson.Parse(result.Content.ReadAsStringAsync().Result);
}
但是最终报错:40075:invalid encrypt code hint!
Code的值不是应该是code的值得吗?