1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-14 01:32:27 +08:00

oauth2,jssdk

This commit is contained in:
wenzl
2016-09-15 01:27:28 +08:00
parent 3854bb0487
commit 4333691b37
21 changed files with 913 additions and 43 deletions

35
message/news.go Normal file
View File

@@ -0,0 +1,35 @@
package message
//News 图文消息
type News struct {
CommonToken
ArticleCount int `xml:"ArticleCount"`
Articles []*Article `xml:"Articles>item,omitempty"`
}
//NewNews 初始化图文消息
func NewNews(articles []*Article) *News {
news := new(News)
news.ArticleCount = len(articles)
news.Articles = articles
return news
}
//Article 单篇文章
type Article struct {
Title string `xml:"Title,omitempty"`
Description string `xml:"Description,omitempty"`
PicURL string `xml:"PicUrl,omitempty"`
URL string `xml:"Url,omitempty"`
}
//NewArticle 初始化文章
func NewArticle(title, description, picURL, url string) *Article {
article := new(Article)
article.Title = title
article.Description = description
article.PicURL = picURL
article.URL = url
return article
}