需要的类 用于反序列化
public class GuanZhuModel2
{
public int total { get; set; }
public int count { get; set; }
public OpenIdListData data { get; set; }
public string next_openid { get; set; }
}
public class OpenIdListData
{
///
/// OPENID的列表
///
public List openid { get; set; }
}
具体方法:
string returnStr = HttpUtil.Send("", "https://api.weixin.qq.com/cgi-bin/user/get?access_token=" + Convert.ToString(PayCenter.getCache("wxModelAccess")) + "&next_openid=");
var obj = JsonConvert.DeserializeObject(returnStr);
for (int i = 0; i < obj.data.openid.Count; i++)
{
var openid = Convert.ToString(obj.data.openid[i]);
UserOpen openmodel = new UserOpenDAL().GetOpenIDOrType(openid, 1);
new WXAPICommon(null, null, null).ReturnTxt(openid, "尊敬的用户,由于惠号网帐户体系升级,您的帐户类型已变更!");
if (openmodel == null)
{
WeiXinCommon.GuanZhuList.Add(new GuanZhuModel()
{
fromUserName = openid,
EventKey = ""
});
}
}