location ^~ /server/ {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' "https://login.domain.ru";
#
# Om nom nom cookies
#
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
#
# Custom headers and headers various browsers *should* be OK with but aren't
#
add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
#
# Tell client that this pre-flight info is valid for 20 days
#
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
if ($request_method = 'POST') {
add_header 'Access-Control-Allow-Origin' "https://login.domain.ru";
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
}
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' "https://login.domain.ru";
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
}
rewrite ^/server/$ /app/server/server.php last;
}
function tracking() {
watch(['app/**/*'], archiving)
}
for( var i in resultArr )
{
const { IMEI, id, data, checksum } = resultArr[ i ];
obj[ IMEI ] = obj[ IMEI ] || {};
obj[ IMEI ][ id ] = obj[ IMEI ][ id ] || { data, checksum };
}
[
{
IMEI: 869244040004115,
date: '2020-08-06T13:43:31.000',
id: 1,
idOrder: 1,
name: 'Версия терминала',
tag: '01',
data: '8083',
parser: '',
checksum: 'd121'
},
{
IMEI: 869244040004115,
date: '2020-08-06T13:43:31.000',
id: 3,
idOrder: 3,
name: 'Емей',
tag: '03',
data: '383639323434303430303034313135',
parser: '',
checksum: '56a9'
},
{
IMEI: 869244040004115,
date: '2020-08-06T13:43:31.000',
id: 4,
idOrder: 4,
name: 'Ид-р устройства',
tag: '04',
data: '3200',
parser: '',
checksum: 'd014'
},
{
IMEI: 869244040004115,
date: '2020-08-06T13:43:31.000',
id: 6,
idOrder: 6,
name: 'Дата и время',
tag: '20',
data: '03092c5f',
parser: '2020-08-06T13:43:31.000Z',
checksum: '9a8c'
},
{
IMEI: 869244040004115,
date: '2020-08-06T13:43:31.000',
id: 7,
idOrder: 7,
name: 'Координаты',
tag: '30',
data: '0cfc37af023cab1b02',
parser: 'Число спутников: 12 Широта: 45.037564 Долгота: 35.36774',
checksum: '3c81'
},
{
IMEI: 869244040004115,
date: '2020-08-06T13:43:31.000',
id: 8,
idOrder: 8,
name: 'Скорость и направление',
tag: '33',
data: '00000000',
parser: 'Скорость: 0км/ч Направление: 0°',
checksum: '2400'
},
{
IMEI: 869244040004115,
date: '2020-08-06T13:43:31.000',
id: 9,
idOrder: 9,
name: 'Высота',
tag: '34',
data: '1000',
parser: 'Высота: 16м',
checksum: '700c'
},
...
]
resultArr = [
{
id: 'data_data_data_data'
IMEI: 'data_data_data_data'
data: 'data_data_data_data'
result: 'data_data_data_data'
},
{
id: 'data_data_data_data'
IMEI: 'data_data_data_data'
data: 'data_data_data_data'
result: 'data_data_data_data'
},
{
id: 'data_data_data_data'
IMEI: 'data_data_data_data'
data: 'data_data_data_data'
result: 'data_data_data_data'
},
{
id: 'data_data_data_data'
IMEI: 'data_data_data_data'
data: 'data_data_data_data'
result: 'data_data_data_data'
}
...
]
let buff = d5ed
new Buffer.from('02'+buff )
new Buffer.from(buff )