java微信开发(wechat4j)——得到微信请求参数
微信平台会在请求的post数据中带有一些参数,例如用户的openid之类的信息,当你使用了wechat4j之后,得到这些信息是非常方便的。
public class Lejian extends WechatSupport{
@Override
protected void onText() {
String fromUser = this.wechatRequest.getFromUserName();
}
}
上面代码中的this.wechatRequest.getFromUserName()即可以得到微信post数据中的FromUserName节点数据.
wechatRequest可以得到的post数据
wechatRequest成员方法中get的方法,名称同微信开发文档中xml形式的post数据的节点。
getFromUserName()getContent()getCreateTime()getDescription()getLabel()getMsgIdgetEvent()getFormat()getLabel()getLocation_X()getLocation_X()getMediaId()getMsgId()getMsgType()getPicUrl()getScale()getTitle()getToUserName()getUrl()
wechat4j框架官方文档: https://github.com/sword-org/wechat4j/wiki
浙公网安备 33010602011771号