// 机器人消息 app.get('/api/robotapi', (req, res) => { const response = res const info = req.query.info const userid = req.query.id const key = 'fde7f8d0b3c9471cbf787ea0fb0ca043' superagent.post('http://www.tuling123.com/openapi/api') .send({info, userid, key}) .end((err, res) => { if (err) { global.logger.error(err) } response.json({ data: res.text }) }) })
sendPeer(peer, peerToSend) { const URL = `${peer.url}/node/peers`; console.info(`Sending ${peerToSend.url} to peer ${URL}.`); return superagent .post(URL) .send(peerToSend) .catch((err) => { console.warn(`Unable to send me to peer ${URL}: ${err.message}`); }); }
sendLatestBlock(peer, block) { const URL = `${peer.url}/blockchain/blocks/latest`; console.info(`Posting latest block to: ${URL}`); return superagent .put(URL) .send(block) .catch((err) => { console.warn(`Unable to post latest block to ${URL}: ${err.message}`); }); }
.send(data) .end((err, res) => { res.should.have.status(200);
.send(data) .end((err, res) => { res.should.have.status(200);
sendTransaction(peer, transaction) { const URL = `${peer.url}/blockchain/transactions`; console.info(`Sending transaction '${transaction.id}' to: '${URL}'`); return superagent .post(URL) .send(transaction) .catch((err) => { console.warn(`Unable to put transaction to ${URL}: ${err.message}`); }); }
.send(bot) .end((err, res) => { res.should.have.status(200);
// 机器人消息 router.get('/robotapi', (req, res) => { const response = res const info = req.query.info const userid = req.query.id const key = 'fde7f8d0b3c9471cbf787ea0fb0ca043' superagent.post('http://www.tuling123.com/openapi/api') .send({info, userid, key}) .end((err, res) => { if (err) { global.logger.error(err) } response.json({ data: res.text }) }) })
.send(data) .end((err, res) => { res.should.have.status(200);
.send(data) .end((err, res) => { res.should.have.status(200);