feiyu02
2022-11-15 23bd719cebe5feeff4e48fde925b0b39755eea93
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/WxUserServiceImpl.kt
@@ -183,7 +183,8 @@
        //用户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?
@@ -210,7 +211,7 @@
                        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)