通常at每天调用次数是2000次,通常是不用考虑这个的次数的,但是如果网站用的人多了,有可能超过这个次数,那么就要考虑了。
at的生命周期是2小时,有一种说法是通过getcallbackip来测试at是否可用,还说这个getcallbackip是没有使用限制的,然而,用过之后就出现问题了
{"errcode":45009,"errmsg":"reach max api daily quota limit hint: [lG_Oua0474vr61!]"}
很明显getcallbackip是有限制的,网上那种用法纯属误导。
//经测试,getcallbackip的方式每天也是有限制的
string text = "https://api.weixin.qq.com/cgi-bin/getcallbackip?access_token=" + at;
string json字符串 = HttpService.Get(text);
string errcode = this.ty.GetJsonStrValue(json字符串, "errcode");
if (errcode == "you made error,Man!")
return true;
else
return false;
正确的用法是将at存到数据库,通过控制台每2小时(建议提前几分钟)清空一次,程序判断数据库的at为空就生成一遍at
string aT = s.sql_select("select str from access_token where id=1", 0, 0);
if (at.isEmptyOrNullOrUndefine())
return false;
else
return true;