mirror of
https://github.com/alwxkxk/soft-and-hard.git
synced 2025-01-28 06:32:54 +08:00
feat: IP地址从119.29.107.47 更换到 42.192.168.165
This commit is contained in:
parent
21f3298f09
commit
406c09588e
@ -42,5 +42,5 @@
|
|||||||
|
|
||||||
- demo2-tcp: 9003
|
- demo2-tcp: 9003
|
||||||
- demo2-http: 8002
|
- demo2-http: 8002
|
||||||
<!-- 因为微信小程序正式发布后通信是需要SSL证书,所以申请了证书并在nginx进行了配置,可访问[https://sh.scaugreen.cn](https://sh.scaugreen.cn) -->
|
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
const char* ssid = "you-wifi";
|
const char* ssid = "you-wifi";
|
||||||
const char* password = "you-wifi-password";
|
const char* password = "you-wifi-password";
|
||||||
|
|
||||||
const char* host = "119.29.107.47";
|
const char* host = "42.192.168.165";
|
||||||
const int port = 9002;//demo1 tcp 使用 9002端口
|
const int port = 9002;//demo1 tcp 使用 9002端口
|
||||||
|
|
||||||
const char* id = "1234abcd";
|
const char* id = "1234abcd";
|
||||||
|
@ -8,6 +8,11 @@ const socket = new WebSocket('ws://'+host);
|
|||||||
// 如果是部署到服务器并配置了SSL证书,应该使用wss协议
|
// 如果是部署到服务器并配置了SSL证书,应该使用wss协议
|
||||||
// const socket = new WebSocket('wss://'+host);
|
// const socket = new WebSocket('wss://'+host);
|
||||||
|
|
||||||
|
$.get('/equipment-list',(data)=>{
|
||||||
|
console.log('设备列表:',data)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
// 如果建立连接
|
// 如果建立连接
|
||||||
socket.onopen=function () {
|
socket.onopen=function () {
|
||||||
console.log("websocket connect!")
|
console.log("websocket connect!")
|
||||||
|
@ -9,6 +9,19 @@ router.get('/', function(req, res, next) {
|
|||||||
res.render('index', { title: '智慧宿舍-123456' });
|
res.render('index', { title: '智慧宿舍-123456' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*获取连接设备列表 */
|
||||||
|
router.get('/equipment-list', function(req, res, next) {
|
||||||
|
const list = []
|
||||||
|
tcpServer.equipmentArray.forEach(equipment=>{
|
||||||
|
const data = {
|
||||||
|
id:equipment.id,
|
||||||
|
addr:equipment.addr
|
||||||
|
}
|
||||||
|
list.push(data)
|
||||||
|
})
|
||||||
|
res.send({code:0,data:list})
|
||||||
|
});
|
||||||
|
|
||||||
// 显示某设备数据
|
// 显示某设备数据
|
||||||
// GET /equipmentId/123456
|
// GET /equipmentId/123456
|
||||||
router.get('/equipmentId/:id', function(req, res, next) {
|
router.get('/equipmentId/:id', function(req, res, next) {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
const char* ssid = "you-wifi";
|
const char* ssid = "you-wifi";
|
||||||
const char* password = "you-wifi-password";
|
const char* password = "you-wifi-password";
|
||||||
|
|
||||||
const char* host = "119.29.107.47";
|
const char* host = "42.192.168.165";
|
||||||
const int port = 9003;//demo2 tcp 使用 9003端口
|
const int port = 9003;//demo2 tcp 使用 9003端口
|
||||||
|
|
||||||
const char* id = "1234abcd";
|
const char* id = "1234abcd";
|
||||||
|
@ -8,8 +8,8 @@ App({
|
|||||||
globalData: {
|
globalData: {
|
||||||
// 初期调试时可以设置不检验合法域名,否则调用API时需要设置小程序的request、socket合法域名
|
// 初期调试时可以设置不检验合法域名,否则调用API时需要设置小程序的request、socket合法域名
|
||||||
// 本机调试需要本机运行demo2,然后将API指向127.0.0.1
|
// 本机调试需要本机运行demo2,然后将API指向127.0.0.1
|
||||||
websocketURL: localDev ? 'ws://127.0.0.1:8002' : 'wss://sh.scaugreen.cn',
|
websocketURL: localDev ? 'ws://127.0.0.1:8002' : 'wss://42.192.168.165',
|
||||||
requestHost: localDev ? 'http://127.0.0.1:8002' : 'https://sh.scaugreen.cn',
|
requestHost: localDev ? 'http://127.0.0.1:8002' : 'https://42.192.168.165',
|
||||||
equipmentId: '123456'
|
equipmentId: '123456'
|
||||||
}
|
}
|
||||||
})
|
})
|
Loading…
x
Reference in New Issue
Block a user