| | |
| | | //用户openid |
| | | val openId = (json["FromUserName"] as String?) ?: throw NullPointerException("微信服务器发送的订阅返回消息FromUserName字段为null") |
| | | //时间戳 |
| | | val createTime = (json["CreateTime"] as Int?) ?: throw NullPointerException("微信服务器发送的订阅返回消息CreateTime字段为null") |
| | | var createTime = (json["CreateTime"] as Int?)?.toLong() ?: throw NullPointerException("微信服务器发送的订阅返回消息CreateTime字段为null") |
| | | createTime = createTime.times(1000)//此处传过来的时间戳只精确到秒,转换为毫秒 |
| | | //事件类型,此处应该都是event |
| | | val msgType = json["MsgType"] as String? |
| | | |
| | |
| | | val templateId = it["TemplateId"] as String? |
| | | val sStatus = it["SubscribeStatusString"] as String? |
| | | //根据时间和用户openId,判断此次操作是否重复 |
| | | val time = Date(createTime.toLong() * 1000) |
| | | val time = Date(createTime.toLong()) |
| | | val records = msgSubscribeWxMapper.selectByExample(Example(MsgSubscribeWx::class.java).apply { |
| | | createCriteria().andEqualTo("msOpenId", openId) |
| | | .andEqualTo("msTemplateId", templateId) |