/// <summary> /// 主动给用户发消息(用户) /// </summary> /// <param name="msg"></param> /// <param name="access_token">access_token</param> /// <returns>errcode=0为成功</returns> public static ReturnCode SendMsg(SendBaseMsg msg, string access_token) { string url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" + access_token; var json = msg.GetJSON(); var retJson = Util.HttpPost2(url, json); return(Util.JsonTo <ReturnCode>(retJson)); }
/// <summary> /// 主动给用户发消息(用户),用会SetGlobalCredential方法设置的appId和appSecret来得到access_token /// </summary> /// <param name="msg"></param> /// <returns></returns> public static ReturnCode SendMsg(SendBaseMsg msg) { CheckGlobalCredential(); return(SendMsg(msg, AppID, AppSecret)); }