weixin.popular.bean.message.massmessage.MassMusicMessage 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.
package weixin.popular.bean.message.massmessage;
import java.util.HashMap;
import java.util.Map;
import weixin.popular.bean.message.preview.MusicPreview;
import weixin.popular.bean.message.preview.Preview;
public class MassMusicMessage extends MassMessage{
private Map music;
public MassMusicMessage(String media_id) {
super();
music = new HashMap();
music.put("media_id",media_id);
super.msgtype = "music";
}
public Map getMusic() {
return music;
}
public void setMusic(Map music) {
this.music = music;
}
@Override
public Preview convert() {
//转为 Preview,官方未说明该类型
Preview preview = new MusicPreview(music.get("media_id"));
if(this.getTouser()!=null && this.getTouser().size()>0){
preview.setTouser(this.getTouser().iterator().next());
}
return preview;
}
}