diff --git a/config.js b/config.js index 5edca54..a772af6 100644 --- a/config.js +++ b/config.js @@ -5,6 +5,7 @@ const Markup = require('telegraf/markup'); const Extra = require('telegraf/extra'); const db_js = require('./db.js'); +const tracking = require('./tracking.js'); var db = new db_js("17track"); @@ -137,7 +138,7 @@ module.exports = function(){ return get_tracking(ids).then(res=>{ var text = "*Tracking*\n\n"; for(var rr of res){ - text+=`*${rr.id}*\n_${rr.date?rr.date:'Unknown'} - ${rr.loc?rr.loc:'Unknown'}_\n${rr.status}\n\n`; + text+=`*[${rr.id}](${tracking.getTrackingUrl(rr.id)})*\n_${rr.date?rr.date:'Unknown'} - ${rr.loc?rr.loc:'Unknown'}_\n${rr.status}\n\n`; } return event.reply( text, {"reply_markup":Markup.inlineKeyboard(kb),"parse_mode":"Markdown"}); }); @@ -171,7 +172,7 @@ module.exports = function(){ return get_tracking(res).then(res=>{ var text = `*Tracking* (Updated: ${new Date().toLocaleString()})\n\n`; for(var rr of res){ - text+=`*${rr.id}*\n_${rr.date?rr.date:'Unknown'} - ${rr.loc?rr.loc:'Unknown'}_\n${rr.status}\n\n`; + text+=`*[${rr.id}](${tracking.getTrackingUrl(rr.id)})*\n_${rr.date?rr.date:'Unknown'} - ${rr.loc?rr.loc:'Unknown'}_\n${rr.status}\n\n`; } return event.editMessageText( text, {"reply_markup":Markup.inlineKeyboard(kb),"parse_mode":"Markdown"}); }); diff --git a/manual.js b/manual.js index 66dad51..5591f71 100644 --- a/manual.js +++ b/manual.js @@ -1,6 +1,8 @@ const http = require('https'); const fetch = require('node-fetch'); +const tracking = require('./tracking.js'); + const track_url = 'https://t.17track.net/restapi/track'; var cnvrt = function(v) { @@ -77,7 +79,11 @@ async function get_tracking(trck_ids, guid){ .then(res => res.json()); } -get_tracking(['9999999999999'],'').then(res=>{ +get_tracking(['993711592316210394'],'').then(res=>{ console.log(res.dat); + console.log(res.dat[0].track.zex); + console.log(res.dat[0].track.z0); + console.log(res.dat[0].track.z1); + console.log(tracking.getTrackingUrl('993711592316210394')); });