weixin.popular.bean.xmlmessage.XMLMusicMessage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of weixin-popular Show documentation
Show all versions of weixin-popular Show documentation
The weixin-popular is a JAVA SDK for weixin. Weixin web url is https://mp.weixin.qq.com.
The newest version!
package weixin.popular.bean.xmlmessage;
import weixin.popular.bean.message.message.Message;
import weixin.popular.bean.message.message.MusicMessage;
import weixin.popular.bean.message.message.MusicMessage.Music;
public class XMLMusicMessage extends XMLMessage {
private static final long serialVersionUID = 4423743864197488630L;
private String title;
private String description;
private String musicUrl;
private String hQMusicUrl;
private String thumbMediaId;
/**
*
* @param toUserName
* toUserName
* @param fromUserName
* fromUserName
* @param title
* [可以为空]
* @param description
* [可以为空]
* @param musicUrl
* [可以为空] 音乐链接
* @param hQMusicUrl
* [可以为空] 高质量音乐链接,WIFI环境优先使用该链接播放音乐
* @param thumbMediaId
* 缩略图的媒体id,通过上传多媒体文件,得到的id
*/
public XMLMusicMessage(String toUserName, String fromUserName, String title, String description, String musicUrl,
String hQMusicUrl, String thumbMediaId) {
super(toUserName, fromUserName, "music");
this.title = title;
this.description = description;
this.musicUrl = musicUrl;
this.hQMusicUrl = hQMusicUrl;
this.thumbMediaId = thumbMediaId;
}
@Override
public String subXML() {
StringBuilder sb = new StringBuilder();
sb.append("");
sb.append(" ");
sb.append(" ");
sb.append(" ");
sb.append(" ");
sb.append(" ");
sb.append(" ");
return sb.toString();
}
@Override
public Message convert() {
Music music = new Music(title, description, musicUrl, hQMusicUrl, thumbMediaId);
return new MusicMessage(toUserName, music);
}
}