Update IPCustom.js

This commit is contained in:
Shawn
2019-06-29 18:27:32 +08:00
committed by GitHub
parent 55ac42ae0b
commit b650925310

View File

@@ -5,16 +5,22 @@
// var body = $response.body; // var body = $response.body;
// var obj = JSON.parse(body); // var obj = JSON.parse(body);
if ($response.statusCode != 200) {
$done(Null);
}
function getRandomInt(max) { function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max)); return Math.floor(Math.random() * Math.floor(max));
} }
const foods = ['🍎', '🍐', '🍊', '🍋', '🍌', '🍉', '🍇', '🍓', '🍈', '🍒', '🍑', '🥭', '🍅'] const foods = ['🍎', '🍐', '🍊', '🍋', '🍌', '🍉', '🍇', '🍓', '🍈', '🍒', '🍑', '🥭', '🍅']
const emojis= ['😄','😁','😢','🤗','😡','😴','🤑','👽','🤖','🎃']
var title = foods[getRandomInt(foods.length)]; var body = $response.body;
var subtitle = '今天吃什么水果?'; var obj = JSON.parse(body);
var ip = '1.1.1.1'; var title = foods[getRandomInt(foods.length)]+' ' +obj['country'] + ' ' + emojis[getRandomInt(emojis.length)];
var description = 'description'+ip; var subtitle = obj['city'] + ' ' + obj['isp'];
var ip = obj['query'];
var description = obj['country'] + '\n' + obj['city'] + '\n' + obj['isp'] + '\n' + obj['ipType']+ '\n' + ip;
$done({title, subtitle, ip, description}); $done({title, subtitle, ip, description});