微信平台会在请求的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()
  • getMsgId
  • getEvent()
  • getFormat()
  • getLabel()
  • getLocation_X()
  • getLocation_X()
  • getMediaId()
  • getMsgId()
  • getMsgType()
  • getPicUrl()
  • getScale()
  • getTitle()
  • getToUserName()
  • getUrl()

wechat4j框架官方文档: https://github.com/sword-org/wechat4j/wiki

相关文章:

  • 2021-12-18
  • 2022-12-23
  • 2021-12-26
  • 2021-11-15
  • 2021-11-28
  • 2022-12-23
  • 2021-04-16
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
相关资源
相似解决方案