src/main/java/io/github/biezhi/wechat/api/WeChatApiImpl.java
@Override
    public WebSyncResponse webSync() {
        String url = String.format("%s/webwxsync?sid=%s&sKey=%s&passTicket=%s",
                bot.session().getUrl(), bot.session().getWxSid(),
                bot.session().getSKey(), bot.session().getPassTicket());

        JsonResponse response = this.client.send(new JsonRequest(url).post().jsonBody()
                .add("BaseRequest", bot.session().getBaseRequest())
                .add("SyncKey", bot.session().getSyncKey())
                .add("rr", ~(System.currentTimeMillis() / 1000)));

        WebSyncResponse webSyncResponse = response.parse(WebSyncResponse.class);
        if (!webSyncResponse.success()) {
            log.warn("获取消息失败");
            return webSyncResponse;
        }
        bot.session().setSyncKey(webSyncResponse.getSyncKey());
        return webSyncResponse;
    }
@Override
    public WebSyncResponse webSync() {
        String url = String.format("%s/webwxsync?sid=%s&sKey=%s&passTicket=%s",
                bot.session().getUrl(), bot.session().getWxSid(),
                bot.session().getSKey(), bot.session().getPassTicket());

        JsonResponse response = this.client.send(new JsonRequest(url).post().jsonBody()
                .add("BaseRequest", bot.session().getBaseRequest())
                .add("SyncKey", bot.session().getSyncKey())
                .add("rr", ~(System.currentTimeMillis() / 1000)));

        WebSyncResponse webSyncResponse = response.parse(WebSyncResponse.class);
        if (!webSyncResponse.success()) {
            log.warn("获取消息失败");
            return webSyncResponse;
        }
        bot.session().setSyncKey(webSyncResponse.getSyncKey());
        return webSyncResponse;
    }
@ Override public WebSyncResponse webSync ( ) { String url = String . format ( "%s/webwxsync?sid=%s&sKey=%s&passTicket=%s" , bot . session ( ) . getUrl ( ) , bot . session ( ) . getWxSid ( ) , bot . session ( ) . getSKey ( ) , bot . session ( ) . getPassTicket ( ) ) ; JsonResponse response = this . client . send ( new JsonRequest ( url ) . post ( ) . jsonBody ( ) . add ( "BaseRequest" , bot . session ( ) . getBaseRequest ( ) ) . add ( "SyncKey" , bot . session ( ) . getSyncKey ( ) ) . add ( "rr" , ~ ( System . currentTimeMillis ( ) / 1000 ) ) ) ; WebSyncResponse webSyncResponse = response . parse ( WebSyncResponse . class ) ; if ( ! webSyncResponse . success ( ) ) { log . warn ( "获取消息失败"); return webSyncResponse ; } bot . session ( ) . setSyncKey ( webSyncResponse . getSyncKey ( ) ) ; return webSyncResponse ; }
获取最新消息

@return WebSyncResponse
获取最新消息