src/main/java/io/github/biezhi/wechat/api/WeChatApiImpl.java
private void webInit() {
        log.info("微信初始化...");
        int r = (int) (-System.currentTimeMillis() / 1000) / 1579;
        String url = String.format("%s/webwxinit?r=%d&pass_ticket=%s",
                bot.session().getUrl(), r, bot.session().getPassTicket());

        JsonResponse response = this.client.send(new JsonRequest(url).post().jsonBody()
                .add("BaseRequest", bot.session().getBaseRequest()));

        WebInitResponse webInitResponse = response.parse(WebInitResponse.class);

        List<Account> contactList = webInitResponse.getContactList();
        this.syncRecentContact(contactList);

        Account account = webInitResponse.getAccount();
        SyncKey syncKey = webInitResponse.getSyncKey();

        bot.session().setInviteStartCount(webInitResponse.getInviteStartCount());
        bot.session().setAccount(account);
        bot.session().setUserName(account.getUserName());
        bot.session().setNickName(account.getNickName());
        bot.session().setSyncKey(syncKey);
    }
private void webInit() {
        log.info("微信初始化...");
        int r = (int) (-System.currentTimeMillis() / 1000) / 1579;
        String url = String.format("%s/webwxinit?r=%d&pass_ticket=%s",
                bot.session().getUrl(), r, bot.session().getPassTicket());

        JsonResponse response = this.client.send(new JsonRequest(url).post().jsonBody()
                .add("BaseRequest", bot.session().getBaseRequest()));

        WebInitResponse webInitResponse = response.parse(WebInitResponse.class);

        List<Account> contactList = webInitResponse.getContactList();
        this.syncRecentContact(contactList);

        Account account = webInitResponse.getAccount();
        SyncKey syncKey = webInitResponse.getSyncKey();

        bot.session().setInviteStartCount(webInitResponse.getInviteStartCount());
        bot.session().setAccount(account);
        bot.session().setUserName(account.getUserName());
        bot.session().setNickName(account.getNickName());
        bot.session().setSyncKey(syncKey);
    }
private void webInit ( ) { log . info ( "微信初始化..."); int r = ( int ) ( - System . currentTimeMillis ( ) / 1000 ) / 1579 ; String url = String . format ( "%s/webwxinit?r=%d&pass_ticket=%s" , bot . session ( ) . getUrl ( ) , r , bot . session ( ) . getPassTicket ( ) ) ; JsonResponse response = this . client . send ( new JsonRequest ( url ) . post ( ) . jsonBody ( ) . add ( "BaseRequest" , bot . session ( ) . getBaseRequest ( ) ) ) ; WebInitResponse webInitResponse = response . parse ( WebInitResponse . class ) ; List < Account > contactList = webInitResponse . getContactList ( ) ; this . syncRecentContact ( contactList ) ; Account account = webInitResponse . getAccount ( ) ; SyncKey syncKey = webInitResponse . getSyncKey ( ) ; bot . session ( ) . setInviteStartCount ( webInitResponse . getInviteStartCount ( ) ) ; bot . session ( ) . setAccount ( account ) ; bot . session ( ) . setUserName ( account . getUserName ( ) ) ; bot . session ( ) . setNickName ( account . getNickName ( ) ) ; bot . session ( ) . setSyncKey ( syncKey ) ; }
web 初始化
web 初始化