发送消息:

基于上面access_token的逻辑,在构造发送消息对象的时候请依照例如以下代码.

wechat4j和微信强力推荐的方法

CustomerMsg customerMsg = new CustomerMsg(toUserOpenId);

CustomerMsg发送消息的方法

  • sendText 发送文本消息
  • sendImage 发送图片消息
  • sendVoice 发送语音消息
  • sendVideo 发送视频消息
  • sendVideo 发送视频消息
  • sendMusic 发送音乐消息
  • sendNew 发送图文消息。单条图文消息
  • sendNews 发送图文消息

演示样例:

微信平台会在请求的post数据中带有一些參数,比如用户的openid之类的信息。当你使用了wechat4j之后。得到这些信息是很方便的。

publicclass 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()

最新文章

  1. charing animation
  2. mysql数据库学习目录
  3. WebApi2跨域问题
  4. 使用axes函数在matlab绘图中实现图中图的绘制
  5. Android学习笔记02-Mac下编译java代码
  6. LIS HDOJ 1257 最少拦截系统
  7. solr6安装部署
  8. Objective-C中的copy协议
  9. UVa1592 数据库(摘)
  10. CF-192-diy-2
  11. kafka配置记录
  12. Pong 打乒乓
  13. Java基础——Oracle(五)
  14. cisco ospf
  15. 一段刚刚出炉的CSV文件转换为DataTable对象的代码
  16. 【342】Linear Regression by Python
  17. mybatis连接数据库的几种方式
  18. Sum It Up---poj1564(dfs)
  19. [VBA]批量替换PPT里的字体颜色
  20. Softmax 函数的特点和作用

热门文章

  1. scikit-learn 为机器学习
  2. 动态调用web服务 --WSHelper.cs
  3. Jesse's Code
  4. 【Django】路由系统
  5. 把书《CUDA By Example an Introduction to General Purpose GPU Programming》读薄
  6. JS关键字 import
  7. mysql_jdbc
  8. zoj 2778 - Triangular N-Queens Problem
  9. js---12对象创建方式,构造器,原型
  10. 虚拟局域网(VLAN)技术在企业网管理中的应用