/var/www/qr4y.com/server/delivery
Edit: /var/www/qr4y.com/server/delivery/func.js (633B)
global.GetDistance = function (latitude1, longtitude1, latitude2, longtitude2) {
let R = 6371 // km (change this constant to get miles)
let dLat = ((latitude2 - latitude1) * Math.PI) / 180
let dLon = ((longtitude2 - longtitude1) * Math.PI) / 180
let a =
Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos((latitude1 * Math.PI) / 180) *
Math.cos((latitude2 * Math.PI) / 180) *
Math.sin(dLon / 2) *
Math.sin(dLon / 2)
let c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
return parseFloat((R * c).toFixed(3))
}
global.RandomNum = function (min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}