/// <summary> /// 生成图文信息Json /// </summary> /// <param name="Messageid"></param> /// <returns></returns> public static string GetArticlesJsonStr(Guid Messageid) { WX_Message Messages = WX_MessageService.instance().Single(Messageid); StringBuilder sbArticlesJson = new StringBuilder(); // articles if (Messages.Groups.Count() > 0) { List <articles> list = new List <articles>(); foreach (var item in Messages.Groups) { articles a = new articles(); a.title = item.Title; a.author = item.Author; a.content = item.Content; a.content_source_url = item.URL; a.digest = ""; a.show_cover_pic = 0; a.thumb_media_id = item.Img_media_id; list.Add(a); } sbArticlesJson.Append("{\"articles\":"); sbArticlesJson.Append(JsonHelper.SerializeObject(list)); sbArticlesJson.Append("}"); return(sbArticlesJson.ToString()); } return(""); }
public static WX_MessageService instance() { if (_instance == null) { _instance = new WX_MessageService(); } return(_instance); }