RE: STEEM编程练习记录 二

avatar

You are viewing a single comment's thread:

不需要,这是我之前写的,你可以参考一下

function getFollowers(account, start = 0, limit = 1000, followers = []) {
    return new Promise((resolve, reject) => {
        steem.api.getFollowers(account, start, 'blog', limit, async function (err, result) {
            if (result.length > 1) {
                let newResult = [];
                result.forEach(follower => {
                    if (follower.follower != start) {
                        newResult.push(follower);
                    }
                });
                followers = [...followers, ...newResult];
                let followersList = [];
                for (let i in newResult) {
                    followersList.push(newResult[i].follower);
                }
                getFollowers(account, result[result.length - 1].follower, limit, followers)
                .then(resolve)
                .catch(reject);
            } else {
                resolve(followers);
            }
        });
    });
}


0
0
0.000
1 comments
avatar

Cool。知道怎么弄了👏 👏

0
0
0.000