北斗短报文通信服务平台
This commit is contained in:
1
.eslintignore
Normal file
1
.eslintignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
coverage
|
||||||
15
.gitignore
vendored
Normal file
15
.gitignore
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
logs/
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
node_modules/
|
||||||
|
*-lock.json
|
||||||
|
*-lock.yaml
|
||||||
|
yarn.lock
|
||||||
|
coverage/
|
||||||
|
.idea/
|
||||||
|
run/
|
||||||
|
.DS_Store
|
||||||
|
*.sw*
|
||||||
|
*.un~
|
||||||
|
typings/
|
||||||
|
.nyc_output/
|
||||||
10
.sequelizerc
Normal file
10
.sequelizerc
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
"config": path.join(__dirname, 'database/config.json'),
|
||||||
|
'migrations-path': path.join(__dirname, 'database/migrations'),
|
||||||
|
'seeders-path': path.join(__dirname, 'database/seeders'),
|
||||||
|
'models-path': path.join(__dirname, 'app/model'),
|
||||||
|
};
|
||||||
31
README.md
Normal file
31
README.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# bd-short-message-platform
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## QuickStart
|
||||||
|
|
||||||
|
<!-- add docs here for user -->
|
||||||
|
|
||||||
|
see [egg docs][egg] for more detail.
|
||||||
|
|
||||||
|
### Development
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm i
|
||||||
|
npm run dev
|
||||||
|
open http://localhost:7001/
|
||||||
|
```
|
||||||
|
|
||||||
|
### Deploy
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm start
|
||||||
|
npm stop
|
||||||
|
```
|
||||||
|
|
||||||
|
### npm scripts
|
||||||
|
|
||||||
|
- Use `npm run lint` to check code style.
|
||||||
|
- Use `npm test` to run unit test.
|
||||||
|
|
||||||
|
[egg]: https://eggjs.org
|
||||||
387
app/controller/home.js
Normal file
387
app/controller/home.js
Normal file
@@ -0,0 +1,387 @@
|
|||||||
|
const { Controller } = require('egg');
|
||||||
|
|
||||||
|
const GBK = require("gbk.js");
|
||||||
|
|
||||||
|
const decode = (data) => {
|
||||||
|
let arr = [];
|
||||||
|
data.match(/..?/g).forEach((element) => {
|
||||||
|
arr.push(parseInt(element, 16));
|
||||||
|
});
|
||||||
|
return GBK.decode(arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
const CryptoJS = require("crypto-js");
|
||||||
|
|
||||||
|
const KEY = CryptoJS.enc.Utf8.parse('BDQH');
|
||||||
|
|
||||||
|
const decryptRequest = (body) => {
|
||||||
|
return CryptoJS.AES.decrypt(body, KEY, {
|
||||||
|
mode: CryptoJS.mode.ECB,
|
||||||
|
padding: CryptoJS.pad.Pkcs7
|
||||||
|
}).toString(CryptoJS.enc.Utf8);
|
||||||
|
}
|
||||||
|
|
||||||
|
const checkUid = async (ctx) => {
|
||||||
|
const uid = ctx.request.body.uid;
|
||||||
|
const token = ctx.request.header.authorization;
|
||||||
|
const redis = ctx.app.redis;
|
||||||
|
let rdmcode;
|
||||||
|
if (!uid) {
|
||||||
|
const [buser, cuser, tuser] = await Promise.all([
|
||||||
|
redis.get('db0').get(token),
|
||||||
|
redis.get('db1').get(token),
|
||||||
|
redis.get('db5').get(token),
|
||||||
|
]);
|
||||||
|
rdmcode = buser || cuser || tuser;
|
||||||
|
} else {
|
||||||
|
let decryptUid = decryptRequest(uid).split('?')[0];
|
||||||
|
const redisType = {
|
||||||
|
"B": "db0",
|
||||||
|
"C": "db1",
|
||||||
|
"T": "db5",
|
||||||
|
};
|
||||||
|
const lastCode = decryptUid[decryptUid.length - 1];
|
||||||
|
rdmcode = await redis.get(redisType[lastCode]).get(token);
|
||||||
|
}
|
||||||
|
if (!rdmcode) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return rdmcode;
|
||||||
|
};
|
||||||
|
|
||||||
|
const fileName = "home";
|
||||||
|
|
||||||
|
const setResponse = (ctx, code, msg, model, data = {}) => {
|
||||||
|
const modelType = {
|
||||||
|
"none": { code, msg },
|
||||||
|
"deconstruction": { code, msg, ...data },
|
||||||
|
"polymerization": { code, msg, data }
|
||||||
|
}
|
||||||
|
ctx.body = modelType[model];
|
||||||
|
}
|
||||||
|
|
||||||
|
class HomeController extends Controller {
|
||||||
|
// 获取卡号
|
||||||
|
async getCard() {
|
||||||
|
const ctx = this.ctx;
|
||||||
|
try {
|
||||||
|
let rdmcode = await checkUid(ctx);
|
||||||
|
if (!rdmcode) {
|
||||||
|
setResponse(ctx, 401, 'token过期或错误', "none");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const uid = JSON.parse(rdmcode).uid;
|
||||||
|
const result = await ctx.service.home.getCard(uid);
|
||||||
|
if(result == "error") {
|
||||||
|
setResponse(ctx, 500, '服务器错误', "none");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (result) {
|
||||||
|
const data = { cardID: result.dataValues.card_id };
|
||||||
|
setResponse(ctx, 200, '获取卡号成功', "deconstruction", data);
|
||||||
|
} else {
|
||||||
|
setResponse(ctx, 404, '获取卡号失败', "none");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const blockName = fileName + "--" + "getCard";
|
||||||
|
ctx.app.middleware.utils.log('../../../controllerLog', blockName + ">>>>" + error);
|
||||||
|
setResponse(ctx, 500, '服务器错误', "none");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 搜索卡号
|
||||||
|
async searchCard() {
|
||||||
|
const ctx = this.ctx;
|
||||||
|
try {
|
||||||
|
let rdmcode = await checkUid(ctx);
|
||||||
|
if (!rdmcode) {
|
||||||
|
setResponse(ctx, 401, 'token过期或错误', "none");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const uid = JSON.parse(rdmcode).uid;
|
||||||
|
const { cardID } = ctx.request.body;
|
||||||
|
const result = await ctx.service.home.searchCard(cardID);
|
||||||
|
if(result == "error") {
|
||||||
|
setResponse(ctx, 500, '服务器错误', "none");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (result) {
|
||||||
|
if (result.dataValues.cuser == null) {
|
||||||
|
setResponse(ctx, 201, '此卡未绑定', "none");
|
||||||
|
} else if (result.dataValues.cuser == uid) {
|
||||||
|
setResponse(ctx, 202, '此卡已与当前账号绑定', "none");
|
||||||
|
} else {
|
||||||
|
setResponse(ctx, 203, '此卡已绑定', "none");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setResponse(ctx, 404, '此卡未注册', "none");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const blockName = fileName + "--" + "searchCard";
|
||||||
|
ctx.app.middleware.utils.log('../../../controllerLog', blockName + ">>>>" + error);
|
||||||
|
setResponse(ctx, 500, '服务器错误', "none");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 绑卡
|
||||||
|
async bindCard() {
|
||||||
|
const ctx = this.ctx;
|
||||||
|
try {
|
||||||
|
let rdmcode = await checkUid(ctx);
|
||||||
|
if (!rdmcode) {
|
||||||
|
setResponse(ctx, 401, 'token过期或错误', "none");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const uid = JSON.parse(rdmcode).uid;
|
||||||
|
const body = ctx.request.body;
|
||||||
|
const result = await ctx.service.home.bindCard(uid, body);
|
||||||
|
if(result == "error") {
|
||||||
|
setResponse(ctx, 500, '服务器错误', "none");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (result) {
|
||||||
|
setResponse(ctx, 200, '绑卡成功', "none");
|
||||||
|
} else {
|
||||||
|
setResponse(ctx, 404, '绑卡失败', "none");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const blockName = fileName + "--" + "bindCard";
|
||||||
|
ctx.app.middleware.utils.log('../../../controllerLog', blockName + ">>>>" + error);
|
||||||
|
setResponse(ctx, 500, '服务器错误', "none");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解绑
|
||||||
|
async unBindingCard() {
|
||||||
|
const ctx = this.ctx;
|
||||||
|
try {
|
||||||
|
let rdmcode = await checkUid(ctx);
|
||||||
|
if (!rdmcode) {
|
||||||
|
setResponse(ctx, 401, 'token过期或错误', "none");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const uid = JSON.parse(rdmcode).uid;
|
||||||
|
const body = ctx.request.body;
|
||||||
|
const result = await ctx.service.home.unBindingCard(uid, body);
|
||||||
|
if(result == "error") {
|
||||||
|
setResponse(ctx, 500, '服务器错误', "none");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (result) {
|
||||||
|
setResponse(ctx, 200, '解绑成功', "none");
|
||||||
|
} else {
|
||||||
|
setResponse(ctx, 404, '解绑失败', "none");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const blockName = fileName + "--" + "unBindingCard";
|
||||||
|
ctx.app.middleware.utils.log('../../../controllerLog', blockName + ">>>>" + error);
|
||||||
|
setResponse(ctx, 500, '服务器错误', "none");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// B端单位管理员解绑
|
||||||
|
async unBindManager() {
|
||||||
|
const ctx = this.ctx;
|
||||||
|
try {
|
||||||
|
let rdmcode = await checkUid(ctx);
|
||||||
|
if (!rdmcode) {
|
||||||
|
setResponse(ctx, 401, 'token过期或错误', "none");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const uid = JSON.parse(rdmcode).uid;
|
||||||
|
const body = ctx.request.body;
|
||||||
|
const model = decryptRequest(body.model);
|
||||||
|
const password = decryptRequest(body.password);
|
||||||
|
const requestMsg = body.userMsg;
|
||||||
|
const result = await ctx.service.home.unBindManager(uid, model, password, requestMsg);
|
||||||
|
if(result == "error") {
|
||||||
|
setResponse(ctx, 500, '服务器错误', "none");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (result) {
|
||||||
|
setResponse(ctx, 200, '解绑成功', "none");
|
||||||
|
} else {
|
||||||
|
setResponse(ctx, 404, '解绑失败', "none");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const blockName = fileName + "--" + "unBindManager";
|
||||||
|
ctx.app.middleware.utils.log('../../../controllerLog', blockName + ">>>>" + error);
|
||||||
|
setResponse(ctx, 500, '服务器错误', "none");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取绑定记录
|
||||||
|
async getRecord() {
|
||||||
|
const ctx = this.ctx;
|
||||||
|
try {
|
||||||
|
let rdmcode = await checkUid(ctx);
|
||||||
|
if (!rdmcode) {
|
||||||
|
setResponse(ctx, 401, 'token过期或错误', "none");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const uid = JSON.parse(rdmcode).uid;
|
||||||
|
const body = ctx.request.body;
|
||||||
|
const result = await ctx.service.home.getRecord(uid, body);
|
||||||
|
if(result == "error") {
|
||||||
|
setResponse(ctx, 500, '服务器错误', "none");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (result) {
|
||||||
|
let recordMsg = [];
|
||||||
|
result.rows.forEach(element => {
|
||||||
|
recordMsg.push(element.dataValues);
|
||||||
|
});
|
||||||
|
const data = {
|
||||||
|
recordMsg: recordMsg,
|
||||||
|
count: result.count
|
||||||
|
};
|
||||||
|
setResponse(ctx, 200, '绑定记录查询成功', "deconstruction", data);
|
||||||
|
} else {
|
||||||
|
setResponse(ctx, 404, '绑定记录查询失败', "none");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const blockName = fileName + "--" + "getRecord";
|
||||||
|
ctx.app.middleware.utils.log('../../../controllerLog', blockName + ">>>>" + error);
|
||||||
|
setResponse(ctx, 500, '服务器错误', "none");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 存储消息记录
|
||||||
|
async shortMsg() {
|
||||||
|
const ctx = this.ctx;
|
||||||
|
try {
|
||||||
|
const body = ctx.request.body;
|
||||||
|
const { card_id, receiver_address, original_msg, send_type, encode_type, msg_data, created_at } = body;
|
||||||
|
const form = {
|
||||||
|
card_id: card_id,
|
||||||
|
receiver_address: receiver_address,
|
||||||
|
original_msg: original_msg,
|
||||||
|
send_type: Number(send_type),
|
||||||
|
encode_type: Number(encode_type),
|
||||||
|
msg_data: Number(encode_type) == 0 ? decode(msg_data) : msg_data,
|
||||||
|
created_at: created_at
|
||||||
|
};
|
||||||
|
const result = await ctx.service.home.shortMsg(form);
|
||||||
|
if(result == "error") {
|
||||||
|
setResponse(ctx, 500, '服务器错误', "none");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (result) {
|
||||||
|
setResponse(ctx, 200, '消息记录存储成功', "none");
|
||||||
|
} else {
|
||||||
|
setResponse(ctx, 404, '消息记录存储失败', "none");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const blockName = fileName + "--" + "shortMsg";
|
||||||
|
ctx.app.middleware.utils.log('../../../controllerLog', blockName + ">>>>" + error);
|
||||||
|
setResponse(ctx, 500, '服务器错误', "none");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取历史消息
|
||||||
|
async getHistoryMsg() {
|
||||||
|
const ctx = this.ctx;
|
||||||
|
try {
|
||||||
|
let rdmcode = await checkUid(ctx);
|
||||||
|
if (!rdmcode) {
|
||||||
|
setResponse(ctx, 401, 'token过期或错误', "none");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const uid = JSON.parse(rdmcode).uid;
|
||||||
|
const body = ctx.request.body;
|
||||||
|
const result = await ctx.service.home.getHistoryMsg(uid, body);
|
||||||
|
if(result == "error") {
|
||||||
|
setResponse(ctx, 500, '服务器错误', "none");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (result) {
|
||||||
|
let historyMsg = [];
|
||||||
|
result.rows.forEach(element => {
|
||||||
|
historyMsg.push(element.dataValues);
|
||||||
|
});
|
||||||
|
const data = {
|
||||||
|
historyMsg: historyMsg,
|
||||||
|
count: result.count
|
||||||
|
};
|
||||||
|
setResponse(ctx, 200, '历史消息查找成功', "deconstruction", data);
|
||||||
|
} else {
|
||||||
|
setResponse(ctx, 404, '历史消息查找失败', "none");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const blockName = fileName + "--" + "getHistoryMsg";
|
||||||
|
ctx.app.middleware.utils.log('../../../controllerLog', blockName + ">>>>" + error);
|
||||||
|
setResponse(ctx, 500, '服务器错误', "none");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除历史消息
|
||||||
|
async delHistoryMsg() {
|
||||||
|
const ctx = this.ctx;
|
||||||
|
try {
|
||||||
|
let rdmcode = await checkUid(ctx);
|
||||||
|
if (!rdmcode) {
|
||||||
|
setResponse(ctx, 401, 'token过期或错误', "none");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const uid = JSON.parse(rdmcode).uid;
|
||||||
|
const body = ctx.request.body;
|
||||||
|
const model = decryptRequest(body.model);
|
||||||
|
const password = decryptRequest(body.password);
|
||||||
|
const requestMsg = body.userMsg;
|
||||||
|
const resetList = await ctx.service.home.delHistoryMsg(uid, model, password, requestMsg);
|
||||||
|
if(resetList == "error") {
|
||||||
|
setResponse(ctx, 500, '服务器错误', "none");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (resetList) {
|
||||||
|
setResponse(ctx, 200, '删除历史消息成功', "none");
|
||||||
|
} else {
|
||||||
|
setResponse(ctx, 404, '删除历史消息失败', "none");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const blockName = fileName + "--" + "delHistoryMsg";
|
||||||
|
ctx.app.middleware.utils.log('../../../controllerLog', blockName + ">>>>" + error);
|
||||||
|
setResponse(ctx, 500, '服务器错误', "none");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取单位用户
|
||||||
|
async bsideManager() {
|
||||||
|
const ctx = this.ctx;
|
||||||
|
try {
|
||||||
|
let rdmcode = await checkUid(ctx);
|
||||||
|
if (!rdmcode) {
|
||||||
|
setResponse(ctx, 401, 'token过期或错误', "none");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const uid = JSON.parse(rdmcode).uid;
|
||||||
|
let result;
|
||||||
|
if(uid[uid.length - 1] == 'B') {
|
||||||
|
const body = ctx.request.body;
|
||||||
|
result = await ctx.service.home.bsideManager(uid, body);
|
||||||
|
}
|
||||||
|
if(result == "error") {
|
||||||
|
setResponse(ctx, 500, '服务器错误', "none");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (result) {
|
||||||
|
let bsideUsers = [];
|
||||||
|
result.rows.forEach(element => {
|
||||||
|
bsideUsers.push(element.dataValues);
|
||||||
|
});
|
||||||
|
const data = {
|
||||||
|
bsideUsers: bsideUsers,
|
||||||
|
count: result.count
|
||||||
|
};
|
||||||
|
setResponse(ctx, 200, '获取单位用户成功', "deconstruction", data);
|
||||||
|
} else {
|
||||||
|
setResponse(ctx, 404, '获取单位用户失败', "none");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const blockName = fileName + "--" + "bsideManager";
|
||||||
|
ctx.app.middleware.utils.log('../../../controllerLog', blockName + ">>>>" + error);
|
||||||
|
setResponse(ctx, 500, '服务器错误', "none");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = HomeController;
|
||||||
50
app/core/base_service.js
Normal file
50
app/core/base_service.js
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
const { Service } = require('egg');
|
||||||
|
|
||||||
|
const sha256 = require("crypto-js/sha256");
|
||||||
|
|
||||||
|
const CryptoJS = require("crypto-js");
|
||||||
|
|
||||||
|
const KEY = CryptoJS.enc.Utf8.parse('BDQH');
|
||||||
|
|
||||||
|
class BaseService extends Service {
|
||||||
|
shaForm = (body, salt) => {
|
||||||
|
return sha256(sha256(body).toString() + salt).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
encryptRequest = (body) => {
|
||||||
|
return CryptoJS.AES.encrypt(body, KEY, {
|
||||||
|
mode: CryptoJS.mode.ECB,
|
||||||
|
padding: CryptoJS.pad.Pkcs7
|
||||||
|
}).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
decryptRequest = (body) => {
|
||||||
|
return CryptoJS.AES.decrypt(body, KEY, {
|
||||||
|
mode: CryptoJS.mode.ECB,
|
||||||
|
padding: CryptoJS.pad.Pkcs7
|
||||||
|
}).toString(CryptoJS.enc.Utf8);
|
||||||
|
}
|
||||||
|
|
||||||
|
opOptions = (attributes, searchOptions, substring, key, between, sortOptions) => {
|
||||||
|
let where = {}, order = [];
|
||||||
|
attributes.forEach(element => {
|
||||||
|
if (searchOptions[element]) {
|
||||||
|
if (substring.includes(element)) {
|
||||||
|
where[element] = { [Op.substring]: searchOptions[element] };
|
||||||
|
} else if (key.includes(element)) {
|
||||||
|
where[element] = searchOptions[element];
|
||||||
|
} else if (between.includes(element)) {
|
||||||
|
where[element] = { [Op.between]: [searchOptions[element][0], searchOptions[element][1]] };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!sortOptions[element]) {
|
||||||
|
order.push([element, 'DESC']);
|
||||||
|
} else if (sortOptions[element]) {
|
||||||
|
order.push([element, 'ASC']);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return { where, order }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = BaseService;
|
||||||
9
app/middleware/packageBuild/buildXFType100.js
Normal file
9
app/middleware/packageBuild/buildXFType100.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
// 构造集团客户认证请求信息的数据部分
|
||||||
|
// 将token中的每一位字符转为ascii码后再转为十六进制字符串,最后重新拼接起来
|
||||||
|
module.exports = (token) => {
|
||||||
|
let code = '';
|
||||||
|
for (let i = 0; i < token.length; i++) {
|
||||||
|
code = code + token.charCodeAt(i).toString(16);
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
};
|
||||||
26
app/middleware/packageBuild/packageBuild.js
Normal file
26
app/middleware/packageBuild/packageBuild.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// 构造发送包,传入参数nowData和resendData
|
||||||
|
// nowData为当前数据段,resendData为重发数据段
|
||||||
|
// nowData和resendData都为数组,数组元素的内容为:信息类型编号 + 信息内容长度 + 信息内容
|
||||||
|
module.exports = (app, nowData, resendData) => {
|
||||||
|
const utils = app.middleware.utils;
|
||||||
|
utils.intrinsic.packageNumber++;
|
||||||
|
let now = new Date();
|
||||||
|
let sendTime = utils.packageItem(2, now.getFullYear()) +
|
||||||
|
utils.packageItem(1, now.getMonth() + 1) +
|
||||||
|
utils.packageItem(1, now.getDate());
|
||||||
|
let packageMsg = utils.packageItem(2, app.config.socketClient.id) +
|
||||||
|
utils.packageItem(2, app.config.socketClient.destination) +
|
||||||
|
utils.packageItem(4, utils.intrinsic.packageNumber) +
|
||||||
|
utils.packageItem(1, nowData.length) +
|
||||||
|
utils.packageItem(2, utils.arrItemLength(nowData)) +
|
||||||
|
(resendData ? '01' : '00') +
|
||||||
|
(resendData ? utils.packageItem(1, resendData.length) : '00') +
|
||||||
|
(resendData ? utils.packageItem(2, utils.arrItemLength(resendData)) : '0000') +
|
||||||
|
sendTime +
|
||||||
|
utils.arrTotalItem(nowData) +
|
||||||
|
(resendData ? sendTime : '') +
|
||||||
|
(resendData ? utils.arrTotalItem(resendData) : '') +
|
||||||
|
utils.intrinsic.separateIdentifiers;
|
||||||
|
const buffer = Buffer.from(packageMsg, 'hex');
|
||||||
|
return buffer;
|
||||||
|
};
|
||||||
32
app/middleware/parseDataPackage/parseDataPackage.js
Normal file
32
app/middleware/parseDataPackage/parseDataPackage.js
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
// 解析数据包
|
||||||
|
module.exports = (middleware, data) => {
|
||||||
|
const utils = middleware.utils;
|
||||||
|
const shunt = middleware.shunt;
|
||||||
|
let msg;
|
||||||
|
if (data == 'e5bf83e8b7b3') {
|
||||||
|
msg = 'e5bf83e8b7b37878787888888888';
|
||||||
|
} else {
|
||||||
|
let regex = /..?/g,
|
||||||
|
arr = data.match(regex),
|
||||||
|
baseArr = utils.getArr(arr, 0, 14),
|
||||||
|
baseObj = {
|
||||||
|
infoSource: { label: "信源", data: parseInt(baseArr[0] + baseArr[1], 16) },
|
||||||
|
destination: { label: "信宿", data: parseInt(baseArr[2] + baseArr[3], 16) },
|
||||||
|
packageNumber: { label: "包序号", data: parseInt(baseArr[4] + baseArr[5] + baseArr[6] + baseArr[7], 16) },
|
||||||
|
dataItem: { label: "当前数据项", data: parseInt(baseArr[8], 16) },
|
||||||
|
dataLength: { label: "当前数据段总长度", data: parseInt(baseArr[9] + baseArr[10], 16) },
|
||||||
|
resendFlag: { label: "重发标志", data: parseInt(baseArr[11], 16) },
|
||||||
|
resendItem: { label: "重发数据项", data: parseInt(baseArr[12], 16) },
|
||||||
|
resendLength: { label: "重发数据段总长度", data: parseInt(baseArr[13] + baseArr[14], 16) },
|
||||||
|
dataContent: { label: "数据段", }
|
||||||
|
};
|
||||||
|
if (baseObj.dataItem.data !== 0) {
|
||||||
|
shunt.selectXFType(middleware, 'now', baseObj, arr);
|
||||||
|
}
|
||||||
|
if (baseObj.resendFlag.data !== 0) {
|
||||||
|
shunt.selectXFType(middleware, 'resend', baseObj, arr);
|
||||||
|
}
|
||||||
|
msg = baseObj;
|
||||||
|
}
|
||||||
|
return msg;
|
||||||
|
};
|
||||||
24
app/middleware/parseDataPackage/parseMsg.js
Normal file
24
app/middleware/parseDataPackage/parseMsg.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
// 解析通信服务的通信数据
|
||||||
|
module.exports = (type, msg) => {
|
||||||
|
let regex, arr, result = '';
|
||||||
|
if (type == '0000') {
|
||||||
|
// 0000, 汉字编码,按14bit区位编码,前7位为区码,后7位为位码
|
||||||
|
// 区号和位号分别加上160,再分别转换成十六进制数,就成为四位的十六进制GB2312国家标准编码
|
||||||
|
regex = /.......?/g;
|
||||||
|
arr = msg.match(regex);
|
||||||
|
for (let t = 0; t < arr.length; t += 2) {
|
||||||
|
result = result + (parseInt(arr[t], 2) + 160).toString(16) + (parseInt(arr[t + 1], 2) + 160).toString(16);
|
||||||
|
}
|
||||||
|
} else if (type == '0001') {
|
||||||
|
// 0001,BCD码,按4bit编码,将每4bit二进制转换为一个十进制数,再拼接成字符串
|
||||||
|
regex = /....?/g;
|
||||||
|
arr = msg.match(regex);
|
||||||
|
arr.forEach(element => {
|
||||||
|
result = result + parseInt(element, 2);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 保留,二进制转为十进制
|
||||||
|
result = parseInt(msg, 2);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
125
app/middleware/parseDataPackage/parseXFType004.js
Normal file
125
app/middleware/parseDataPackage/parseXFType004.js
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
// 解析通信服务信息
|
||||||
|
module.exports = (middleware, dataArr, objCtx) => {
|
||||||
|
const utils = middleware.utils;
|
||||||
|
const parseDataPackage = middleware.parseDataPackage;
|
||||||
|
let informationFieldString = utils.hexToBinary(utils.getString(dataArr, 0, dataArr.length - 1));
|
||||||
|
objCtx.msgContent = {
|
||||||
|
originalMsg: utils.getString(dataArr, 0, dataArr.length - 1),
|
||||||
|
outboundTypeIdentification: { label: "出站类型标识", data: parseInt(informationFieldString.slice(0, 8), 2) },
|
||||||
|
receiverType: { label: "收方类型", data: parseInt(informationFieldString.slice(8, 16), 2) },
|
||||||
|
receiverAddress: { label: "收方地址", data: parseInt(informationFieldString.slice(parseInt(informationFieldString.slice(8, 16), 2) == 0 ? 40 : 16, 64), 2) },
|
||||||
|
msgLength: { label: "信息长度", data: parseInt(informationFieldString.slice(64, 80), 2) },
|
||||||
|
msgCategory: {
|
||||||
|
label: "信息类别",
|
||||||
|
retain: { label: "保留", data: informationFieldString.slice(80, 81) },
|
||||||
|
outboundFrameCategory: { label: "出站帧类别", data: informationFieldString.slice(81, 83) },
|
||||||
|
typeOfCommunication: { label: "通信类型", },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
informationFieldString = informationFieldString.slice(83, objCtx.msgContent.msgLength.data + 80);
|
||||||
|
switch (informationFieldString.slice(0, 2)) {
|
||||||
|
case '00':
|
||||||
|
objCtx.msgContent.msgCategory.typeOfCommunication.shortMsg = { label: "短报文", data: informationFieldString.slice(0, 2) };
|
||||||
|
objCtx.msgContent.msgCategory.typeOfCommunication.senderType = { label: "发方类型", data: informationFieldString.slice(2, 3) };
|
||||||
|
objCtx.msgContent.msgCategory.typeOfCommunication.packetID = {
|
||||||
|
label: "报文标识",
|
||||||
|
instantMessages: { label: "是否为即时报文出站", data: informationFieldString.slice(3, 4) },
|
||||||
|
acknowledgmentOfReceipt: { label: "是否需要收方用户自动回执", data: informationFieldString.slice(4, 5) },
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case '01':
|
||||||
|
if (informationFieldString.slice(2, 3) == '0') {
|
||||||
|
objCtx.msgContent.msgCategory.typeOfCommunication.onDemandCommunications = { label: "点播通信", data: informationFieldString.slice(0, 3) };
|
||||||
|
objCtx.msgContent.msgCategory.typeOfCommunication.senderType = { label: "发方类型", data: informationFieldString.slice(3, 4) };
|
||||||
|
objCtx.msgContent.msgCategory.typeOfCommunication.realTimeIdentification = { label: "实时标识", data: informationFieldString.slice(4, 5) };
|
||||||
|
} else {
|
||||||
|
objCtx.msgContent.msgCategory.typeOfCommunication.retain = { label: "保留", data: informationFieldString.slice(0, 5) };
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '10':
|
||||||
|
if (informationFieldString.slice(0, 5) == '10000') {
|
||||||
|
objCtx.msgContent.msgCategory.typeOfCommunication.receiptQueryResults = { label: "回执查询结果", data: informationFieldString.slice(0, 5) };
|
||||||
|
} else {
|
||||||
|
objCtx.msgContent.msgCategory.typeOfCommunication.retain = { label: "保留", data: informationFieldString.slice(0, 5) };
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '11':
|
||||||
|
if (informationFieldString.slice(0, 5) == '11000') {
|
||||||
|
objCtx.msgContent.msgCategory.typeOfCommunication.multicastCommunication = { label: "组播通信", data: informationFieldString.slice(0, 5) };
|
||||||
|
} else if (informationFieldString.slice(0, 5) == '11010') {
|
||||||
|
objCtx.msgContent.msgCategory.typeOfCommunication.broadcastCommunications = { label: "通播通信", data: informationFieldString.slice(0, 5) };
|
||||||
|
} else {
|
||||||
|
objCtx.msgContent.msgCategory.typeOfCommunication.retain = { label: "保留", data: informationFieldString.slice(0, 5) };
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
if (informationFieldString.slice(0, 2) == '00' || informationFieldString.slice(0, 3) == '010' || informationFieldString.slice(0, 5) == '11000' || informationFieldString.slice(0, 5) == '11010') {
|
||||||
|
let typeMsg = informationFieldString.slice(0, 5);
|
||||||
|
objCtx.msgContent.outboundMsg = {
|
||||||
|
label: "出站信息段",
|
||||||
|
firstFrame: { label: "是否首帧", data: informationFieldString.slice(5, 6) },
|
||||||
|
resumeFrame: { label: "有无续帧", data: informationFieldString.slice(6, 7) },
|
||||||
|
senderAddress: { label: "发方地址", },
|
||||||
|
};
|
||||||
|
if (typeMsg.slice(0, 3) == '001' || typeMsg.slice(0, 4) == '0101') {
|
||||||
|
objCtx.msgContent.outboundMsg.senderAddress.data = parseInt(informationFieldString.slice(7, 55), 2);
|
||||||
|
informationFieldString = informationFieldString.slice(55, informationFieldString.length);
|
||||||
|
} else {
|
||||||
|
objCtx.msgContent.outboundMsg.senderAddress.data = parseInt(informationFieldString.slice(7, 31), 2);
|
||||||
|
informationFieldString = informationFieldString.slice(31, informationFieldString.length);
|
||||||
|
};
|
||||||
|
objCtx.msgContent.outboundMsg.sendMsgTime = {
|
||||||
|
label: "发信时间",
|
||||||
|
weeklyInstructions: { label: "周指示", data: parseInt(informationFieldString.slice(0, 1), 2) },
|
||||||
|
intraWeekSeconds: { label: "周内秒", data: parseInt(informationFieldString.slice(1, 21), 2) },
|
||||||
|
};
|
||||||
|
if (typeMsg.slice(0, 2) == '00' && objCtx.msgContent.receiverAddress.data == '通播地址') {
|
||||||
|
objCtx.msgContent.outboundMsg.ancillaryInformation = {
|
||||||
|
label: "辅助信息",
|
||||||
|
msgNumber: { label: "信息编号", data: parseInt(informationFieldString.slice(21, 29), 2) },
|
||||||
|
};
|
||||||
|
informationFieldString = informationFieldString.slice(29, informationFieldString.length);
|
||||||
|
} else if (typeMsg.slice(0, 2) == '00' && objCtx.msgContent.receiverAddress.data == '组播地址') {
|
||||||
|
objCtx.msgContent.outboundMsg.ancillaryInformation = {
|
||||||
|
label: "辅助信息",
|
||||||
|
totalGroupMembers: { label: "编组组员总数", data: parseInt(informationFieldString.slice(21, 28), 2) },
|
||||||
|
onlineGroupMembers: { label: "在线组员数", data: parseInt(informationFieldString.slice(28, 35), 2) },
|
||||||
|
msgNumber: { label: "信息编号", data: parseInt(informationFieldString.slice(35, 43), 2) },
|
||||||
|
};
|
||||||
|
informationFieldString = informationFieldString.slice(43, informationFieldString.length);
|
||||||
|
} else if (typeMsg.slice(0, 5) == '11000') {
|
||||||
|
objCtx.msgContent.outboundMsg.multicastAncillaryInformation = {
|
||||||
|
label: "组播辅助信息",
|
||||||
|
totalGroupMembers: { label: "编组组员总数", data: parseInt(informationFieldString.slice(21, 28), 2) },
|
||||||
|
onlineGroupMembers: { label: "在线组员数", data: parseInt(informationFieldString.slice(28, 35), 2) },
|
||||||
|
};
|
||||||
|
informationFieldString = informationFieldString.slice(35, informationFieldString.length);
|
||||||
|
} else {
|
||||||
|
informationFieldString = informationFieldString.slice(21, informationFieldString.length);
|
||||||
|
}
|
||||||
|
objCtx.msgContent.outboundMsg.encodingCategory = { label: "编码类别", data: informationFieldString.slice(0, 4) }
|
||||||
|
objCtx.msgContent.outboundMsg.msgData = { label: "通信数据", data: parseDataPackage.parseMsg(objCtx.msgContent.outboundMsg.encodingCategory.data, informationFieldString.slice(4, informationFieldString.length)) }
|
||||||
|
} else if (informationFieldString.slice(0, 5) == '10000') {
|
||||||
|
objCtx.msgContent.receiptQueryResults = {
|
||||||
|
label: "回执查询结果",
|
||||||
|
communicationRecipientAddress: { label: "通信收方地址", data: parseInt(informationFieldString.slice(5, 29), 2), },
|
||||||
|
receiptsNumber: { label: "回执数", data: parseInt(informationFieldString.slice(29, 32), 2), },
|
||||||
|
}
|
||||||
|
if (objCtx.msgContent.receiptQueryResults.receiptsNumber.data !== 0) {
|
||||||
|
informationFieldString = informationFieldString.slice(32, informationFieldString.length);
|
||||||
|
for (let k = 0; k < objCtx.msgContent.receiptQueryResults.receiptsNumber.data; k++) {
|
||||||
|
let communicationTime = "communicationTime" + (k + 1);
|
||||||
|
objCtx.msgContent.receiptQueryResults[communicationTime] = {
|
||||||
|
label: "通信发信时间" + (k + 1),
|
||||||
|
weeklyInstructions: { label: "周指示", data: parseInt(informationFieldString.slice(0, 1), 2) },
|
||||||
|
intraWeekSeconds: { label: "周内秒", data: parseInt(informationFieldString.slice(1, 21), 2) },
|
||||||
|
}
|
||||||
|
informationFieldString = informationFieldString.slice(21, informationFieldString.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
objCtx.msgContent.retain = { label: "保留", data: informationFieldString.slice(5, informationFieldString.length), }
|
||||||
|
};
|
||||||
|
};
|
||||||
52
app/middleware/parseDataPackage/parseXFType005.js
Normal file
52
app/middleware/parseDataPackage/parseXFType005.js
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
// 解析广播服务信息
|
||||||
|
module.exports = (middleware, dataArr, objCtx) => {
|
||||||
|
const utils = middleware.utils;
|
||||||
|
let fixedFieldString = utils.hexToBinary(utils.getString(dataArr, 0, 15).slice(0, 16)),
|
||||||
|
informationFieldString = utils.hexToBinary(utils.getString(dataArr, 17, objCtx.contentLength.data + 3));
|
||||||
|
objCtx.msgContent = {
|
||||||
|
fixedField: {
|
||||||
|
label: "固定域",
|
||||||
|
satelliteNumber: { label: "卫星号", data: parseInt(fixedFieldString.slice(0, 6), 2) },
|
||||||
|
beamNumber: { label: "波束号", data: parseInt(fixedFieldString.slice(6, 10), 2) },
|
||||||
|
hyperframeCount: { label: "超帧计数", data: parseInt(fixedFieldString.slice(10, 27), 2) },
|
||||||
|
weeklyCount: { label: "周计数", data: parseInt(fixedFieldString.slice(27, 40), 2) },
|
||||||
|
frequencyDynamicControl: { label: "频度动态控制", data: parseInt(fixedFieldString.slice(40, 44), 2) },
|
||||||
|
outboundDelayForecast: { label: "出站时延预报", data: parseInt(fixedFieldString.slice(44, 48), 2) },
|
||||||
|
integrityInformation: { label: "完好性信息", data: parseInt(fixedFieldString.slice(48, 50), 2) },
|
||||||
|
reserved1: { label: "保留1", data: parseInt(fixedFieldString.slice(50, 55), 2) },
|
||||||
|
reserved2: { label: "保留2", data: parseInt(fixedFieldString.slice(55, 64), 2) },
|
||||||
|
repeat: { label: "重复" },
|
||||||
|
},
|
||||||
|
msgType: { label: "MsgType", data: parseInt(utils.hexToBinary(dataArr[16]), 2) },
|
||||||
|
informationField: { label: "类别信息域", },
|
||||||
|
}
|
||||||
|
objCtx.msgContent.informationField.satellitesNumber = { label: "本帧电文包括卫星数", data: parseInt(informationFieldString.slice(0, 3), 2) };
|
||||||
|
informationFieldString = informationFieldString.slice(3, informationFieldString.length);
|
||||||
|
if (objCtx.msgContent.informationField.satellitesNumber.data !== 0) {
|
||||||
|
for (let j = 0; j < objCtx.msgContent.informationField.satellitesNumber.data; j++) {
|
||||||
|
let satellitesObj = "satellitesObj" + (j + 1);
|
||||||
|
objCtx.msgContent.informationField[satellitesObj] = {
|
||||||
|
label: "卫星" + (j + 1),
|
||||||
|
PRNNumber: { label: "导航PRN号", data: parseInt(informationFieldString.slice(0, 6), 2) },
|
||||||
|
beamsNumber: { label: "出站波束数量", data: parseInt(informationFieldString.slice(6, 10), 2) },
|
||||||
|
reserved1: { label: "保留1", data: parseInt(informationFieldString.slice(10, 16), 2) },
|
||||||
|
reserved2: { label: "保留2", data: parseInt(informationFieldString.slice(16, 22), 2) },
|
||||||
|
}
|
||||||
|
informationFieldString = informationFieldString.slice(22, informationFieldString.length);
|
||||||
|
if (objCtx.msgContent.informationField[satellitesObj].beamsNumber.data !== 0) {
|
||||||
|
for (let l = 0; l < objCtx.msgContent.informationField[satellitesObj].beamsNumber.data; l++) {
|
||||||
|
let CenterObj = "CenterObj" + (l + 1);
|
||||||
|
objCtx.msgContent.informationField[satellitesObj][CenterObj] = {
|
||||||
|
label: "波束" + (l + 1) + "中心经纬度",
|
||||||
|
longitude: { label: "经度", data: parseInt(informationFieldString.slice(0, 1), 2) == 0 ? parseInt(informationFieldString.slice(1, 9), 2) : '-' + parseInt(informationFieldString.slice(1, 9), 2) },
|
||||||
|
latitude: { label: "纬度", data: parseInt(informationFieldString.slice(9, 10), 2) == 0 ? parseInt(informationFieldString.slice(10, 17), 2) : '-' + parseInt(informationFieldString.slice(10, 17), 2) },
|
||||||
|
}
|
||||||
|
informationFieldString = informationFieldString.slice(17, informationFieldString.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
objCtx.msgContent.informationField.reserved = { label: "保留", data: informationFieldString };
|
||||||
|
} else {
|
||||||
|
objCtx.msgContent.informationField.reserved = { label: "保留", data: informationFieldString };
|
||||||
|
}
|
||||||
|
};
|
||||||
16
app/middleware/parseDataPackage/parseXFType099.js
Normal file
16
app/middleware/parseDataPackage/parseXFType099.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
// 解析集团客户认证结果信息
|
||||||
|
module.exports = (dataArr, objCtx) => {
|
||||||
|
let authCoed = parseInt(dataArr.pop(), 16);
|
||||||
|
if (authCoed == 1) {
|
||||||
|
let token = '';
|
||||||
|
dataArr.forEach(element => {
|
||||||
|
token = token + String.fromCodePoint(parseInt(element, 16));
|
||||||
|
});
|
||||||
|
objCtx.token = token;
|
||||||
|
objCtx.authStatus = '1';
|
||||||
|
objCtx.resultMsg = '认证成功';
|
||||||
|
} else if (authCoed == 0) {
|
||||||
|
objCtx.authStatus = '0';
|
||||||
|
objCtx.resultMsg = '认证失败';
|
||||||
|
}
|
||||||
|
};
|
||||||
50
app/middleware/shunt/selectXFType.js
Normal file
50
app/middleware/shunt/selectXFType.js
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
// 解析服务信息类型
|
||||||
|
module.exports = (middleware, item, baseObj, arr) => {
|
||||||
|
const utils = middleware.utils;
|
||||||
|
const parseDataPackage = middleware.parseDataPackage;
|
||||||
|
let dataCtx = baseObj.dataContent, objName, labelString, dataArr, itemLength, itemType;
|
||||||
|
if (item == 'now') {
|
||||||
|
objName = 'nowData';
|
||||||
|
labelString = '当前';
|
||||||
|
itemLength = baseObj.dataLength.data;
|
||||||
|
dataArr = utils.getArr(arr, 15, 15 + itemLength - 1);
|
||||||
|
itemType = baseObj.dataItem.data;
|
||||||
|
} else if (item == 'resend') {
|
||||||
|
objName = 'resendData';
|
||||||
|
labelString = '重发';
|
||||||
|
itemLength = baseObj.resendLength.data;
|
||||||
|
dataArr = utils.getArr(arr, 15 + baseObj.dataLength.data, 15 + baseObj.dataLength.data + itemLength - 1);
|
||||||
|
itemType = baseObj.resendItem.data;
|
||||||
|
}
|
||||||
|
dataCtx[objName] = {
|
||||||
|
label: labelString + "数据段",
|
||||||
|
timeObj: {
|
||||||
|
year: { label: "年", data: parseInt(dataArr[0] + dataArr[1], 16) },
|
||||||
|
month: { label: "月", data: parseInt(dataArr[2], 16) },
|
||||||
|
day: { label: "日", data: parseInt(dataArr[3], 16) },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dataArr = utils.getArr(dataArr, 4, itemLength - 1);
|
||||||
|
for (let i = 0; i < itemType; i++) {
|
||||||
|
let contentObj = "contentObj" + (i + 1);
|
||||||
|
dataCtx[objName][contentObj] = {
|
||||||
|
label: labelString + "数据内容" + (i + 1),
|
||||||
|
typeNumber: { label: "信息类型编号", data: parseInt(dataArr[0] + dataArr[1], 16) },
|
||||||
|
contentLength: { label: "信息内容长度", data: parseInt(dataArr[2] + dataArr[3], 16) },
|
||||||
|
}
|
||||||
|
if (dataCtx[objName][contentObj].contentLength.data !== 0) {
|
||||||
|
dataArr = utils.getArr(dataArr, 4, itemLength - 5);
|
||||||
|
switch (dataCtx[objName][contentObj].typeNumber.data) {
|
||||||
|
case 4: parseDataPackage.parseXFType004(middleware, dataArr, dataCtx[objName][contentObj]);
|
||||||
|
break;
|
||||||
|
case 5: parseDataPackage.parseXFType005(middleware, dataArr, dataCtx[objName][contentObj]);
|
||||||
|
break;
|
||||||
|
case 99: parseDataPackage.parseXFType099(dataArr, dataCtx[objName][contentObj]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dataArr = utils.getArr(dataArr, dataCtx[objName][contentObj].contentLength.data, itemLength - 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
8
app/middleware/shunt/socketEmitter.js
Normal file
8
app/middleware/shunt/socketEmitter.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// socket事件监听器
|
||||||
|
const EventEmitter = require('events');
|
||||||
|
|
||||||
|
const socketEmitter = new EventEmitter();
|
||||||
|
|
||||||
|
module.exports = () => {
|
||||||
|
return socketEmitter;
|
||||||
|
};
|
||||||
14
app/middleware/shunt/socketResult.js
Normal file
14
app/middleware/shunt/socketResult.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
// 对数据包解析结果做类型判断,并根据不同类型返回不同结果
|
||||||
|
module.exports = (data) => {
|
||||||
|
for (let item in data) {
|
||||||
|
if (data[item].typeNumber) {
|
||||||
|
if (data[item].typeNumber.data == 4) {
|
||||||
|
return { type: 4, data: data[item] };
|
||||||
|
} else if (data[item].typeNumber.data == 5) {
|
||||||
|
return { type: 5, data: data[item] };
|
||||||
|
} else if (data[item].typeNumber.data == 99) {
|
||||||
|
return { type: 99, data: data[item].authStatus };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
135
app/middleware/socket/socketClient.js
Normal file
135
app/middleware/socket/socketClient.js
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
// socket客户端
|
||||||
|
const net = require('net');
|
||||||
|
|
||||||
|
module.exports = (app) => {
|
||||||
|
const { middleware } = app;
|
||||||
|
const packageBuild = middleware.packageBuild;
|
||||||
|
const utils = middleware.utils;
|
||||||
|
const parseDataPackage = middleware.parseDataPackage;
|
||||||
|
const shunt = middleware.shunt;
|
||||||
|
|
||||||
|
const client = new net.Socket();
|
||||||
|
|
||||||
|
let times, connectSwitch = true, reconnectSwitch = false;
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
reconnectSwitch = true;
|
||||||
|
}, 66000);
|
||||||
|
|
||||||
|
const createClient = () => {
|
||||||
|
if(connectSwitch) {
|
||||||
|
connectSwitch = false;
|
||||||
|
client.connect(app.config.socketClient.port, app.config.socketClient.ip, () => {
|
||||||
|
console.log(`socket: 连接到服务端: ${app.config.socketClient.ip + ':' + app.config.socketClient.port}`);
|
||||||
|
client.setKeepAlive(true, 60000);
|
||||||
|
reconnectSwitch = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
createClient();
|
||||||
|
|
||||||
|
// 重连服务端
|
||||||
|
const reconnect = () => {
|
||||||
|
if (reconnectSwitch) {
|
||||||
|
reconnectSwitch = false;
|
||||||
|
setTimeout(() => {
|
||||||
|
connectSwitch = true;
|
||||||
|
createClient();
|
||||||
|
}, 66000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
client.on('connectTimeout', () => {
|
||||||
|
reconnect();
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('timeout', () => {
|
||||||
|
reconnect();
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('end', () => {
|
||||||
|
reconnect();
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('close', () => {
|
||||||
|
reconnect();
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('error', (err) => {
|
||||||
|
utils.log('../../../socketLog', err);
|
||||||
|
reconnect();
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('connect', () => {
|
||||||
|
// 连接成功后的逻辑...
|
||||||
|
client.write(packageBuild.packageBuild(app, [utils.packageItem(2, 100) + utils.packageItem(2, packageBuild.buildXFType100(app.config.socketClient.token).length / 2) + packageBuild.buildXFType100(app.config.socketClient.token)]));
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('data', async (data) => {
|
||||||
|
// 在这里可以处理从服务器接收到的数据
|
||||||
|
// utils.log('../../../socketLog', data);
|
||||||
|
let msg = parseDataPackage.parseDataPackage(middleware, data.toString('hex').slice(0, data.toString('hex').length - 16));
|
||||||
|
if (msg == utils.intrinsic.heart) {
|
||||||
|
clearTimeout(times);
|
||||||
|
times = setTimeout(() => {
|
||||||
|
client.write(Buffer.from(msg, 'hex'));
|
||||||
|
}, 10000);
|
||||||
|
} else {
|
||||||
|
let nowResult = shunt.socketResult(msg.dataContent.nowData);
|
||||||
|
let resendResult = shunt.socketResult(msg.dataContent.resendData);
|
||||||
|
// 当前消息处理
|
||||||
|
if (nowResult.type == 99) {
|
||||||
|
// token验证处理程序
|
||||||
|
if (nowResult.data == '1') {
|
||||||
|
client.write(Buffer.from(utils.intrinsic.heart, 'hex'));
|
||||||
|
} else {
|
||||||
|
reconnect();
|
||||||
|
}
|
||||||
|
} else if (nowResult.type == 4) {
|
||||||
|
const { msgContent } = nowResult.data;
|
||||||
|
const { outboundMsg, receiverAddress, originalMsg } = msgContent;
|
||||||
|
const { senderAddress, msgData, encodingCategory } = outboundMsg;
|
||||||
|
// socket接收消息后触发事件监听器,将消息发送给websocket客户端并存储在数据库中
|
||||||
|
shunt.socketEmitter().emit(senderAddress.data, { encode_type: parseInt(encodingCategory.data), msg_data: msgData.data, created_at: new Date() });
|
||||||
|
await app.curl('http://127.0.0.1:' + app.server.address().port + '/shortMsg', {
|
||||||
|
dataType: 'json',
|
||||||
|
contentType: 'application/x-www-form-urlencoded',
|
||||||
|
method: 'POST',
|
||||||
|
timeout: 3000,
|
||||||
|
data: {
|
||||||
|
card_id: senderAddress.data,
|
||||||
|
receiver_address: receiverAddress.data,
|
||||||
|
original_msg: originalMsg,
|
||||||
|
send_type: 0,
|
||||||
|
encode_type: parseInt(encodingCategory.data),
|
||||||
|
msg_data: msgData.data,
|
||||||
|
created_at: new Date()
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 重发消息处理
|
||||||
|
if (resendResult && resendResult.type == 4) {
|
||||||
|
const { msgContent } = resendResult.data;
|
||||||
|
const { outboundMsg, receiverAddress } = msgContent;
|
||||||
|
const { senderAddress, msgData, encodingCategory } = outboundMsg;
|
||||||
|
// socket接收消息后触发事件监听器,将消息发送给websocket客户端并存储在数据库中
|
||||||
|
shunt.socketEmitter().emit(senderAddress.data, msgData.data);
|
||||||
|
await app.curl('http://127.0.0.1:' + app.server.address().port + '/shortMsg', {
|
||||||
|
dataType: 'json',
|
||||||
|
contentType: 'application/x-www-form-urlencoded',
|
||||||
|
method: 'POST',
|
||||||
|
timeout: 3000,
|
||||||
|
data: {
|
||||||
|
card_id: senderAddress.data,
|
||||||
|
receiver_address: receiverAddress.data,
|
||||||
|
msg: data.toString(),
|
||||||
|
send_type: 1,
|
||||||
|
encode_type: parseInt(encodingCategory.data),
|
||||||
|
msg_data: msgData.data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
8
app/middleware/utils/arrItemLength.js
Normal file
8
app/middleware/utils/arrItemLength.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// 计算数组中十六进制数据的总字节数,并在最终结果中加上时间信息的4字节长度
|
||||||
|
module.exports = (arr) => {
|
||||||
|
let length = 0;
|
||||||
|
arr.forEach(element => {
|
||||||
|
length = length + (element.length / 2);
|
||||||
|
});
|
||||||
|
return length + 4;
|
||||||
|
};
|
||||||
8
app/middleware/utils/arrTotalItem.js
Normal file
8
app/middleware/utils/arrTotalItem.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// 将数组中的所有元素按下标顺序拼接成字符串
|
||||||
|
module.exports = (arr) => {
|
||||||
|
let total = '';
|
||||||
|
arr.forEach(element => {
|
||||||
|
total = total + element;
|
||||||
|
});
|
||||||
|
return total;
|
||||||
|
};
|
||||||
10
app/middleware/utils/getArr.js
Normal file
10
app/middleware/utils/getArr.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
// 截取数组元素,组成新数组并返回
|
||||||
|
module.exports = (arr, start, end) => {
|
||||||
|
let newArr = [];
|
||||||
|
arr.forEach((element, index) => {
|
||||||
|
if (index >= start && index <= end) {
|
||||||
|
newArr.push(element);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return newArr;
|
||||||
|
};
|
||||||
10
app/middleware/utils/getString.js
Normal file
10
app/middleware/utils/getString.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
// 截取数组元素,拼接成字符串并返回
|
||||||
|
module.exports = (arr, start, end) => {
|
||||||
|
let newString = '';
|
||||||
|
arr.forEach((element, index) => {
|
||||||
|
if (index >= start && index <= end) {
|
||||||
|
newString = newString + element;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return newString;
|
||||||
|
};
|
||||||
13
app/middleware/utils/getTimes.js
Normal file
13
app/middleware/utils/getTimes.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
// 返回时间对象
|
||||||
|
module.exports = () => {
|
||||||
|
let now = new Date(),
|
||||||
|
times = {
|
||||||
|
year: now.getFullYear(),
|
||||||
|
month: now.getMonth() + 1,
|
||||||
|
day: now.getDate(),
|
||||||
|
hour: now.getHours(),
|
||||||
|
minute: now.getMinutes(),
|
||||||
|
second: now.getSeconds()
|
||||||
|
};
|
||||||
|
return times;
|
||||||
|
};
|
||||||
15
app/middleware/utils/hexToBinary.js
Normal file
15
app/middleware/utils/hexToBinary.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
// 十六进制转二进制
|
||||||
|
module.exports = (hex) => {
|
||||||
|
let hexChars = '0123456789ABCDEF';
|
||||||
|
let binaryString = '';
|
||||||
|
for (let i = 0; i < hex.length; i++) {
|
||||||
|
let hexIndex = hexChars.indexOf(hex[i].toUpperCase());
|
||||||
|
let binaryDigit = hexIndex.toString(2);
|
||||||
|
// 确保每个十六进制数字转换为四位二进制数字
|
||||||
|
while (binaryDigit.length < 4) {
|
||||||
|
binaryDigit = '0' + binaryDigit;
|
||||||
|
}
|
||||||
|
binaryString += binaryDigit;
|
||||||
|
}
|
||||||
|
return binaryString;
|
||||||
|
};
|
||||||
8
app/middleware/utils/intrinsic.js
Normal file
8
app/middleware/utils/intrinsic.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
module.exports = {
|
||||||
|
// 数据包最后固定十六进制串作为TCP流的分隔识别符
|
||||||
|
separateIdentifiers: '7878787888888888',
|
||||||
|
// 心跳检测信息固定格式
|
||||||
|
heart: 'e5bf83e8b7b37878787888888888',
|
||||||
|
// 包序号,从0开始,随程序运行变大
|
||||||
|
packageNumber: 0,
|
||||||
|
};
|
||||||
72
app/middleware/utils/log.js
Normal file
72
app/middleware/utils/log.js
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
// 错误日志
|
||||||
|
const fs = require('fs');
|
||||||
|
const os = require('os');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const dirCheck = (dirPath) => {
|
||||||
|
// 检查文件夹是否存在
|
||||||
|
fs.access(dirPath, fs.constants.F_OK, (err) => {
|
||||||
|
if (err) {
|
||||||
|
// 文件夹不存在
|
||||||
|
console.log('文件夹不存在,正在创建...');
|
||||||
|
fs.mkdir(dirPath, { recursive: true }, (err) => {
|
||||||
|
if (err) throw err;
|
||||||
|
console.log('文件夹已创建');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 文件夹存在
|
||||||
|
console.log('文件夹已存在');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = (filePath, msg) => {
|
||||||
|
// 获取时间
|
||||||
|
let now = new Date(),
|
||||||
|
times = {
|
||||||
|
year: now.getFullYear(),
|
||||||
|
month: now.getMonth() + 1,
|
||||||
|
day: now.getDate(),
|
||||||
|
hour: now.getHours(),
|
||||||
|
minute: now.getMinutes(),
|
||||||
|
second: now.getSeconds()
|
||||||
|
};
|
||||||
|
// 获取操作系统类型
|
||||||
|
const type = os.type();
|
||||||
|
console.log(`操作系统类型: ${type}`);
|
||||||
|
filePath = path.join(__dirname, filePath);
|
||||||
|
dirCheck(filePath);
|
||||||
|
const yearPath = filePath + '/' + times.year;
|
||||||
|
dirCheck(yearPath);
|
||||||
|
const monthPath = yearPath + '/' + times.month;
|
||||||
|
dirCheck(monthPath);
|
||||||
|
const dayPath = monthPath + '/' + times.day + '.txt';
|
||||||
|
const logTime = '[' + times.year + '-' + times.month + '-' + times.day + '>>>' + times.hour + ':' + times.minute + ':' + times.second + ']' + '>>>';
|
||||||
|
let crlf;
|
||||||
|
// 判断操作系统类型,设置换行符
|
||||||
|
if (type === 'Windows_NT') {
|
||||||
|
crlf = '\n';
|
||||||
|
} else {
|
||||||
|
crlf = '\r\n';
|
||||||
|
}
|
||||||
|
// 读取文件内容
|
||||||
|
fs.readFile(dayPath, 'utf8', (err, data) => {
|
||||||
|
if (err) {
|
||||||
|
if (err.code === 'ENOENT') {
|
||||||
|
// 文件不存在,直接写入新内容(这里实际上还是使用了覆盖的方式)
|
||||||
|
fs.writeFile(dayPath, logTime + msg + crlf, (err) => {
|
||||||
|
if (err) throw err;
|
||||||
|
console.log('文件已创建并写入新内容');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 文件存在,追加新内容
|
||||||
|
fs.appendFile(dayPath, logTime + msg + crlf, (err) => {
|
||||||
|
if (err) throw err;
|
||||||
|
console.log('新内容已追加到文件');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
8
app/middleware/utils/packageItem.js
Normal file
8
app/middleware/utils/packageItem.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// 判断十六进制数据的长度,若长度不满足条件,则在左侧补0,直至长度满足条件
|
||||||
|
module.exports = (length, data) => {
|
||||||
|
let item = data.toString(16);
|
||||||
|
for (let i = 0; i < (length * 2) - data.toString(16).length; i++) {
|
||||||
|
item = '0' + item;
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
};
|
||||||
47
app/middleware/webSocket/webSocketServer.js
Normal file
47
app/middleware/webSocket/webSocketServer.js
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
// webSocket服务端
|
||||||
|
const http = require('http');
|
||||||
|
const { Server } = require('socket.io');
|
||||||
|
|
||||||
|
module.exports = (app) => {
|
||||||
|
// 创建HTTP服务器并监听8010端口
|
||||||
|
const server = http.createServer(function (req, res) {
|
||||||
|
if (req.url === '/') {
|
||||||
|
res.writeHead(200, {'Content-Type': 'text/plain'});
|
||||||
|
res.end('Hello World!');
|
||||||
|
}
|
||||||
|
}).listen(app.config.webSocketServer.port);
|
||||||
|
|
||||||
|
let io = new Server(server, {
|
||||||
|
cors: {
|
||||||
|
origin: "http://127.0.0.1", // 生产环境应指定具体域名
|
||||||
|
methods: ["GET", "POST"]
|
||||||
|
},
|
||||||
|
// path: app.config.webSocketServer.path,
|
||||||
|
transports: ['websocket', 'polling'],
|
||||||
|
connectionStateRecovery: {}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(`websocket: ${ app.config.webSocketServer.ip }服务器已启动,监听端口:${ app.config.webSocketServer.port }`);
|
||||||
|
|
||||||
|
const socketEmitter = app.middleware.shunt.socketEmitter();
|
||||||
|
const utils = app.middleware.utils;
|
||||||
|
|
||||||
|
io.on('connection', (socket) => {
|
||||||
|
socket.on('message', (cardID) => {
|
||||||
|
if(socketEmitter.listeners(cardID).length !== 0) {
|
||||||
|
socketEmitter.removeAllListeners(cardID);
|
||||||
|
};
|
||||||
|
socketEmitter.on(cardID, (msg) => {
|
||||||
|
socket.emit(cardID, msg);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
io.on('error', (err) => {
|
||||||
|
utils.log('../../webSocketLog', err);
|
||||||
|
io = new Server(app.config.webSocketServer.port, {
|
||||||
|
cors: true,
|
||||||
|
connectionStateRecovery: {}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
24
app/model/BShortMsg.js
Normal file
24
app/model/BShortMsg.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = (app) => {
|
||||||
|
const { INTEGER, CHAR, TEXT, DATE } = app.Sequelize;
|
||||||
|
|
||||||
|
const BShortMsg = app.model.define('bshort-msg', {
|
||||||
|
id: { type: INTEGER(11), primaryKey: true, autoIncrement: true },
|
||||||
|
user_uid: CHAR(15),
|
||||||
|
card_id: CHAR(8),
|
||||||
|
receiver_address: CHAR(8),
|
||||||
|
original_msg: TEXT,
|
||||||
|
send_type: INTEGER(1),
|
||||||
|
encode_type: INTEGER(1),
|
||||||
|
msg_data: TEXT,
|
||||||
|
created_at: DATE,
|
||||||
|
},{
|
||||||
|
freezeTableName: true,
|
||||||
|
timestamp: true,
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
return BShortMsg;
|
||||||
|
};
|
||||||
30
app/model/BSide.js
Normal file
30
app/model/BSide.js
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = (app) => {
|
||||||
|
const { INTEGER, CHAR, STRING, DATE } = app.Sequelize;
|
||||||
|
|
||||||
|
const BSide = app.model.define('b-side', {
|
||||||
|
id: { type: INTEGER(8), primaryKey: true, autoIncrement: true },
|
||||||
|
uid: CHAR(15),
|
||||||
|
salt: CHAR(24),
|
||||||
|
status: INTEGER(3),
|
||||||
|
role: INTEGER(3),
|
||||||
|
account_name: STRING(20),
|
||||||
|
password: CHAR(64),
|
||||||
|
organization: CHAR(16),
|
||||||
|
user_name: STRING(20),
|
||||||
|
phone: CHAR(11),
|
||||||
|
msg: STRING(300),
|
||||||
|
created_at: DATE,
|
||||||
|
updated_at: DATE,
|
||||||
|
login_at: DATE,
|
||||||
|
login_status: INTEGER(3)
|
||||||
|
},{
|
||||||
|
freezeTableName: true,
|
||||||
|
timestamp: true,
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
return BSide;
|
||||||
|
};
|
||||||
20
app/model/BindBrecord.js
Normal file
20
app/model/BindBrecord.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = (app) => {
|
||||||
|
const { INTEGER, CHAR, DATE } = app.Sequelize;
|
||||||
|
|
||||||
|
const BindBrecord = app.model.define('bind-brecord', {
|
||||||
|
id: { type: INTEGER(11), primaryKey: true, autoIncrement: true },
|
||||||
|
user_uid: CHAR(15),
|
||||||
|
card_id: CHAR(8),
|
||||||
|
type: INTEGER(1),
|
||||||
|
created_at: DATE,
|
||||||
|
},{
|
||||||
|
freezeTableName: true,
|
||||||
|
timestamp: true,
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
return BindBrecord;
|
||||||
|
};
|
||||||
18
app/model/BuserBind.js
Normal file
18
app/model/BuserBind.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = (app) => {
|
||||||
|
const { INTEGER, CHAR } = app.Sequelize;
|
||||||
|
|
||||||
|
const BuserBind = app.model.define('buser-bind', {
|
||||||
|
id: { type: INTEGER(8), primaryKey: true, autoIncrement: true },
|
||||||
|
card_id: CHAR(8),
|
||||||
|
user_uid: CHAR(15),
|
||||||
|
},{
|
||||||
|
freezeTableName: true,
|
||||||
|
timestamp: false,
|
||||||
|
createdAt: false,
|
||||||
|
updatedAt: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
return BuserBind;
|
||||||
|
};
|
||||||
20
app/model2/BindCrecord.js
Normal file
20
app/model2/BindCrecord.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = (app) => {
|
||||||
|
const { INTEGER, CHAR, DATE } = app.Sequelize;
|
||||||
|
|
||||||
|
const BindCrecord = app.model2.define('bind-crecord', {
|
||||||
|
id: { type: INTEGER(11), primaryKey: true, autoIncrement: true },
|
||||||
|
user_uid: CHAR(15),
|
||||||
|
card_id: CHAR(8),
|
||||||
|
type: INTEGER(1),
|
||||||
|
created_at: DATE,
|
||||||
|
},{
|
||||||
|
freezeTableName: true,
|
||||||
|
timestamp: true,
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
return BindCrecord;
|
||||||
|
};
|
||||||
24
app/model2/CShortMsg.js
Normal file
24
app/model2/CShortMsg.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = (app) => {
|
||||||
|
const { INTEGER, CHAR, TEXT, DATE } = app.Sequelize;
|
||||||
|
|
||||||
|
const CShortMsg = app.model2.define('cshort-msg', {
|
||||||
|
id: { type: INTEGER(11), primaryKey: true, autoIncrement: true },
|
||||||
|
user_uid: CHAR(15),
|
||||||
|
card_id: CHAR(8),
|
||||||
|
receiver_address: CHAR(8),
|
||||||
|
original_msg: TEXT,
|
||||||
|
send_type: INTEGER(1),
|
||||||
|
encode_type: INTEGER(1),
|
||||||
|
msg_data: TEXT,
|
||||||
|
created_at: DATE,
|
||||||
|
},{
|
||||||
|
freezeTableName: true,
|
||||||
|
timestamp: true,
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
return CShortMsg;
|
||||||
|
};
|
||||||
34
app/model2/CSide.js
Normal file
34
app/model2/CSide.js
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = (app) => {
|
||||||
|
const { INTEGER, CHAR, STRING, DATE } = app.Sequelize;
|
||||||
|
|
||||||
|
const CSide = app.model2.define('c-side', {
|
||||||
|
id: { type: INTEGER(8), primaryKey: true, autoIncrement: true },
|
||||||
|
uid: CHAR(15),
|
||||||
|
salt: CHAR(24),
|
||||||
|
status: INTEGER(3),
|
||||||
|
role: INTEGER(3),
|
||||||
|
avatar: CHAR(15),
|
||||||
|
account_name: STRING(20),
|
||||||
|
password: CHAR(64),
|
||||||
|
user_name: STRING(20),
|
||||||
|
phone: CHAR(11),
|
||||||
|
gender: INTEGER(1),
|
||||||
|
age: INTEGER(3),
|
||||||
|
email: STRING(254),
|
||||||
|
address: STRING(300),
|
||||||
|
post_code: CHAR(6),
|
||||||
|
created_at: DATE,
|
||||||
|
updated_at: DATE,
|
||||||
|
login_at: DATE,
|
||||||
|
login_status: INTEGER(3)
|
||||||
|
},{
|
||||||
|
freezeTableName: true,
|
||||||
|
timestamp: true,
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
return CSide;
|
||||||
|
};
|
||||||
18
app/model2/CuserBind.js
Normal file
18
app/model2/CuserBind.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = (app) => {
|
||||||
|
const { INTEGER, CHAR } = app.Sequelize;
|
||||||
|
|
||||||
|
const CuserBind = app.model2.define('cuser-bind', {
|
||||||
|
id: { type: INTEGER(8), primaryKey: true, autoIncrement: true },
|
||||||
|
user_uid: CHAR(15),
|
||||||
|
card_id: CHAR(8),
|
||||||
|
},{
|
||||||
|
freezeTableName: true,
|
||||||
|
timestamp: false,
|
||||||
|
createdAt: false,
|
||||||
|
updatedAt: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
return CuserBind;
|
||||||
|
};
|
||||||
22
app/model3/BDCard.js
Normal file
22
app/model3/BDCard.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = (app) => {
|
||||||
|
const { INTEGER, CHAR, DATE } = app.Sequelize;
|
||||||
|
|
||||||
|
const BDCard = app.model3.define('bd-card', {
|
||||||
|
id: { type: INTEGER(8), primaryKey: true, autoIncrement: true },
|
||||||
|
card_id: CHAR(8),
|
||||||
|
card_imsi: CHAR(18),
|
||||||
|
type: INTEGER(3),
|
||||||
|
status: INTEGER(3),
|
||||||
|
created_at: DATE,
|
||||||
|
updated_at: DATE,
|
||||||
|
},{
|
||||||
|
freezeTableName: true,
|
||||||
|
timestamp: true,
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
return BDCard;
|
||||||
|
};
|
||||||
24
app/model4/Account.js
Normal file
24
app/model4/Account.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = (app) => {
|
||||||
|
const { INTEGER, CHAR, STRING, DATE } = app.Sequelize;
|
||||||
|
|
||||||
|
const Account = app.model4.define('account', {
|
||||||
|
id: { type: INTEGER(8), primaryKey: true, autoIncrement: true },
|
||||||
|
uid: CHAR(15),
|
||||||
|
salt: CHAR(24),
|
||||||
|
contest_uid: CHAR(15),
|
||||||
|
account_name: STRING(20),
|
||||||
|
password: CHAR(64),
|
||||||
|
status: INTEGER(3),
|
||||||
|
created_at: DATE,
|
||||||
|
login_status: INTEGER(3)
|
||||||
|
},{
|
||||||
|
freezeTableName: true,
|
||||||
|
timestamp: true,
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
return Account;
|
||||||
|
};
|
||||||
24
app/model4/TShortMsg.js
Normal file
24
app/model4/TShortMsg.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = (app) => {
|
||||||
|
const { INTEGER, CHAR, TEXT, DATE } = app.Sequelize;
|
||||||
|
|
||||||
|
const TShortMsg = app.model4.define('tshort-msg', {
|
||||||
|
id: { type: INTEGER(8), primaryKey: true, autoIncrement: true },
|
||||||
|
user_uid: CHAR(15),
|
||||||
|
card_id: CHAR(8),
|
||||||
|
receiver_address: CHAR(8),
|
||||||
|
original_msg: TEXT,
|
||||||
|
send_type: INTEGER(1),
|
||||||
|
encode_type: INTEGER(1),
|
||||||
|
msg_data: TEXT,
|
||||||
|
created_at: DATE,
|
||||||
|
},{
|
||||||
|
freezeTableName: true,
|
||||||
|
timestamp: true,
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
return TShortMsg;
|
||||||
|
};
|
||||||
18
app/model4/TuserBind.js
Normal file
18
app/model4/TuserBind.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = (app) => {
|
||||||
|
const { INTEGER, CHAR } = app.Sequelize;
|
||||||
|
|
||||||
|
const TuserBind = app.model4.define('tuser-bind', {
|
||||||
|
id: { type: INTEGER(8), primaryKey: true, autoIncrement: true },
|
||||||
|
card_id: CHAR(8),
|
||||||
|
user_uid: CHAR(15),
|
||||||
|
},{
|
||||||
|
freezeTableName: true,
|
||||||
|
timestamp: false,
|
||||||
|
createdAt: false,
|
||||||
|
updatedAt: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
return TuserBind;
|
||||||
|
};
|
||||||
41
app/router.js
Normal file
41
app/router.js
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
* @param {Egg.Application} app - egg application
|
||||||
|
*/
|
||||||
|
|
||||||
|
// const { Server } = require('socket.io');
|
||||||
|
|
||||||
|
// const net = require('net');
|
||||||
|
|
||||||
|
// const EventEmitter = require('events');
|
||||||
|
|
||||||
|
module.exports = app => {
|
||||||
|
const { router, controller, middleware } = app;
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
// 启动socket客户端
|
||||||
|
middleware.socket.socketClient(app);
|
||||||
|
// 启动webSocket服务端
|
||||||
|
middleware.webSocket.webSocketServer(app);
|
||||||
|
}, 10000);
|
||||||
|
|
||||||
|
// 获取卡号
|
||||||
|
router.post('/getCard', controller.home.getCard);
|
||||||
|
// 搜索卡号
|
||||||
|
router.post('/searchCard', controller.home.searchCard);
|
||||||
|
// 绑卡
|
||||||
|
router.post('/bindCard', controller.home.bindCard);
|
||||||
|
// 解绑
|
||||||
|
router.post('/unBindingCard', controller.home.unBindingCard);
|
||||||
|
// B端单位管理员解绑
|
||||||
|
router.post('/unBindManager', controller.home.unBindManager);
|
||||||
|
// 获取绑定记录
|
||||||
|
router.post('/getRecord', controller.home.getRecord);
|
||||||
|
// 存储消息记录
|
||||||
|
router.post('/shortMsg', controller.home.shortMsg);
|
||||||
|
// 获取历史消息
|
||||||
|
router.post('/getHistoryMsg', controller.home.getHistoryMsg);
|
||||||
|
// 删除历史消息
|
||||||
|
router.post('/delHistoryMsg', controller.home.delHistoryMsg);
|
||||||
|
// 获取单位用户
|
||||||
|
router.post('/bsideManager', controller.home.bsideManager);
|
||||||
|
};
|
||||||
403
app/service/home.js
Normal file
403
app/service/home.js
Normal file
@@ -0,0 +1,403 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const Service = require('../core/base_service');
|
||||||
|
|
||||||
|
const { Op } = require('sequelize');
|
||||||
|
|
||||||
|
const shunt = (uid) => {
|
||||||
|
return uid[uid.length - 1];
|
||||||
|
};
|
||||||
|
|
||||||
|
const fileName = 'home';
|
||||||
|
|
||||||
|
class HomeService extends Service {
|
||||||
|
// 获取卡号
|
||||||
|
async getCard(uid) {
|
||||||
|
const { ctx } = this;
|
||||||
|
try {
|
||||||
|
const where = { user_uid: uid };
|
||||||
|
const uidLastCode = shunt(uid);
|
||||||
|
const model = {
|
||||||
|
"B": ctx.model.BuserBind,
|
||||||
|
"C": ctx.model2.CuserBind,
|
||||||
|
"T": ctx.model4.TuserBind,
|
||||||
|
};
|
||||||
|
const result = await model[uidLastCode].findOne({ where });
|
||||||
|
return result || false;
|
||||||
|
} catch (error) {
|
||||||
|
const blockName = fileName + "--" + "getCard";
|
||||||
|
ctx.app.middleware.utils.log('../../../serviceLog', blockName + ">>>>" + error);
|
||||||
|
return 'error';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 搜索卡号
|
||||||
|
async searchCard(cardID) {
|
||||||
|
const { ctx } = this;
|
||||||
|
try {
|
||||||
|
const where = { card_id: cardID };
|
||||||
|
const result = await ctx.model3.BDCard.findOne({ where });
|
||||||
|
return result || false;
|
||||||
|
} catch (error) {
|
||||||
|
const blockName = fileName + "--" + "searchCard";
|
||||||
|
ctx.app.middleware.utils.log('../../../serviceLog', blockName + ">>>>" + error);
|
||||||
|
return 'error';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 绑卡
|
||||||
|
async bindCard(uid, body) {
|
||||||
|
const { ctx } = this;
|
||||||
|
try {
|
||||||
|
const { cardID, IMSI } = body;
|
||||||
|
const where = {
|
||||||
|
card_id: cardID,
|
||||||
|
card_imsi: IMSI
|
||||||
|
};
|
||||||
|
const status = shunt(uid) == 'B' ? 1 : 2;
|
||||||
|
const defaults = {
|
||||||
|
card_id: cardID,
|
||||||
|
card_imsi: IMSI,
|
||||||
|
type: 0,
|
||||||
|
status,
|
||||||
|
created_at: new Date(),
|
||||||
|
updated_at: new Date()
|
||||||
|
};
|
||||||
|
const [card] = await ctx.model3.BDCard.findOrCreate({ where, defaults });
|
||||||
|
const model = {
|
||||||
|
"B": ctx.model.BuserBind,
|
||||||
|
"C": ctx.model2.CuserBind,
|
||||||
|
"T": ctx.model4.TuserBind
|
||||||
|
};
|
||||||
|
const uidLastCode = shunt(uid);
|
||||||
|
const bindCheck = await model[uidLastCode].findOne({ where: { user_uid: uid } });
|
||||||
|
if (card.status !== 0 || bindCheck.value) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
const cardResult = await ctx.model3.BDCard.update({ status }, { where });
|
||||||
|
const bindForm = {
|
||||||
|
user_uid: uid,
|
||||||
|
card_id: cardID
|
||||||
|
};
|
||||||
|
const resultForm = {
|
||||||
|
user_uid: uid,
|
||||||
|
card_id: cardID,
|
||||||
|
type: 1,
|
||||||
|
created_at: new Date()
|
||||||
|
};
|
||||||
|
const modelName = {
|
||||||
|
"B": ctx.model.BindBrecord,
|
||||||
|
"C": ctx.model2.BindCrecord
|
||||||
|
};
|
||||||
|
const bindResult = await model[uidLastCode].create(bindForm);
|
||||||
|
const recordResult = await modelName[uidLastCode].create(resultForm);
|
||||||
|
return cardResult[0] && bindResult && recordResult ? true : false;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const blockName = fileName + "--" + "bindCard";
|
||||||
|
ctx.app.middleware.utils.log('../../../serviceLog', blockName + ">>>>" + error);
|
||||||
|
return 'error';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解绑
|
||||||
|
async unBindingCard(uid, body) {
|
||||||
|
const { ctx } = this;
|
||||||
|
try {
|
||||||
|
const { cardID, IMSI } = body;
|
||||||
|
const cardWhere = {
|
||||||
|
card_id: cardID,
|
||||||
|
card_imsi: IMSI
|
||||||
|
};
|
||||||
|
const cardResult = await ctx.model3.BDCard.update({ status: 0 }, { where: cardWhere });
|
||||||
|
if (cardResult[0] !== 0) {
|
||||||
|
const where = {
|
||||||
|
user_uid: uid,
|
||||||
|
card_id: cardID
|
||||||
|
};
|
||||||
|
const form = {
|
||||||
|
user_uid: uid,
|
||||||
|
card_id: cardID,
|
||||||
|
type: 0,
|
||||||
|
created_at: new Date()
|
||||||
|
};
|
||||||
|
const uidLastCode = shunt(uid);
|
||||||
|
const model = {
|
||||||
|
"B": ctx.model.BuserBind,
|
||||||
|
"C": ctx.model2.CuserBind,
|
||||||
|
};
|
||||||
|
const modelName = {
|
||||||
|
"B": ctx.model.BindBrecord,
|
||||||
|
"C": ctx.model2.BindCrecord
|
||||||
|
};
|
||||||
|
const bindResult = await model[uidLastCode].destroy({ where });
|
||||||
|
const recordResult = await modelName[uidLastCode].create(form);
|
||||||
|
return bindResult && recordResult ? true : false;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const blockName = fileName + "--" + "unBindingCard";
|
||||||
|
ctx.app.middleware.utils.log('../../../serviceLog', blockName + ">>>>" + error);
|
||||||
|
return 'error';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// B端单位管理员解绑
|
||||||
|
async unBindManager(uid, modelType, password, requestMsg) {
|
||||||
|
const { ctx } = this;
|
||||||
|
try {
|
||||||
|
const result = await ctx.model.BSide.findOne({ where: { uid, status: { [Op.not]: 2 }, role: 1 } });
|
||||||
|
if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt))) return false;
|
||||||
|
let where = {};
|
||||||
|
let attributes = ['uid'];
|
||||||
|
if (modelType == "single") {
|
||||||
|
where = requestMsg;
|
||||||
|
} else if (modelType == "multiple") {
|
||||||
|
let account_name = [], user_name = [], phone = [];
|
||||||
|
for (const key in requestMsg) {
|
||||||
|
requestMsg[key].forEach(element => {
|
||||||
|
account_name.push(element.account_name),
|
||||||
|
user_name.push(element.user_name),
|
||||||
|
phone.push(element.phone)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
where = { account_name, user_name, phone };
|
||||||
|
} else if (modelType == "all") {
|
||||||
|
const role = { [Op.not]: 1 };
|
||||||
|
where = { organization: result.dataValues.organization, role };
|
||||||
|
}
|
||||||
|
|
||||||
|
const userResult = await ctx.model.BSide.findAll({ attributes, where });
|
||||||
|
if (!userResult[0]) return false;
|
||||||
|
let user_uid = [];
|
||||||
|
userResult.forEach(element => {
|
||||||
|
user_uid.push(element.dataValues.uid);
|
||||||
|
});
|
||||||
|
attributes = ['card_id'];
|
||||||
|
where = { user_uid };
|
||||||
|
const bindResult = await ctx.model.BuserBind.findAll({ attributes, where });
|
||||||
|
if (!bindResult[0]) return false;
|
||||||
|
let card_id = [], recordForm = [];
|
||||||
|
bindResult.forEach((element, index) => {
|
||||||
|
card_id.push(element.dataValues.card_id);
|
||||||
|
recordForm.push({ user_uid: user_uid[index], card_id: card_id[index], type: 0, created_at: new Date() });
|
||||||
|
});
|
||||||
|
where = { user_uid, card_id };
|
||||||
|
const unbindResult = await ctx.model.BuserBind.destroy({ where });
|
||||||
|
const recordResult = await ctx.model.BindBrecord.bulkCreate(recordForm);
|
||||||
|
where = { card_id };
|
||||||
|
const cardResult = await ctx.model3.BDCard.update({ status: 0 }, { where });
|
||||||
|
return unbindResult !== 0 && recordResult[0] && cardResult[0] !== 0 ? true : false;
|
||||||
|
} catch (error) {
|
||||||
|
const blockName = fileName + "--" + "unBindManager";
|
||||||
|
ctx.app.middleware.utils.log('../../../serviceLog', blockName + ">>>>" + error);
|
||||||
|
return 'error';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取绑定记录
|
||||||
|
async getRecord(uid, body) {
|
||||||
|
const { ctx } = this;
|
||||||
|
try {
|
||||||
|
let { offset, limit, searchOptions, sortOptions } = body;
|
||||||
|
offset = (offset - 1) * limit;
|
||||||
|
let attributes = ['card_id', 'type', 'created_at'],
|
||||||
|
where = { user_uid: uid }, order = [], dbOptions, joinSubstring = [],
|
||||||
|
substring = ['card_id'], key = ['type'], between = ['created_at'];
|
||||||
|
const uidLastCode = shunt(uid);
|
||||||
|
attributes.forEach(element => {
|
||||||
|
if (searchOptions[element]) {
|
||||||
|
if(searchOptions[element] == '*空') {
|
||||||
|
if(joinSubstring.includes(element)) {
|
||||||
|
where[element] = null;
|
||||||
|
} else {
|
||||||
|
where[element] = [null, ''];
|
||||||
|
}
|
||||||
|
} else if(substring.includes(element)) {
|
||||||
|
where[element] = { [Op.substring]: searchOptions[element] };
|
||||||
|
} else if (key.includes(element)) {
|
||||||
|
where[element] = searchOptions[element] == "1" ? uidLastCode === 'B' ? 1 : 2 : 0;
|
||||||
|
} else if (between.includes(element)) {
|
||||||
|
where[element] = { [Op.between]: [searchOptions[element][0], searchOptions[element][1]] };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sortOptions[element] == true) {
|
||||||
|
order.push([element, 'ASC']);
|
||||||
|
} else if (sortOptions[element] == false) {
|
||||||
|
order.push([element, 'DESC']);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dbOptions = { attributes, offset, limit, where, order };
|
||||||
|
const model = {
|
||||||
|
"B": ctx.model.BindBrecord,
|
||||||
|
"C": ctx.model2.BindCrecord,
|
||||||
|
};
|
||||||
|
const result = await model[uidLastCode].findAndCountAll(dbOptions);
|
||||||
|
return result.rows.length == 0 ? false : result;
|
||||||
|
} catch (error) {
|
||||||
|
const blockName = fileName + "--" + "getRecord";
|
||||||
|
ctx.app.middleware.utils.log('../../../serviceLog', blockName + ">>>>" + error);
|
||||||
|
return 'error';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 存储消息记录
|
||||||
|
async shortMsg(form) {
|
||||||
|
const { ctx } = this;
|
||||||
|
try {
|
||||||
|
const where = { card_id: form.card_id };
|
||||||
|
const card = await ctx.model3.BDCard.findOne({ where });
|
||||||
|
if (!card) {
|
||||||
|
ctx.app.middleware.utils.log('../../../unknownCardLog', form);
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
const model = {
|
||||||
|
1: ctx.model.BuserBind,
|
||||||
|
2: ctx.model2.CuserBind,
|
||||||
|
3: ctx.model4.TuserBind,
|
||||||
|
};
|
||||||
|
const bind = await model[card.dataValues.status].findOne({ where });
|
||||||
|
if (!bind) return false;
|
||||||
|
form.user_uid = bind.dataValues.user_uid;
|
||||||
|
const uidLastCode = shunt(form.user_uid);
|
||||||
|
const modelName = {
|
||||||
|
"B": ctx.model.BShortMsg,
|
||||||
|
"C": ctx.model2.CShortMsg,
|
||||||
|
"T": ctx.model4.TShortMsg,
|
||||||
|
};
|
||||||
|
const result = await modelName[uidLastCode].create(form);
|
||||||
|
return result || false;
|
||||||
|
} catch (error) {
|
||||||
|
const blockName = fileName + "--" + "shortMsg";
|
||||||
|
ctx.app.middleware.utils.log('../../../serviceLog', blockName + ">>>>" + error);
|
||||||
|
return 'error';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取历史消息
|
||||||
|
async getHistoryMsg(uid, body) {
|
||||||
|
const { ctx } = this;
|
||||||
|
try {
|
||||||
|
let { offset, limit, searchOptions, sortOptions } = body;
|
||||||
|
offset = (offset - 1) * limit;
|
||||||
|
let attributes = ['card_id', 'encode_type', 'msg_data', 'created_at'],
|
||||||
|
where = { user_uid: uid }, order = [], dbOptions, joinSubstring = [],
|
||||||
|
substring = ['card_id', 'msg_data'], key = ['encode_type'], between = ['created_at'];
|
||||||
|
attributes.forEach(element => {
|
||||||
|
if (searchOptions[element]) {
|
||||||
|
if(searchOptions[element] == '*空') {
|
||||||
|
if(joinSubstring.includes(element)) {
|
||||||
|
where[element] = null;
|
||||||
|
} else {
|
||||||
|
where[element] = [null, ''];
|
||||||
|
}
|
||||||
|
} else if (substring.includes(element)) {
|
||||||
|
where[element] = { [Op.substring]: searchOptions[element] };
|
||||||
|
} else if (key.includes(element)) {
|
||||||
|
where[element] = searchOptions[element] == "1" ? true : false;
|
||||||
|
} else if (between.includes(element)) {
|
||||||
|
where[element] = { [Op.between]: [searchOptions[element][0], searchOptions[element][1]] };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sortOptions[element] == true) {
|
||||||
|
order.push([element, 'ASC']);
|
||||||
|
} else if (sortOptions[element] == false) {
|
||||||
|
order.push([element, 'DESC']);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dbOptions = { attributes, offset, limit, where, order };
|
||||||
|
const uidLastCode = shunt(uid);
|
||||||
|
const model = {
|
||||||
|
"B": ctx.model.BShortMsg,
|
||||||
|
"C": ctx.model2.CShortMsg,
|
||||||
|
"T": ctx.model4.TShortMsg,
|
||||||
|
};
|
||||||
|
const result = await model[uidLastCode].findAndCountAll(dbOptions);
|
||||||
|
return result.rows.length == 0 ? false : result;
|
||||||
|
} catch (error) {
|
||||||
|
const blockName = fileName + "--" + "getHistoryMsg";
|
||||||
|
ctx.app.middleware.utils.log('../../../serviceLog', blockName + ">>>>" + error);
|
||||||
|
return 'error';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除历史消息
|
||||||
|
async delHistoryMsg(uid, modelType, password, requestMsg) {
|
||||||
|
const { ctx } = this;
|
||||||
|
try {
|
||||||
|
const uidLastCode = shunt(uid);
|
||||||
|
const model = {
|
||||||
|
"B": ctx.model.BSide,
|
||||||
|
"C": ctx.model2.CSide,
|
||||||
|
"T": ctx.model4.Account,
|
||||||
|
};
|
||||||
|
const result = await model[uidLastCode].findOne({ where: { uid } });
|
||||||
|
if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt))) return false;
|
||||||
|
let where = {};
|
||||||
|
if (modelType == "single") {
|
||||||
|
const { card_id, encode_type, msg_data, origin_time } = requestMsg;
|
||||||
|
where = { user_uid: uid, card_id, encode_type, msg_data, created_at: origin_time };
|
||||||
|
} else if (modelType == "multiple") {
|
||||||
|
let card_id = [], encode_type = [], msg_data = [], created_at = [];
|
||||||
|
for (const key in requestMsg) {
|
||||||
|
requestMsg[key].forEach(element => {
|
||||||
|
card_id.push(element.card_id),
|
||||||
|
encode_type.push(element.encode_type),
|
||||||
|
msg_data.push(element.msg_data),
|
||||||
|
created_at.push(element.origin_time)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
where = { user_uid: uid, card_id, encode_type, msg_data, created_at };
|
||||||
|
} else if (modelType == "all") {
|
||||||
|
where = { user_uid: uid };
|
||||||
|
}
|
||||||
|
const modelName = {
|
||||||
|
"B": ctx.model.BShortMsg,
|
||||||
|
"C": ctx.model2.CShortMsg,
|
||||||
|
"T": ctx.model4.TShortMsg,
|
||||||
|
};
|
||||||
|
const resetList = await modelName[uidLastCode].destroy({ where });
|
||||||
|
return resetList.length == 0 ? false : resetList;
|
||||||
|
} catch (error) {
|
||||||
|
const blockName = fileName + "--" + "delHistoryMsg";
|
||||||
|
ctx.app.middleware.utils.log('../../../serviceLog', blockName + ">>>>" + error);
|
||||||
|
return 'error';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取单位用户
|
||||||
|
async bsideManager(uid, body) {
|
||||||
|
const { ctx } = this;
|
||||||
|
try {
|
||||||
|
const result = await ctx.model.BSide.findOne({ where: { uid, status: { [Op.not]: 2 }, role: 1 } });
|
||||||
|
if (!result || result.organization == null) return false;
|
||||||
|
let { offset, limit, searchOptions } = body;
|
||||||
|
offset = (offset - 1) * limit;
|
||||||
|
let attributes = ['account_name', 'user_name', 'phone'],
|
||||||
|
where = { organization: result.organization, role: { [Op.not]: 1 } }, dbOptions, joinSubstring = [];
|
||||||
|
attributes.forEach(element => {
|
||||||
|
if (searchOptions[element]) {
|
||||||
|
if(searchOptions[element] == '*空') {
|
||||||
|
if(joinSubstring.includes(element)) {
|
||||||
|
where[element] = null;
|
||||||
|
} else {
|
||||||
|
where[element] = [null, ''];
|
||||||
|
}
|
||||||
|
} else{
|
||||||
|
where[element] = { [Op.substring]: searchOptions[element] };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dbOptions = { attributes, offset, limit, where };
|
||||||
|
const userList = await ctx.model.BSide.findAndCountAll(dbOptions);
|
||||||
|
return userList.rows.length == 0 ? false : userList;
|
||||||
|
} catch (error) {
|
||||||
|
const blockName = fileName + "--" + "bsideManager";
|
||||||
|
ctx.app.middleware.utils.log('../../../serviceLog', blockName + ">>>>" + error);
|
||||||
|
return 'error';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = HomeService;
|
||||||
243
config/config.default.js
Normal file
243
config/config.default.js
Normal file
@@ -0,0 +1,243 @@
|
|||||||
|
/* eslint valid-jsdoc: "off" */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Egg.EggAppInfo} appInfo app info
|
||||||
|
*/
|
||||||
|
|
||||||
|
const process = require('process'),
|
||||||
|
path = require('path');
|
||||||
|
|
||||||
|
module.exports = appInfo => {
|
||||||
|
/**
|
||||||
|
* built-in config
|
||||||
|
* @type {Egg.EggAppConfig}
|
||||||
|
**/
|
||||||
|
const config = exports = {};
|
||||||
|
|
||||||
|
// use for cookie sign key, should change to your own and keep security
|
||||||
|
config.keys = appInfo.name + '_1715070366856_4575';
|
||||||
|
|
||||||
|
// add your middleware config here
|
||||||
|
// config.middleware = []
|
||||||
|
|
||||||
|
// 修改Egg.js的public路径配置到运行路径下
|
||||||
|
config.static = {
|
||||||
|
prefix: '/',
|
||||||
|
dir: process.cwd() + '/public',
|
||||||
|
};
|
||||||
|
|
||||||
|
// 配置执行时临时文件的路径到运行路径
|
||||||
|
config.rundir = process.cwd() + '/run';
|
||||||
|
|
||||||
|
// 配置普通日志文件地址
|
||||||
|
config.logger = {
|
||||||
|
dir: path.join(process.cwd(), 'logs'),
|
||||||
|
};
|
||||||
|
|
||||||
|
// 配置定时任务日志文件地址
|
||||||
|
config.customLogger = {
|
||||||
|
scheduleLogger: {
|
||||||
|
file: path.join(process.cwd(), 'logs', 'egg-schedule.log'),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
config.security = {
|
||||||
|
csrf: {
|
||||||
|
enable: false
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// socket客户端配置
|
||||||
|
// 开发/测试环境
|
||||||
|
config.socketClient = {
|
||||||
|
ip: '127.0.0.1',
|
||||||
|
port: 9004,
|
||||||
|
// id即信源
|
||||||
|
id: 989,
|
||||||
|
destination: 20,
|
||||||
|
token: '8613987248fdba01f8fb0e7aa0423ca5'
|
||||||
|
};
|
||||||
|
// 生产环境
|
||||||
|
// config.socketClient = {
|
||||||
|
// ip: '36.110.64.122',
|
||||||
|
// port: 9004,
|
||||||
|
// // id即信源
|
||||||
|
// id: 989,
|
||||||
|
// destination: 20,
|
||||||
|
// token: '8613987248fdba01f8fb0e7aa0423ca5'
|
||||||
|
// };
|
||||||
|
|
||||||
|
// webSocket服务端配置
|
||||||
|
config.webSocketServer = {
|
||||||
|
ip: '127.0.0.1',
|
||||||
|
port: 8010,
|
||||||
|
// path: '/bdShortMessage/'
|
||||||
|
// path: '/bdrdWebSocket/'
|
||||||
|
path: '/socket.io/'
|
||||||
|
};
|
||||||
|
|
||||||
|
config.redis = {
|
||||||
|
// 开发/测试环境
|
||||||
|
clients: {
|
||||||
|
db0: {
|
||||||
|
port: 6379,
|
||||||
|
host: '127.0.0.1',
|
||||||
|
password: '74191221',
|
||||||
|
db: 0,
|
||||||
|
},
|
||||||
|
db1: {
|
||||||
|
port: 6379,
|
||||||
|
host: '127.0.0.1',
|
||||||
|
password: '74191221',
|
||||||
|
db: 1,
|
||||||
|
},
|
||||||
|
db2: {
|
||||||
|
port: 6379,
|
||||||
|
host: '127.0.0.1',
|
||||||
|
password: '74191221',
|
||||||
|
db: 2,
|
||||||
|
},
|
||||||
|
db3: {
|
||||||
|
port: 6379,
|
||||||
|
host: '127.0.0.1',
|
||||||
|
password: '74191221',
|
||||||
|
db: 3,
|
||||||
|
},
|
||||||
|
db5: {
|
||||||
|
port: 6379,
|
||||||
|
host: '127.0.0.1',
|
||||||
|
password: '74191221',
|
||||||
|
db: 5,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
// 生产环境
|
||||||
|
// clients: {
|
||||||
|
// db0: {
|
||||||
|
// port: 6379,
|
||||||
|
// host: '127.0.0.1',
|
||||||
|
// password: 'bd3@htcc2023',
|
||||||
|
// db: 2,
|
||||||
|
// },
|
||||||
|
// db1: {
|
||||||
|
// port: 6379,
|
||||||
|
// host: '127.0.0.1',
|
||||||
|
// password: 'bd3@htcc2023',
|
||||||
|
// db: 3,
|
||||||
|
// },
|
||||||
|
// db2: {
|
||||||
|
// port: 6379,
|
||||||
|
// host: '127.0.0.1',
|
||||||
|
// password: 'bd3@htcc2023',
|
||||||
|
// db: 4,
|
||||||
|
// },
|
||||||
|
// db3: {
|
||||||
|
// port: 6379,
|
||||||
|
// host: '127.0.0.1',
|
||||||
|
// password: 'bd3@htcc2023',
|
||||||
|
// db: 5,
|
||||||
|
// }
|
||||||
|
// db5: {
|
||||||
|
// port: 6379,
|
||||||
|
// host: '127.0.0.1',
|
||||||
|
// password: 'bd3@htcc2023',
|
||||||
|
// db: 7,
|
||||||
|
// },
|
||||||
|
// }
|
||||||
|
};
|
||||||
|
|
||||||
|
config.sequelize = {
|
||||||
|
// 开发/测试环境
|
||||||
|
datasources: [
|
||||||
|
{
|
||||||
|
dialect: 'mariadb',
|
||||||
|
host: 'localhost',
|
||||||
|
port: 3306,
|
||||||
|
username: 'root',
|
||||||
|
password: '74191221',
|
||||||
|
database: 'bside',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dialect: 'mariadb',
|
||||||
|
host: 'localhost',
|
||||||
|
port: 3306,
|
||||||
|
username: 'root',
|
||||||
|
password: '74191221',
|
||||||
|
database: 'cside',
|
||||||
|
delegate: 'model2',
|
||||||
|
baseDir: 'model2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dialect: 'mariadb',
|
||||||
|
host: 'localhost',
|
||||||
|
port: 3306,
|
||||||
|
username: 'root',
|
||||||
|
password: '74191221',
|
||||||
|
database: 'insiders',
|
||||||
|
delegate: 'model3',
|
||||||
|
baseDir: 'model3',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dialect: 'mariadb',
|
||||||
|
host: 'localhost',
|
||||||
|
port: 3306,
|
||||||
|
username: 'root',
|
||||||
|
password: '74191221',
|
||||||
|
database: 'bdContest',
|
||||||
|
delegate: 'model4',
|
||||||
|
baseDir: 'model4',
|
||||||
|
}
|
||||||
|
]
|
||||||
|
// 生产环境
|
||||||
|
// datasources: [
|
||||||
|
// {
|
||||||
|
// dialect: 'mariadb',
|
||||||
|
// host: 'localhost',
|
||||||
|
// port: 3306,
|
||||||
|
// username: 'bdqh_platform',
|
||||||
|
// password: '124689@XXxx',
|
||||||
|
// database: 'bside',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// dialect: 'mariadb',
|
||||||
|
// host: 'localhost',
|
||||||
|
// port: 3306,
|
||||||
|
// username: 'bdqh_platform',
|
||||||
|
// password: '124689@XXxx',
|
||||||
|
// database: 'cside',
|
||||||
|
// delegate: 'model2',
|
||||||
|
// baseDir: 'model2',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// dialect: 'mariadb',
|
||||||
|
// host: 'localhost',
|
||||||
|
// port: 3306,
|
||||||
|
// username: 'bdqh_platform',
|
||||||
|
// password: '124689@XXxx',
|
||||||
|
// database: 'insiders',
|
||||||
|
// delegate: 'model3',
|
||||||
|
// baseDir: 'model3',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// dialect: 'mariadb',
|
||||||
|
// host: 'localhost',
|
||||||
|
// port: 3306,
|
||||||
|
// username: 'bdqh_platform',
|
||||||
|
// password: '124689@XXxx',
|
||||||
|
// database: 'bdContest',
|
||||||
|
// delegate: 'model4',
|
||||||
|
// baseDir: 'model4',
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
};
|
||||||
|
|
||||||
|
// add your user config here
|
||||||
|
const userConfig = {
|
||||||
|
// myAppName: 'egg',
|
||||||
|
salt: 'shortMessage'
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
...config,
|
||||||
|
...userConfig,
|
||||||
|
};
|
||||||
|
};
|
||||||
140
config/config.test.js
Normal file
140
config/config.test.js
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
/* eslint valid-jsdoc: "off" */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Egg.EggAppInfo} appInfo app info
|
||||||
|
*/
|
||||||
|
|
||||||
|
const process = require('process'),
|
||||||
|
path = require('path');
|
||||||
|
|
||||||
|
module.exports = appInfo => {
|
||||||
|
/**
|
||||||
|
* built-in config
|
||||||
|
* @type {Egg.EggAppConfig}
|
||||||
|
**/
|
||||||
|
const config = exports = {};
|
||||||
|
|
||||||
|
// use for cookie sign key, should change to your own and keep security
|
||||||
|
config.keys = appInfo.name + '_1715070366856_4575';
|
||||||
|
|
||||||
|
// add your middleware config here
|
||||||
|
// config.middleware = []
|
||||||
|
|
||||||
|
// 修改Egg.js的public路径配置到运行路径下
|
||||||
|
config.static = {
|
||||||
|
prefix: '/',
|
||||||
|
dir: process.cwd() + '/public',
|
||||||
|
};
|
||||||
|
|
||||||
|
// 配置执行时临时文件的路径到运行路径
|
||||||
|
config.rundir = process.cwd() + '/run';
|
||||||
|
|
||||||
|
// 配置普通日志文件地址
|
||||||
|
config.logger = {
|
||||||
|
dir: path.join(process.cwd(), 'logs'),
|
||||||
|
};
|
||||||
|
|
||||||
|
// 配置定时任务日志文件地址
|
||||||
|
config.customLogger = {
|
||||||
|
scheduleLogger: {
|
||||||
|
file: path.join(process.cwd(), 'logs', 'egg-schedule.log'),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
config.security = {
|
||||||
|
csrf: {
|
||||||
|
enable: false
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// socket客户端配置
|
||||||
|
config.socketClient = {
|
||||||
|
port: 9004,
|
||||||
|
ip: '127.0.0.1',
|
||||||
|
// id即信源
|
||||||
|
id: 989,
|
||||||
|
destination: 20,
|
||||||
|
token: '8613987248fdba01f8fb0e7aa0423ca5'
|
||||||
|
};
|
||||||
|
|
||||||
|
// webSocket服务端配置
|
||||||
|
config.webSocketServer = {
|
||||||
|
port: 8010,
|
||||||
|
ip: '127.0.0.1'
|
||||||
|
};
|
||||||
|
|
||||||
|
config.redis = {
|
||||||
|
// 开发/测试环境
|
||||||
|
clients: {
|
||||||
|
db0: {
|
||||||
|
port: 6379,
|
||||||
|
host: '127.0.0.1',
|
||||||
|
password: '74191221',
|
||||||
|
db: 0,
|
||||||
|
},
|
||||||
|
db1: {
|
||||||
|
port: 6379,
|
||||||
|
host: '127.0.0.1',
|
||||||
|
password: '74191221',
|
||||||
|
db: 1,
|
||||||
|
},
|
||||||
|
db2: {
|
||||||
|
port: 6379,
|
||||||
|
host: '127.0.0.1',
|
||||||
|
password: '74191221',
|
||||||
|
db: 2,
|
||||||
|
},
|
||||||
|
db3: {
|
||||||
|
port: 6379,
|
||||||
|
host: '127.0.0.1',
|
||||||
|
password: '74191221',
|
||||||
|
db: 3,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
config.sequelize = {
|
||||||
|
// 开发/测试环境
|
||||||
|
datasources: [
|
||||||
|
{
|
||||||
|
dialect: 'mariadb',
|
||||||
|
host: 'localhost',
|
||||||
|
port: 3306,
|
||||||
|
username: 'root',
|
||||||
|
password: '74191221',
|
||||||
|
database: 'bside',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dialect: 'mariadb',
|
||||||
|
host: 'localhost',
|
||||||
|
port: 3306,
|
||||||
|
username: 'root',
|
||||||
|
password: '74191221',
|
||||||
|
database: 'cside',
|
||||||
|
delegate: 'model2',
|
||||||
|
baseDir: 'model2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dialect: 'mariadb',
|
||||||
|
host: 'localhost',
|
||||||
|
port: 3306,
|
||||||
|
username: 'root',
|
||||||
|
password: '74191221',
|
||||||
|
database: 'insiders',
|
||||||
|
delegate: 'model3',
|
||||||
|
baseDir: 'model3',
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
// add your user config here
|
||||||
|
const userConfig = {
|
||||||
|
// myAppName: 'egg',
|
||||||
|
salt: 'shortMessage'
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
...config,
|
||||||
|
...userConfig,
|
||||||
|
};
|
||||||
|
};
|
||||||
1
config/env
Normal file
1
config/env
Normal file
@@ -0,0 +1 @@
|
|||||||
|
prod
|
||||||
27
config/plugin.js
Normal file
27
config/plugin.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/** @type Egg.EggPlugin */
|
||||||
|
module.exports = {
|
||||||
|
// had enabled by egg
|
||||||
|
// static: {
|
||||||
|
// enable: true,
|
||||||
|
// }
|
||||||
|
|
||||||
|
CryptoJS : {
|
||||||
|
enable: true,
|
||||||
|
package: 'crypto-js',
|
||||||
|
},
|
||||||
|
|
||||||
|
redis : {
|
||||||
|
enable: true,
|
||||||
|
package: 'egg-redis',
|
||||||
|
},
|
||||||
|
|
||||||
|
sequelize : {
|
||||||
|
enable: true,
|
||||||
|
package: 'egg-sequelize',
|
||||||
|
},
|
||||||
|
|
||||||
|
validate : {
|
||||||
|
enable: true,
|
||||||
|
package: 'egg-validate',
|
||||||
|
},
|
||||||
|
};
|
||||||
5
controllerLog/2024/10/17.txt
Normal file
5
controllerLog/2024/10/17.txt
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[2024-10-17>>>11:45:17]>>>home--bsideManager>>>>TypeError: result.forEach is not a function
|
||||||
|
[2024-10-17>>>11:46:24]>>>home--bsideManager>>>>TypeError: result.forEach is not a function
|
||||||
|
[2024-10-17>>>11:46:24]>>>home--bsideManager>>>>TypeError: result.forEach is not a function
|
||||||
|
[2024-10-17>>>11:48:10]>>>home--bsideManager>>>>TypeError: result.forEach is not a function
|
||||||
|
[2024-10-17>>>11:48:10]>>>home--bsideManager>>>>TypeError: result.forEach is not a function
|
||||||
6
controllerLog/2024/8/16.txt
Normal file
6
controllerLog/2024/8/16.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[2024-8-16>>>16:8:56]>>>SequelizeUniqueConstraintError: Validation error
|
||||||
|
[2024-8-16>>>16:9:47]>>>SequelizeUniqueConstraintError: Validation error
|
||||||
|
[2024-8-16>>>16:12:27]>>>SequelizeUniqueConstraintError: Validation error
|
||||||
|
[2024-8-16>>>16:12:49]>>>SequelizeUniqueConstraintError: Validation error
|
||||||
|
[2024-8-16>>>16:13:49]>>>SequelizeUniqueConstraintError: Validation error
|
||||||
|
[2024-8-16>>>16:14:27]>>>SequelizeUniqueConstraintError: Validation error
|
||||||
89
controllerLog/2025/6/27.txt
Normal file
89
controllerLog/2025/6/27.txt
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
[2025-6-27>>>11:48:36]>>>home--getCard>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
et')
|
||||||
|
|
||||||
|
[2025-6-27>>>11:48:36]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:48:36]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:48:43]>>>home--getRecord>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:50:51]>>>home--getCard>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:50:51]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:50:51]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:50:51]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:50:51]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:51:18]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:51:18]>>>home--getCard>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:51:18]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:51:19]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:51:19]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:52:59]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:52:59]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:52:59]>>>home--getCard>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:52:59]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:52:59]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:56:52]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:56:52]>>>home--getCard>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:56:52]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:56:52]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>11:56:52]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:2:33]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:2:33]>>>home--getCard>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:2:33]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:2:34]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:2:34]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:3:17]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:3:17]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:3:19]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:3:19]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:3:19]>>>home--getCard>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:3:20]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:3:20]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:20:20]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:20:20]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:20:24]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:20:24]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:20:24]>>>home--getCard>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:20:25]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:20:25]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:35:14]>>>home--getCard>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:35:14]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:35:14]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:35:14]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:35:14]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:41:20]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:41:20]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:41:20]>>>home--getCard>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:41:20]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:41:20]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:45:56]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:45:56]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:45:56]>>>home--getCard>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:45:56]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:45:56]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:48:20]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:48:20]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:48:23]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:48:23]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:48:23]>>>home--getCard>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:48:23]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>15:48:23]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:7:4]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:7:4]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:7:6]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:7:6]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:7:6]>>>home--getCard>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:7:6]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:7:6]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:9:4]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:9:4]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:9:4]>>>home--getCard>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:9:4]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:9:4]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:22:16]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:22:16]>>>home--getCard>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:22:16]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:22:16]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:22:16]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:42:11]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:42:11]>>>home--getCard>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:42:11]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:42:11]>>>home--bsideManager>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
|
[2025-6-27>>>16:42:11]>>>home--getHistoryMsg>>>>TypeError: Cannot read properties of undefined (reading 'get')
|
||||||
23
database/config.json
Normal file
23
database/config.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"development": {
|
||||||
|
"username": "root",
|
||||||
|
"password": 74191221,
|
||||||
|
"database": "vm_centos",
|
||||||
|
"host": "127.0.0.1",
|
||||||
|
"dialect": "mariadb"
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"username": "root",
|
||||||
|
"password": 74191221,
|
||||||
|
"database": "vm_centos",
|
||||||
|
"host": "127.0.0.1",
|
||||||
|
"dialect": "mariadb"
|
||||||
|
},
|
||||||
|
"production": {
|
||||||
|
"username": "root",
|
||||||
|
"password": 74191221,
|
||||||
|
"database": "vm_centos",
|
||||||
|
"host": "127.0.0.1",
|
||||||
|
"dialect": "mariadb"
|
||||||
|
}
|
||||||
|
}
|
||||||
5
jsconfig.json
Normal file
5
jsconfig.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"include": [
|
||||||
|
"**/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
70
package.json
Normal file
70
package.json
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
{
|
||||||
|
"name": "bd-short-message-platform",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"private": true,
|
||||||
|
"egg": {
|
||||||
|
"declarations": true
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"bd-short-message-platform": "file:",
|
||||||
|
"crypto-js": "^4.2.0",
|
||||||
|
"egg": "^3.17.5",
|
||||||
|
"egg-redis": "^2.6.0",
|
||||||
|
"egg-scripts": "^3.0.1",
|
||||||
|
"egg-sequelize": "^6.0.0",
|
||||||
|
"egg-validate": "^2.0.2",
|
||||||
|
"gbk.js": "^0.3.0",
|
||||||
|
"ioredis": "^5.4.1",
|
||||||
|
"mariadb": "^3.3.0",
|
||||||
|
"mysql2": "^3.9.7",
|
||||||
|
"sequelize": "^6.37.3",
|
||||||
|
"socket.io": "^4.7.5"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"egg-bin": "6",
|
||||||
|
"egg-mock": "5",
|
||||||
|
"eslint": "8",
|
||||||
|
"eslint-config-egg": "13",
|
||||||
|
"sequelize-cli": "^6.6.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16.0.0"
|
||||||
|
},
|
||||||
|
"pkg": {
|
||||||
|
"scripts": [
|
||||||
|
"./app/**/*.js",
|
||||||
|
"./app.js",
|
||||||
|
"./agent.js",
|
||||||
|
"./config/**/*.js",
|
||||||
|
"./config/*.js",
|
||||||
|
"./config/*"
|
||||||
|
],
|
||||||
|
"assets": [
|
||||||
|
"./app/view/**/*",
|
||||||
|
"./app/public/**/*",
|
||||||
|
"./static/**/*",
|
||||||
|
"./node_modules/**/*"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"bin": "./build.js",
|
||||||
|
"scripts": {
|
||||||
|
"reload": "egg-scripts stop --title=egg-server-bd-short-message-platform && egg-scripts start --port=8090 --workers=1 --daemon --title=egg-server-bd-short-message-platform --ignore-stderr",
|
||||||
|
"start": "egg-scripts start --port=8090 --workers=1 --daemon --title=egg-server-bd-short-message-platform --ignore-stderr",
|
||||||
|
"stop": "egg-scripts stop --title=egg-server-bd-short-message-platform",
|
||||||
|
"dev": "egg-bin dev --port=8090",
|
||||||
|
"test": "egg-scripts start --env=test --daemon --port=8090",
|
||||||
|
"test:local": "egg-bin test",
|
||||||
|
"cov": "egg-bin cov",
|
||||||
|
"lint": "eslint .",
|
||||||
|
"ci": "npm run lint && npm run cov",
|
||||||
|
"build:win": "pkg . --targets win --out-path ./dist",
|
||||||
|
"build:linux": "pkg . --targets linux --out-path /usr/dist"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": ""
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
1
serviceLog/2024/10/17.txt
Normal file
1
serviceLog/2024/10/17.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[2024-10-17>>>11:44:4]>>>home--bsideManager>>>>TypeError: ctx.model.BSide.findAndCount is not a function
|
||||||
9
serviceLog/2024/8/16.txt
Normal file
9
serviceLog/2024/8/16.txt
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
[2024-8-16>>>15:48:55]>>>SequelizeUniqueConstraintError: Validation error
|
||||||
|
[2024-8-16>>>15:49:26]>>>SequelizeUniqueConstraintError: Validation error
|
||||||
|
[2024-8-16>>>15:50:55]>>>SequelizeUniqueConstraintError: Validation error
|
||||||
|
[2024-8-16>>>15:54:34]>>>SequelizeUniqueConstraintError: Validation error
|
||||||
|
[2024-8-16>>>15:55:13]>>>SequelizeUniqueConstraintError: Validation error
|
||||||
|
[2024-8-16>>>16:0:58]>>>SequelizeUniqueConstraintError: Validation error
|
||||||
|
[2024-8-16>>>16:6:40]>>>SequelizeUniqueConstraintError: Validation error
|
||||||
|
[2024-8-16>>>16:7:26]>>>SequelizeUniqueConstraintError: Validation error
|
||||||
|
[2024-8-16>>>16:8:16]>>>SequelizeUniqueConstraintError: Validation error
|
||||||
8
serviceLog/2024/9/23.txt
Normal file
8
serviceLog/2024/9/23.txt
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[2024-9-23>>>16:28:21]>>>SequelizeDatabaseError: (conn:88, no: 1054, SQLState: 42S22) Unknown column 'buser-bind.uid' in 'where clause'
|
||||||
|
sql: SELECT `id`, `card_id`, `user_uid` FROM `buser-bind` AS `buser-bind` WHERE `buser-bind`.`uid` IN ('20240613698222B', '20240613698200B', '20240613698202B', '20240613698220B', '20240613698210B', '20240613698240B'); - parameters:[]
|
||||||
|
[2024-9-23>>>16:36:34]>>>SequelizeDatabaseError: (conn:89, no: 1054, SQLState: 42S22) Unknown column 'buser-bind.uid' in 'where clause'
|
||||||
|
sql: SELECT `id`, `card_id`, `user_uid` FROM `buser-bind` AS `buser-bind` WHERE `buser-bind`.`uid` IN ('20240613698222B'); - parameters:[]
|
||||||
|
[2024-9-23>>>16:39:13]>>>SequelizeDatabaseError: (conn:90, no: 1054, SQLState: 42S22) Unknown column 'buser-bind.uid' in 'where clause'
|
||||||
|
sql: SELECT `id`, `card_id`, `user_uid` FROM `buser-bind` AS `buser-bind` WHERE `buser-bind`.`uid` IN ('20240613698222B'); - parameters:[]
|
||||||
|
[2024-9-23>>>17:7:52]>>>SequelizeDatabaseError: (conn:176, no: 1364, SQLState: HY000) Field 'type' doesn't have a default value
|
||||||
|
sql: INSERT INTO `bind-brecord` (`id`,`user_uid`,`card_id`,`created_at`) VALUES (NULL,'20240613698222B','15590602','2024-09-23 09:07:52.892'); - parameters:[]
|
||||||
10
serviceLog/2024/9/29.txt
Normal file
10
serviceLog/2024/9/29.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[2024-9-29>>>16:9:35]>>>Error: WHERE parameter "card_id" has invalid "undefined" value
|
||||||
|
[2024-9-29>>>16:12:57]>>>Error: WHERE parameter "card_id" has invalid "undefined" value
|
||||||
|
[2024-9-29>>>16:16:47]>>>Error: WHERE parameter "card_id" has invalid "undefined" value
|
||||||
|
[2024-9-29>>>16:20:51]>>>Error: WHERE parameter "card_id" has invalid "undefined" value
|
||||||
|
[2024-9-29>>>16:21:29]>>>Error: WHERE parameter "card_id" has invalid "undefined" value
|
||||||
|
[2024-9-29>>>16:23:58]>>>Error: WHERE parameter "card_id" has invalid "undefined" value
|
||||||
|
[2024-9-29>>>16:24:15]>>>Error: WHERE parameter "card_id" has invalid "undefined" value
|
||||||
|
[2024-9-29>>>16:25:1]>>>Error: WHERE parameter "card_id" has invalid "undefined" value
|
||||||
|
[2024-9-29>>>16:34:39]>>>Error: WHERE parameter "card_id" has invalid "undefined" value
|
||||||
|
[2024-9-29>>>16:35:4]>>>Error: WHERE parameter "card_id" has invalid "undefined" value
|
||||||
5
socketLog/2024/10/12.txt
Normal file
5
socketLog/2024/10/12.txt
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[2024-10-12>>>13:51:25]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-10-12>>>13:51:35]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-10-12>>>17:34:34]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-10-12>>>17:34:44]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-10-12>>>17:55:2]>>>Error: read ECONNRESET
|
||||||
2
socketLog/2024/10/14.txt
Normal file
2
socketLog/2024/10/14.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-10-14>>>11:37:5]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-10-14>>>11:37:15]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2024/10/17.txt
Normal file
2
socketLog/2024/10/17.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-10-17>>>11:6:16]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-10-17>>>11:6:26]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2024/10/18.txt
Normal file
2
socketLog/2024/10/18.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-10-18>>>9:17:53]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-10-18>>>9:18:3]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2024/10/21.txt
Normal file
2
socketLog/2024/10/21.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-10-21>>>10:19:58]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-10-21>>>10:20:8]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2024/10/24.txt
Normal file
2
socketLog/2024/10/24.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-10-24>>>14:11:56]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-10-24>>>14:12:6]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
12
socketLog/2024/10/29.txt
Normal file
12
socketLog/2024/10/29.txt
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[2024-10-29>>>17:26:43]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-10-29>>>17:26:53]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-10-29>>>17:32:49]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-10-29>>>17:32:59]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-10-29>>>17:34:35]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-10-29>>>17:34:45]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-10-29>>>17:35:26]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-10-29>>>17:35:36]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-10-29>>>17:36:28]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-10-29>>>17:36:38]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-10-29>>>17:39:1]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-10-29>>>17:39:11]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2024/10/31.txt
Normal file
2
socketLog/2024/10/31.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-10-31>>>15:15:20]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-10-31>>>15:15:30]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2024/11/13.txt
Normal file
2
socketLog/2024/11/13.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-11-13>>>14:9:14]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-11-13>>>14:9:24]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2024/11/14.txt
Normal file
2
socketLog/2024/11/14.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-11-14>>>9:18:30]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-11-14>>>9:18:40]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
14
socketLog/2024/11/15.txt
Normal file
14
socketLog/2024/11/15.txt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
[2024-11-15>>>9:55:48]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-11-15>>>9:55:58]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-11-15>>>9:59:16]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-11-15>>>9:59:26]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-11-15>>>11:11:49]>>>Error: read ECONNRESET
|
||||||
|
[2024-11-15>>>11:12:47]>>>Error: read ECONNRESET
|
||||||
|
[2024-11-15>>>11:14:7]>>>Error: read ECONNRESET
|
||||||
|
[2024-11-15>>>11:14:25]>>>Error: read ECONNRESET
|
||||||
|
[2024-11-15>>>11:18:5]>>>Error: read ECONNRESET
|
||||||
|
[2024-11-15>>>11:18:16]>>>Error: read ECONNRESET
|
||||||
|
[2024-11-15>>>14:39:38]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-11-15>>>14:40:14]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-11-15>>>16:52:34]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-11-15>>>17:11:10]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
1
socketLog/2024/11/25.txt
Normal file
1
socketLog/2024/11/25.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[2024-11-25>>>9:37:31]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
1
socketLog/2024/11/26.txt
Normal file
1
socketLog/2024/11/26.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[2024-11-26>>>15:38:58]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
3
socketLog/2024/11/29.txt
Normal file
3
socketLog/2024/11/29.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[2024-11-29>>>16:58:24]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-11-29>>>17:2:41]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-11-29>>>17:3:27]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2024/11/5.txt
Normal file
2
socketLog/2024/11/5.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-11-5>>>10:55:57]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-11-5>>>10:56:7]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
1
socketLog/2024/12/18.txt
Normal file
1
socketLog/2024/12/18.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[2024-12-18>>>11:41:15]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
1
socketLog/2024/12/3.txt
Normal file
1
socketLog/2024/12/3.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[2024-12-3>>>15:46:12]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
1
socketLog/2024/12/5.txt
Normal file
1
socketLog/2024/12/5.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[2024-12-5>>>9:37:36]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
1
socketLog/2024/12/6.txt
Normal file
1
socketLog/2024/12/6.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[2024-12-6>>>9:25:30]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
1
socketLog/2024/12/9.txt
Normal file
1
socketLog/2024/12/9.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[2024-12-9>>>9:36:57]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2024/8/20.txt
Normal file
2
socketLog/2024/8/20.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-8-20>>>9:10:21]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-20>>>9:10:31]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
21
socketLog/2024/8/21.txt
Normal file
21
socketLog/2024/8/21.txt
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
[2024-8-21>>>9:27:43]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-21>>>9:27:53]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-21>>>11:0:32]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-21>>>11:0:42]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-21>>>11:1:49]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-21>>>11:1:59]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-21>>>11:2:11]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-21>>>11:2:21]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-21>>>11:3:32]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-21>>>11:3:42]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-21>>>11:4:28]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-21>>>11:4:41]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-21>>>11:4:51]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-21>>>11:11:29]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-21>>>11:11:39]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-21>>>11:11:47]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-21>>>11:11:57]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-21>>>11:14:0]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-21>>>11:14:10]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-21>>>11:18:29]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-21>>>11:18:39]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
10
socketLog/2024/8/22.txt
Normal file
10
socketLog/2024/8/22.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[2024-8-22>>>9:23:22]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-22>>>9:23:32]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-22>>>15:12:20]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-22>>>15:12:30]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-22>>>15:13:14]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-22>>>15:13:24]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-22>>>16:21:23]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-22>>>16:21:33]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-22>>>16:27:15]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-22>>>16:27:25]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2024/8/27.txt
Normal file
2
socketLog/2024/8/27.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-8-27>>>15:6:48]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-27>>>15:6:58]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2024/8/28.txt
Normal file
2
socketLog/2024/8/28.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-8-28>>>14:31:43]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-28>>>14:31:53]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2024/8/30.txt
Normal file
2
socketLog/2024/8/30.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-8-30>>>10:19:35]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-8-30>>>10:19:45]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2024/9/12.txt
Normal file
2
socketLog/2024/9/12.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-9-12>>>14:30:28]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-9-12>>>14:30:38]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2024/9/13.txt
Normal file
2
socketLog/2024/9/13.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-9-13>>>11:40:6]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-9-13>>>11:40:16]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2024/9/14.txt
Normal file
2
socketLog/2024/9/14.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-9-14>>>9:17:51]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-9-14>>>9:18:1]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
4
socketLog/2024/9/18.txt
Normal file
4
socketLog/2024/9/18.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
[2024-9-18>>>9:21:50]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-9-18>>>9:22:0]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-9-18>>>11:23:40]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-9-18>>>11:23:50]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
1
socketLog/2024/9/19.txt
Normal file
1
socketLog/2024/9/19.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[2024-9-19>>>9:8:38]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
4
socketLog/2024/9/2.txt
Normal file
4
socketLog/2024/9/2.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
[2024-9-2>>>9:33:9]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-9-2>>>9:33:19]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-9-2>>>17:56:19]>>>Error: read ECONNRESET
|
||||||
|
[2024-9-2>>>17:56:29]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2024/9/24.txt
Normal file
2
socketLog/2024/9/24.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-9-24>>>9:55:33]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-9-24>>>9:55:43]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2024/9/26.txt
Normal file
2
socketLog/2024/9/26.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-9-26>>>9:28:42]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-9-26>>>9:28:52]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2024/9/29.txt
Normal file
2
socketLog/2024/9/29.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-9-29>>>9:37:21]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-9-29>>>9:37:31]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2024/9/3.txt
Normal file
2
socketLog/2024/9/3.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-9-3>>>9:24:46]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-9-3>>>9:24:56]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2024/9/30.txt
Normal file
2
socketLog/2024/9/30.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-9-30>>>17:55:9]>>>Error: read ECONNRESET
|
||||||
|
[2024-9-30>>>17:55:19]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2024/9/4.txt
Normal file
2
socketLog/2024/9/4.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2024-9-4>>>9:8:26]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2024-9-4>>>9:8:36]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
1
socketLog/2025/2/26.txt
Normal file
1
socketLog/2025/2/26.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[2025-2-26>>>11:50:59]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
2
socketLog/2025/3/24.txt
Normal file
2
socketLog/2025/3/24.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[2025-3-24>>>11:44:21]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2025-3-24>>>12:11:56]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
3
socketLog/2025/6/27.txt
Normal file
3
socketLog/2025/6/27.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[2025-6-27>>>9:16:44]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2025-6-27>>>9:23:35]>>>Error: read ECONNRESET
|
||||||
|
[2025-6-27>>>11:48:31]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
1
socketLog/2026/2/27.txt
Normal file
1
socketLog/2026/2/27.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[2026-2-27>>>16:47:2]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
11
socketLog/2026/2/28.txt
Normal file
11
socketLog/2026/2/28.txt
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[2026-2-28>>>10:28:35]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2026-2-28>>>11:18:30]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2026-2-28>>>11:27:30]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2026-2-28>>>11:46:14]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2026-2-28>>>11:47:47]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2026-2-28>>>14:35:44]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2026-2-28>>>14:41:22]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2026-2-28>>>14:43:51]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2026-2-28>>>14:47:57]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2026-2-28>>>14:50:6]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
|
[2026-2-28>>>14:53:43]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
1
socketLog/2026/3/20.txt
Normal file
1
socketLog/2026/3/20.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[2026-3-20>>>10:21:8]>>>Error: connect ECONNREFUSED 127.0.0.1:9004
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user