RE: RE: SteemJS中文手册
You are viewing a single comment's thread from:

RE: SteemJS中文手册

Words
0
Reading
0 min
Listen
Play
7y
let acc = 'lemooljiang'
let key = '5kdkRfffffff'
let authors = [{author: 'starnote', weight: 100},
                {author: 'abit', weight: 100}]
let that = this
this.steem.api.streamTransactions("head", function (err, result) {
  if (err) {
    alert("网络有问题!请更换API节点!")
  }
  let txType = result.operations[0][0]  //获取操作类别
  let txData = result.operations[0][1]  //获取操作内容

  authors.forEach(item => {
    if (txType == "comment" & txData.author == item.author & txData.parent_author == "") {
      //获取作者的文章
      let permlink = txData.permlink
      let voteweight = item.weight
      let vote = function (){
        that.steem.broadcast.vote( key, acc, item.author, permlink, voteWeight*100, function(err, result) {
          console.log(688, "点赞完成!", item.author,  txData.title)
        })
      }
      setTimeout(vote, 300000)  //5分钟后
    }
  })
})