src/main/java/io/github/biezhi/wechat/api/WeChatApiImpl.java
@Override
    public void loadContact(int seq) {
        log.info("开始获取联系人信息");
        while (true) {
            String url = String.format("%s/webwxgetcontact?r=%s&seq=%s&skey=%s",
                    bot.session().getUrl(), System.currentTimeMillis(),
                    seq, bot.session().getSKey());

            JsonResponse response = this.client.send(new JsonRequest(url).jsonBody());

            JsonObject jsonObject = response.toJsonObject();
            seq = jsonObject.get("Seq").getAsInt();

            this.memberCount += jsonObject.get("MemberCount").getAsInt();
            List<Account> memberList = WeChatUtils.fromJson(WeChatUtils.toJson(jsonObject.getAsJsonArray("MemberList")), new TypeToken<List<Account>>() {});

            for (Account account : memberList) {
                if (null == account.getUserName()) {
                    accountMap.put(account.getUserName(), account);
                }
            }
            // 查看seq是否为0，0表示好友列表已全部获取完毕，若大于0，则表示好友列表未获取完毕，当前的字节数（断点续传）
            if (seq == 0) {
                break;
            }
        }

        this.contactList = new ArrayList<>(this.getAccountByType(AccountType.TYPE_FRIEND));

        this.publicUsersList = new ArrayList<>(this.getAccountByType(AccountType.TYPE_MP));
        this.specialUsersList = new ArrayList<>(this.getAccountByType(AccountType.TYPE_SPECIAL));
        Set<Account> groupAccounts = this.getAccountByType(AccountType.TYPE_GROUP);
        for (Account groupAccount : groupAccounts) {
            groupUserNames.add(groupAccount.getUserName());
        }
    }
@Override
    public void loadContact(int seq) {
        log.info("开始获取联系人信息");
        while (true) {
            String url = String.format("%s/webwxgetcontact?r=%s&seq=%s&skey=%s",
                    bot.session().getUrl(), System.currentTimeMillis(),
                    seq, bot.session().getSKey());

            JsonResponse response = this.client.send(new JsonRequest(url).jsonBody());

            JsonObject jsonObject = response.toJsonObject();
            seq = jsonObject.get("Seq").getAsInt();

            this.memberCount += jsonObject.get("MemberCount").getAsInt();
            List<Account> memberList = WeChatUtils.fromJson(WeChatUtils.toJson(jsonObject.getAsJsonArray("MemberList")), new TypeToken<List<Account>>() {});

            for (Account account : memberList) {
                if (null == account.getUserName()) {
                    accountMap.put(account.getUserName(), account);
                }
            }
            // 查看seq是否为0，0表示好友列表已全部获取完毕，若大于0，则表示好友列表未获取完毕，当前的字节数（断点续传）
            if (seq == 0) {
                break;
            }
        }

        this.contactList = new ArrayList<>(this.getAccountByType(AccountType.TYPE_FRIEND));

        this.publicUsersList = new ArrayList<>(this.getAccountByType(AccountType.TYPE_MP));
        this.specialUsersList = new ArrayList<>(this.getAccountByType(AccountType.TYPE_SPECIAL));
        Set<Account> groupAccounts = this.getAccountByType(AccountType.TYPE_GROUP);
        for (Account groupAccount : groupAccounts) {
            groupUserNames.add(groupAccount.getUserName());
        }
    }
@ Override public void loadContact ( int seq ) { log . info ( "开始获取联系人信息"); while ( true ) { String url = String . format ( "%s/webwxgetcontact?r=%s&seq=%s&skey=%s" , bot . session ( ) . getUrl ( ) , System . currentTimeMillis ( ) , seq , bot . session ( ) . getSKey ( ) ) ; JsonResponse response = this . client . send ( new JsonRequest ( url ) . jsonBody ( ) ) ; JsonObject jsonObject = response . toJsonObject ( ) ; seq = jsonObject . get ( "Seq" ) . getAsInt ( ) ; this . memberCount += jsonObject . get ( "MemberCount" ) . getAsInt ( ) ; List < Account > memberList = WeChatUtils . fromJson ( WeChatUtils . toJson ( jsonObject . getAsJsonArray ( "MemberList" ) ) , new TypeToken < List < Account > > ( ) { } ) ; for ( Account account : memberList ) { if ( null == account . getUserName ( ) ) { accountMap . put ( account . getUserName ( ) , account ) ; } } // 查看seq是否为0，0表示好友列表已全部获取完毕，若大于0，则表示好友列表未获取完毕，当前的字节数（断点续传） if ( seq == 0 ) { break ; } } this . contactList = new ArrayList <> ( this . getAccountByType ( AccountType . TYPE_FRIEND ) ) ; this . publicUsersList = new ArrayList <> ( this . getAccountByType ( AccountType . TYPE_MP ) ) ; this . specialUsersList = new ArrayList <> ( this . getAccountByType ( AccountType . TYPE_SPECIAL ) ) ; Set < Account > groupAccounts = this . getAccountByType ( AccountType . TYPE_GROUP ) ; for ( Account groupAccount : groupAccounts ) { groupUserNames . add ( groupAccount . getUserName ( ) ) ; } }
加载联系人信息

@param seq 默认为0，当一次无法加载完全则大于0
加载联系人信息