Initial commit - full huishou project

This commit is contained in:
jiapengyu
2026-07-27 14:07:26 +08:00
commit 60790ad1b3
39127 changed files with 5989265 additions and 0 deletions
+113
View File
@@ -0,0 +1,113 @@
const { Client } = require('ssh2');
const config = {
host: 'hs.yifenbao.cn',
port: 22,
username: 'root',
password: 'Torch1112'
};
const conn = new Client();
conn.on('ready', () => {
console.log('SSH连接成功');
conn.exec('docker ps | grep huishou', (err, stream) => {
if (err) {
console.error('执行命令错误:', err.message);
conn.end();
return;
}
let output = '';
stream.stdout.on('data', (data) => {
output += data.toString();
});
stream.stderr.on('data', (data) => {
output += data.toString();
});
stream.on('close', () => {
console.log('\n=== 容器状态 ===');
console.log(output || '没有找到huishou相关容器');
conn.exec('curl -s http://localhost:4000/api/statistics 2>&1', (err, stream) => {
if (err) {
console.error('执行命令错误:', err.message);
conn.end();
return;
}
let output2 = '';
stream.stdout.on('data', (data) => {
output2 += data.toString();
});
stream.stderr.on('data', (data) => {
output2 += data.toString();
});
stream.on('close', () => {
console.log('\n=== 统计API响应 ===');
console.log(output2);
conn.exec('curl -s http://localhost:4000/api/prices 2>&1', (err, stream) => {
if (err) {
console.error('执行命令错误:', err.message);
conn.end();
return;
}
let output3 = '';
stream.stdout.on('data', (data) => {
output3 += data.toString();
});
stream.stderr.on('data', (data) => {
output3 += data.toString();
});
stream.on('close', () => {
console.log('\n=== 价格API响应 ===');
console.log(output3);
conn.exec('curl -s http://localhost:4000/api/orders 2>&1', (err, stream) => {
if (err) {
console.error('执行命令错误:', err.message);
conn.end();
return;
}
let output4 = '';
stream.stdout.on('data', (data) => {
output4 += data.toString();
});
stream.stderr.on('data', (data) => {
output4 += data.toString();
});
stream.on('close', () => {
console.log('\n=== 订单API响应 ===');
console.log(output4);
conn.end();
});
});
});
});
});
});
});
});
});
conn.on('error', (err) => {
console.error('SSH连接错误:', err.message);
});
conn.on('end', () => {
console.log('SSH连接已关闭');
});
conn.connect(config);