public class WxMpMaterialServiceImpl extends Object implements WxMpMaterialService
| 构造器和说明 |
|---|
WxMpMaterialServiceImpl(WxMpService wxMpService) |
| 限定符和类型 | 方法和说明 |
|---|---|
WxMpMaterialCountResult |
materialCount()
获取各类素材总数
详情请见: http://mp.weixin.qq.com/wiki/16/8cc64f8c189674b421bee3ed403993b8.html
|
boolean |
materialDelete(String media_id)
删除永久素材
详情请见: http://mp.weixin.qq.com/wiki/5/e66f61c303db51a6c0f90f46b15af5f5.html
|
WxMpMaterialFileBatchGetResult |
materialFileBatchGet(String type,
int offset,
int count)
分页获取其他媒体素材列表
详情请见: http://mp.weixin.qq.com/wiki/12/2108cd7aafff7f388f41f37efa710204.html
|
WxMpMaterialUploadResult |
materialFileUpload(String mediaType,
WxMpMaterial material)
上传非图文永久素材
上传的多媒体文件有格式和大小限制,如下:
图片(image): 图片大小不超过2M,支持bmp/png/jpeg/jpg/gif格式
语音(voice):语音大小不超过5M,长度不超过60秒,支持mp3/wma/wav/amr格式
视频(video):在上传视频素材时需要POST另一个表单,id为description,包含素材的描述信息,内容格式为JSON
缩略图(thumb):文档未说明
详情请见: http://mp.weixin.qq.com/wiki/14/7e6c03263063f4813141c3e17dd4350a.html
|
InputStream |
materialImageOrVoiceDownload(String media_id)
下载声音或者图片永久素材
详情请见: http://mp.weixin.qq.com/wiki/4/b3546879f07623cb30df9ca0e420a5d0.html
|
WxMpMaterialNewsBatchGetResult |
materialNewsBatchGet(int offset,
int count)
分页获取图文素材列表
详情请见: http://mp.weixin.qq.com/wiki/12/2108cd7aafff7f388f41f37efa710204.html
|
WxMpMaterialNews |
materialNewsInfo(String media_id)
获取图文永久素材的信息
详情请见: http://mp.weixin.qq.com/wiki/4/b3546879f07623cb30df9ca0e420a5d0.html
|
boolean |
materialNewsUpdate(WxMpMaterialArticleUpdate wxMpMaterialArticleUpdate)
更新图文永久素材
详情请见: http://mp.weixin.qq.com/wiki/4/19a59cba020d506e767360ca1be29450.html
|
WxMpMaterialUploadResult |
materialNewsUpload(WxMpMaterialNews news)
上传永久图文素材
详情请见: http://mp.weixin.qq.com/wiki/14/7e6c03263063f4813141c3e17dd4350a.html
|
WxMpMaterialVideoInfoResult |
materialVideoInfo(String media_id)
获取视频永久素材的信息和下载地址
详情请见: http://mp.weixin.qq.com/wiki/4/b3546879f07623cb30df9ca0e420a5d0.html
|
File |
mediaDownload(String media_id)
获取临时素材
本接口即为原“下载多媒体文件”接口。
|
WxMediaImgUploadResult |
mediaImgUpload(File file)
上传图文消息内的图片获取URL
详情请见:http://mp.weixin.qq.com/wiki/15/40b6865b893947b764e2de8e4a1fb55f.html#.E4.B8.8A.E4.BC.A0.E5.9B.BE.E6.96.87.E6.B6.88.E6.81.AF.E5.86.85.E7.9A.84.E5.9B.BE.E7.89.87.E8.8E.B7.E5.8F.96URL.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8E.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.9D.87.E5.8F.AF.E7.94.A8.E3.80.91
|
WxMediaUploadResult |
mediaUpload(String mediaType,
File file)
新增临时素材
|
WxMediaUploadResult |
mediaUpload(String mediaType,
String fileType,
InputStream inputStream)
新增临时素材
本接口即为原“上传多媒体文件”接口。
|
public WxMpMaterialServiceImpl(WxMpService wxMpService)
public WxMediaUploadResult mediaUpload(String mediaType, String fileType, InputStream inputStream) throws WxErrorException, IOException
WxMpMaterialService新增临时素材 本接口即为原“上传多媒体文件”接口。 上传的多媒体文件有格式和大小限制,如下: 图片(image): 1M,支持JPG格式 语音(voice):2M,播放长度不超过60s,支持AMR\MP3格式 视频(video):10MB,支持MP4格式 缩略图(thumb):64KB,支持JPG格式 详情请见: 新增临时素材
mediaUpload 在接口中 WxMpMaterialServicemediaType - 媒体类型, 请看WxConstsfileType - 文件类型,请看WxConstsinputStream - 输入流WxErrorExceptionIOExceptionpublic WxMediaUploadResult mediaUpload(String mediaType, File file) throws WxErrorException
WxMpMaterialServicepublic File mediaDownload(String media_id) throws WxErrorException
WxMpMaterialService获取临时素材 本接口即为原“下载多媒体文件”接口。 根据微信文档,视频文件下载不了,会返回null 详情请见: 获取临时素材
mediaDownload 在接口中 WxMpMaterialServiceWxErrorExceptionpublic WxMediaImgUploadResult mediaImgUpload(File file) throws WxErrorException
WxMpMaterialService上传图文消息内的图片获取URL 详情请见:http://mp.weixin.qq.com/wiki/15/40b6865b893947b764e2de8e4a1fb55f.html#.E4.B8.8A.E4.BC.A0.E5.9B.BE.E6.96.87.E6.B6.88.E6.81.AF.E5.86.85.E7.9A.84.E5.9B.BE.E7.89.87.E8.8E.B7.E5.8F.96URL.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8E.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.9D.87.E5.8F.AF.E7.94.A8.E3.80.91
mediaImgUpload 在接口中 WxMpMaterialServiceWxErrorExceptionpublic WxMpMaterialUploadResult materialFileUpload(String mediaType, WxMpMaterial material) throws WxErrorException
WxMpMaterialService上传非图文永久素材 上传的多媒体文件有格式和大小限制,如下: 图片(image): 图片大小不超过2M,支持bmp/png/jpeg/jpg/gif格式 语音(voice):语音大小不超过5M,长度不超过60秒,支持mp3/wma/wav/amr格式 视频(video):在上传视频素材时需要POST另一个表单,id为description,包含素材的描述信息,内容格式为JSON 缩略图(thumb):文档未说明 详情请见: http://mp.weixin.qq.com/wiki/14/7e6c03263063f4813141c3e17dd4350a.html
materialFileUpload 在接口中 WxMpMaterialServicemediaType - 媒体类型, 请看WxConstsmaterial - 上传的素材, 请看WxMpMaterialWxErrorExceptionpublic WxMpMaterialUploadResult materialNewsUpload(WxMpMaterialNews news) throws WxErrorException
WxMpMaterialService上传永久图文素材 详情请见: http://mp.weixin.qq.com/wiki/14/7e6c03263063f4813141c3e17dd4350a.html
materialNewsUpload 在接口中 WxMpMaterialServicenews - 上传的图文消息, 请看WxMpMaterialNewsWxErrorExceptionpublic InputStream materialImageOrVoiceDownload(String media_id) throws WxErrorException
WxMpMaterialService下载声音或者图片永久素材 详情请见: http://mp.weixin.qq.com/wiki/4/b3546879f07623cb30df9ca0e420a5d0.html
materialImageOrVoiceDownload 在接口中 WxMpMaterialServicemedia_id - 永久素材的idWxErrorExceptionpublic WxMpMaterialVideoInfoResult materialVideoInfo(String media_id) throws WxErrorException
WxMpMaterialService获取视频永久素材的信息和下载地址 详情请见: http://mp.weixin.qq.com/wiki/4/b3546879f07623cb30df9ca0e420a5d0.html
materialVideoInfo 在接口中 WxMpMaterialServicemedia_id - 永久素材的idWxErrorExceptionpublic WxMpMaterialNews materialNewsInfo(String media_id) throws WxErrorException
WxMpMaterialService获取图文永久素材的信息 详情请见: http://mp.weixin.qq.com/wiki/4/b3546879f07623cb30df9ca0e420a5d0.html
materialNewsInfo 在接口中 WxMpMaterialServicemedia_id - 永久素材的idWxErrorExceptionpublic boolean materialNewsUpdate(WxMpMaterialArticleUpdate wxMpMaterialArticleUpdate) throws WxErrorException
WxMpMaterialService更新图文永久素材 详情请见: http://mp.weixin.qq.com/wiki/4/19a59cba020d506e767360ca1be29450.html
materialNewsUpdate 在接口中 WxMpMaterialServicewxMpMaterialArticleUpdate - 用来更新图文素材的bean, 请看WxMpMaterialArticleUpdateWxErrorExceptionpublic boolean materialDelete(String media_id) throws WxErrorException
WxMpMaterialService删除永久素材 详情请见: http://mp.weixin.qq.com/wiki/5/e66f61c303db51a6c0f90f46b15af5f5.html
materialDelete 在接口中 WxMpMaterialServicemedia_id - 永久素材的idWxErrorExceptionpublic WxMpMaterialCountResult materialCount() throws WxErrorException
WxMpMaterialService获取各类素材总数 详情请见: http://mp.weixin.qq.com/wiki/16/8cc64f8c189674b421bee3ed403993b8.html
materialCount 在接口中 WxMpMaterialServiceWxErrorExceptionpublic WxMpMaterialNewsBatchGetResult materialNewsBatchGet(int offset, int count) throws WxErrorException
WxMpMaterialService分页获取图文素材列表 详情请见: http://mp.weixin.qq.com/wiki/12/2108cd7aafff7f388f41f37efa710204.html
materialNewsBatchGet 在接口中 WxMpMaterialServiceoffset - 从全部素材的该偏移位置开始返回,0表示从第一个素材 返回count - 返回素材的数量,取值在1到20之间WxErrorExceptionpublic WxMpMaterialFileBatchGetResult materialFileBatchGet(String type, int offset, int count) throws WxErrorException
WxMpMaterialService分页获取其他媒体素材列表 详情请见: http://mp.weixin.qq.com/wiki/12/2108cd7aafff7f388f41f37efa710204.html
materialFileBatchGet 在接口中 WxMpMaterialServicetype - 媒体类型, 请看WxConstsoffset - 从全部素材的该偏移位置开始返回,0表示从第一个素材 返回count - 返回素材的数量,取值在1到20之间WxErrorExceptionCopyright © 2016. All rights reserved.