您当前的位置: 首页 > 

任磊abc

暂无认证

  • 4浏览

    0关注

    182博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

async

任磊abc 发布时间:2020-12-25 18:15:34 ,浏览量:4

async function testAsync(data, str) {
      const res1 = await new Promise((res) => {
        async function testFun(i) {
          let arr = [];
          let index = await new Promise((second) => {
            second(i);
            if (step * i >= data.length) {
              for (let j = step * (i - 1); j < data.length; j++) {
                let obj = {};
                obj.sign = keyring.signstring(data[j], privateKey);
                obj.hash = data[j];
                obj.id = j;
                arr.push(obj);
                arr.id = j;
              }
            } else {
              for (let j = step * (i - 1); j < step * i; j++) {
                let obj = {};
                obj.sign = keyring.signstring(data[j], privateKey);
                obj.hash = data[j];
                obj.id = j;
                arr.push(obj);
                arr.id = j;
              }
            }
          });
          let list = {
            count: count,
            id: id,
            hashs: arr
          };
          i++;
          let result = await dispatch({
            type: 'miningInfo/minegetminenewsign',
            payload: list
          });
          //  console.log(result);
          console.log(arr);
          console.log(index, data.length);
          if (result.code === 0) {
            if (index * step < data.length) {
              console.log('++++');
              testFun(i);
            } else {
              res(str);
            }
          }
        }
        testFun(1);
      });
      return res1;
    }
 
 
关注
打赏
1656830895
查看更多评论
立即登录/注册

微信扫码登录

0.4083s