mirror of
https://github.com/MCSManager/MCSManager.git
synced 2025-01-18 15:04:04 +08:00
优化 代码声明与细节问题
This commit is contained in:
parent
22f44b1288
commit
da8c0f6671
@ -168,7 +168,7 @@ router.ws('/ws', function (ws, req) {
|
||||
let reqs = req;
|
||||
|
||||
//Websocket 自定义协议解析
|
||||
reqHeaderObj = JSON.parse(reqHeader);
|
||||
const reqHeaderObj = JSON.parse(reqHeader);
|
||||
if (!reqHeaderObj) return;
|
||||
|
||||
//Websocket 心跳包 | 前端 10 秒递增链接健康指数
|
||||
|
@ -48,7 +48,7 @@ const TER_MAX_SIZE = MCSERVER.localProperty.terminalQueue_max_size || 1;
|
||||
setInterval(() => {
|
||||
try {
|
||||
var files = fs.readdirSync(BASE_RECORD_DIR);
|
||||
for (filename of files) {
|
||||
for (const filename of files) {
|
||||
let path = BASE_RECORD_DIR + filename;
|
||||
let filesize = fs.statSync(path).size;
|
||||
if (filesize > 1024 * 1024 * TER_MAX_SIZE) {
|
||||
|
@ -25,7 +25,7 @@ WebSocketObserver().listener('genuser/home', (data) => {
|
||||
// 判断是否为管理员,若是的话则返回所有服务端的数据
|
||||
if (permssion.isMaster(data.WsSession)) {
|
||||
allowedServerList = [];
|
||||
serverList = serverModel.ServerManager().getServerList();
|
||||
const serverList = serverModel.ServerManager().getServerList();
|
||||
for (const v of serverList) {
|
||||
allowedServerList.push(v.serverName);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ function CreateScheduleJob(obj) {
|
||||
//过滤计划任务列表
|
||||
function getMineScheduleList(servername) {
|
||||
let list = MCSERVER.Schedule.dataModel.list;
|
||||
sendlist = [];
|
||||
const sendlist = [];
|
||||
for (const iterator of list) {
|
||||
if (iterator && iterator.servername == servername) {
|
||||
sendlist.push(iterator);
|
||||
@ -57,7 +57,7 @@ WebSocketObserver().listener('schedule/create', (data) => {
|
||||
|
||||
if (permssion.isCanServer(username, obj.servername || "")) {
|
||||
try {
|
||||
list = getMineScheduleList(obj.servername);
|
||||
const list = getMineScheduleList(obj.servername);
|
||||
if (list.length > MAX_MASK) {
|
||||
response.wsMsgWindow(data.ws, "到达创建数量上限!");
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user