代码拉取完成,页面将自动刷新
package media
import (
"gitee.com/h79/gothird/token"
"gitee.com/h79/goutils/common"
"gitee.com/h79/goutils/common/stringutil"
"mime/multipart"
"path"
"path/filepath"
"strings"
)
type ID struct {
Type string `json:"type,omitempty"`
MediaId string `json:"media_id"`
CreatedAt interface{} `json:"created_at,omitempty"` //企业微信为字符串,公众号为int64
}
func (i *ID) StringCreateAt() string {
return stringutil.ToString(i.CreatedAt)
}
func (i *ID) Int64CreateAt() int64 {
return common.ToInt64(i.CreatedAt)
}
type News struct {
Title string `json:"title"`
ThumbMediaId string `json:"thumb_media_id"`
Author string `json:"author"`
Digest string `json:"digest"`
ShowCoverPic int8 `json:"show_cover_pic"`
Content string `json:"content"`
ContentSourceUrl string `json:"content_source_url"`
NeedOpenComment int8 `json:"need_open_comment"`
OnlyFansCanComment int8 `json:"only_fans_can_comment"`
}
type Articles struct {
Articles []News `json:"articles"`
}
type NewsResult struct {
Title string `json:"title"`
ThumbMediaId string `json:"thumb_media_id"`
Author string `json:"author"`
Digest string `json:"digest"`
ShowCoverPic int8 `json:"show_cover_pic"`
Content string `json:"content"`
Url string `json:"url"`
Description string `json:"description"`
DownUrl string `json:"down_url"`
ContentSourceUrl string `json:"content_source_url"`
NeedOpenComment int8 `json:"need_open_comment"`
OnlyFansCanComment int8 `json:"only_fans_can_comment"`
}
type ArticlesResult struct {
Items []NewsResult `json:"news_item"`
FileName
}
type FileName struct {
Raw []byte // 其他类型的素材消息,则响应的直接为素材的内容,开发者可以自行保存为文件
File string
}
type Image struct {
Field string
FileName string
}
func (u *Image) CreateForm(w *multipart.Writer, field string) error {
if u.Field != "" {
field = u.Field
}
if field == "" {
//获取文件
field = filepath.Base(u.FileName)
fileSuffix := path.Ext(field)
field = strings.TrimSuffix(field, fileSuffix)
}
return token.DefaultForm(w, field, u.FileName)
}
type BigFile struct {
Scene int `json:"scene"`
Type string `json:"type"`
Filename string `json:"filename"`
Url string `json:"url"`
Md5 string `json:"md5"`
}
type BigJob struct {
Status int `json:"status"`
Detail struct {
Errcode int `json:"errcode"`
Errmsg string `json:"errmsg"`
MediaId string `json:"media_id"`
CreatedAt string `json:"created_at"`
} `json:"detail"`
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。