修复linux下运行错误

This commit is contained in:
2024-07-19 14:49:14 +08:00
parent 3efe6cb5b6
commit cad6280879
3 changed files with 26 additions and 8 deletions

View File

@ -6,7 +6,7 @@ const herader = {
const db=require("../comman/db") const db=require("../comman/db")
const mywebsocket=require("./tstws") const mywebsocket=require("./tstws")
exports.getfrpserver=getfrpserver exports.getfrpserver=getfrpserver
const moment = require('moment');
function createdfrpdb( ) function createdfrpdb( )
{ {
@ -55,7 +55,9 @@ async function insertfrpinfo(data)
sql="INSERT INTO `frpinfo` SET ?" sql="INSERT INTO `frpinfo` SET ?"
if(insertdata.remote_port==0) if(insertdata.remote_port==0)
{ {
insertdata.last_online=new Date("2000-01-01").toLocaleString()
insertdata.last_online=moment().format('YYYY-MM-DD HH:mm:ss')
} }
await db.queryacy(sql,insertdata) await db.queryacy(sql,insertdata)
@ -113,14 +115,15 @@ async function getfrpserver()
var aaa=await frpserveraxios.get('http://106.75.72.40:7500/api/proxy/tcp',{headers:herader}) var aaa=await frpserveraxios.get('http://106.75.72.40:7500/api/proxy/tcp',{headers:herader})
nowtime=new Date()
nowtime=nowtime.toLocaleString() nowtime=moment().format('YYYY-MM-DD HH:mm:ss')
aaa=aaa.data.proxies; aaa=aaa.data.proxies;
for (var i=0;i<aaa.length;i++) for (var i=0;i<aaa.length;i++)
{ {
if(aaa[i].name.endsWith('_data')) if(aaa[i].name.endsWith('_data'))
{ {
console.log(aaa[i])
var data=aaa[i] var data=aaa[i]
//console.log(aaa[i].name) //console.log(aaa[i].name)
//去除后缀 //去除后缀
@ -249,7 +252,7 @@ async function panduanshebei(data)
name:data.nameup, name:data.nameup,
lasttime:frpret.lasttimedata, lasttime:frpret.lasttimedata,
sppercent:frpret.space.percent, sppercent:frpret.space.percent,
sptotal:frpret.space.total/1024/1024+"GB", sptotal:frpret.space.total/1024/1024,
remote_port:"http://106.75.72.40:"+data.conf.remote_port, remote_port:"http://106.75.72.40:"+data.conf.remote_port,
mountedon:frpret.space.mountedon mountedon:frpret.space.mountedon
@ -351,7 +354,7 @@ try {
let nowtime=now.getTime() let nowtime=now.getTime()
let filetime=new Date(filemodtime) let filetime=new Date(filemodtime)
ret.lasttimedata=filetime.toLocaleString(); ret.lasttimedata=moment(filetime).format('YYYY-MM-DD HH:mm:ss');
let filetime1=filetime.getTime() let filetime1=filetime.getTime()
diff=nowtime-filetime1 diff=nowtime-filetime1
@ -426,8 +429,8 @@ try {
} }
ret.space.percent=space[4] ret.space.percent=space[4].replace(/\D/g, '');
ret.space.total=space[1] ret.space.total=space[1].replace(/\D/g, '');
if(ret.space.mountedon!="No SD card") if(ret.space.mountedon!="No SD card")
ret.space.mountedon=space[5] ret.space.mountedon=space[5]

View File

@ -14,6 +14,7 @@
"debug": "~2.6.9", "debug": "~2.6.9",
"express": "^4.19.2", "express": "^4.19.2",
"express-session": "^1.17.3", "express-session": "^1.17.3",
"moment": "^2.30.1",
"mqtt": "^4.3.7", "mqtt": "^4.3.7",
"mysql": "^2.18.1", "mysql": "^2.18.1",
"node-schedule": "^2.1.1", "node-schedule": "^2.1.1",
@ -1427,6 +1428,14 @@
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
}, },
"node_modules/moment": {
"version": "2.30.1",
"resolved": "https://registry.npmmirror.com/moment/-/moment-2.30.1.tgz",
"integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==",
"engines": {
"node": "*"
}
},
"node_modules/mqtt": { "node_modules/mqtt": {
"version": "4.3.7", "version": "4.3.7",
"resolved": "https://registry.npmmirror.com/mqtt/-/mqtt-4.3.7.tgz", "resolved": "https://registry.npmmirror.com/mqtt/-/mqtt-4.3.7.tgz",
@ -3604,6 +3613,11 @@
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
}, },
"moment": {
"version": "2.30.1",
"resolved": "https://registry.npmmirror.com/moment/-/moment-2.30.1.tgz",
"integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how=="
},
"mqtt": { "mqtt": {
"version": "4.3.7", "version": "4.3.7",
"resolved": "https://registry.npmmirror.com/mqtt/-/mqtt-4.3.7.tgz", "resolved": "https://registry.npmmirror.com/mqtt/-/mqtt-4.3.7.tgz",

View File

@ -12,6 +12,7 @@
"debug": "~2.6.9", "debug": "~2.6.9",
"express": "^4.19.2", "express": "^4.19.2",
"express-session": "^1.17.3", "express-session": "^1.17.3",
"moment": "^2.30.1",
"mqtt": "^4.3.7", "mqtt": "^4.3.7",
"mysql": "^2.18.1", "mysql": "^2.18.1",
"node-schedule": "^2.1.1", "node-schedule": "^2.1.1",