commit 51b979c1827f8a6d9ae638cde894edac76f277bb Author: qubiaobiao <3294694717@qq.com> Date: Fri Mar 27 17:49:17 2026 +0800 北斗启航科技教育平台管理系统 diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..4ebc8ae --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +coverage diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..f304bdd --- /dev/null +++ b/.eslintrc @@ -0,0 +1,4 @@ +{ + "extends": "eslint-config-egg", + "root": true +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..652759b --- /dev/null +++ b/.gitignore @@ -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/ diff --git a/.sequelizerc b/.sequelizerc new file mode 100644 index 0000000..01d9847 --- /dev/null +++ b/.sequelizerc @@ -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'), +}; diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..8d375cc --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ + +language: node_js +node_js: + - '8' + - '10' + - '12' +before_install: + - npm i npminstall@5 -g +install: + - npminstall +script: + - npm run ci +after_script: + - npminstall codecov && codecov diff --git a/README.md b/README.md new file mode 100644 index 0000000..0169701 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# account-manager + + + +## QuickStart + + + +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 diff --git a/app/controller/BSide.js b/app/controller/BSide.js new file mode 100644 index 0000000..a84559b --- /dev/null +++ b/app/controller/BSide.js @@ -0,0 +1,149 @@ +'use strict'; + +const Controller = require('../core/base_controller'); + +const fileName = "BSide"; + +class BSideController extends Controller { + // 注册B端用户 + async addBSide() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const requestMsg = ctx.request.body.requestMsg; + requestMsg.forEach(element => { + const salt = this.generateRandomString(); + element.uid = this.generateNumberString('B'); + element.salt = this.encryptRequest(salt); + element.status = 0; + element.role = this.decryptRequest(element.role); + element.account_name = this.decryptRequest(element.account_name); + element.password = this.shaForm('123456', salt); + element.organization = element.organization == "" ? null : this.decryptRequest(element.organization); + element.user_name = element.user_name == "" ? "" : this.decryptRequest(element.user_name); + element.phone = element.phone == "" ? "" : this.decryptRequest(element.phone); + element.msg = element.msg == "" ? "" : this.decryptRequest(element.msg); + element.created_at = new Date(); + element.updated_at = new Date(); + element.login_at = new Date(); + element.login_status = 0; + }); + const result = await ctx.service.bSide.addBSide(requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '创建B端新用户成功', "none"); + } else { + this.setResponse(ctx, 404, '创建B端新用户失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "addBSide"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 查看B端用户 + async showBSide() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const body = ctx.request.body; + const result = await ctx.service.bSide.showBSide(body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let BSideMsg = []; + result.rows.forEach(element => { + BSideMsg.push(element.dataValues); + }); + const data = { + BSideMsg: BSideMsg, + count: result.count + }; + this.setResponse(ctx, 200, '搜索B端用户成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '搜索B端用户失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showBSide"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 编辑B端用户 + async editBSide() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, updateMsg, requestMsg } = body + const modelType = this.decryptRequest(model); + const result = await ctx.service.bSide.editBSide(uid, modelType, updateMsg, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '编辑B端用户信息成功', "none"); + } else { + this.setResponse(ctx, 404, '编辑B端用户信息失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "editBSide"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 删除B端用户 + async deleteBSide() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, password, requestMsg } = body + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.bSide.deleteBSide(uid, modelType, deCodePassword, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '删除B端用户成功', "none"); + } else { + this.setResponse(ctx, 404, '删除B端用户失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "deleteBSide"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = BSideController; \ No newline at end of file diff --git a/app/controller/BdCard.js b/app/controller/BdCard.js new file mode 100644 index 0000000..df0b89f --- /dev/null +++ b/app/controller/BdCard.js @@ -0,0 +1,141 @@ +'use strict'; + +const Controller = require('../core/base_controller'); + +const fileName = "BdCard"; + +class BdCardController extends Controller { + // 注册北斗卡 + async addBdCard() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const requestMsg = ctx.request.body.requestMsg; + requestMsg.forEach(element => { + element.card_id = this.decryptRequest(element.card_id); + element.card_imsi = this.decryptRequest(element.card_imsi); + element.type = 0; + element.status = 0; + element.created_at = new Date(); + element.updated_at = new Date(); + }); + const result = await ctx.service.bdCard.addBdCard(requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '导入北斗卡成功', "none"); + } else { + this.setResponse(ctx, 404, '导入北斗卡失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "addBdCard"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 查看北斗卡 + async showBdCard() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const body = ctx.request.body; + const result = await ctx.service.bdCard.showBdCard(body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let bdCardMsg = []; + result.rows.forEach(element => { + bdCardMsg.push(element.dataValues); + }); + const data = { + bdCardMsg: bdCardMsg, + count: result.count + }; + this.setResponse(ctx, 200, '搜索北斗卡成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '搜索北斗卡失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showBdCard"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 编辑北斗卡 + async editBdCard() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, password, updateMsg, requestMsg } = body + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.bdCard.editBdCard(uid, modelType, deCodePassword, updateMsg, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '编辑北斗卡成功', "none"); + } else { + this.setResponse(ctx, 404, '编辑北斗卡失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "editBdCard"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 删除北斗卡 + async deleteBdCard() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, password, requestMsg } = body + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.bdCard.deleteBdCard(uid, modelType, deCodePassword, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '删除北斗卡成功', "none"); + } else { + this.setResponse(ctx, 404, '删除北斗卡失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "deleteBdCard"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = BdCardController; \ No newline at end of file diff --git a/app/controller/BindRecord.js b/app/controller/BindRecord.js new file mode 100644 index 0000000..8fbe763 --- /dev/null +++ b/app/controller/BindRecord.js @@ -0,0 +1,75 @@ +'use strict'; + +const Controller = require('../core/base_controller'); + +const fileName = "BindRecord"; + +class BindRecordController extends Controller { + // 查看北斗卡绑定记录 + async showBindRecord() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const body = ctx.request.body; + const result = await ctx.service.bindRecord.showBindRecord(body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let BindRecordMsg = []; + result.rows.forEach(element => { + BindRecordMsg.push(element.dataValues); + }); + const data = { + BindRecordMsg: BindRecordMsg, + count: result.count + }; + this.setResponse(ctx, 200, '搜索北斗卡绑定记录成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '搜索北斗卡绑定记录失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showBindRecord"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 删除北斗卡绑定记录 + async deleteBindRecord() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, password, requestMsg } = body + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.bindRecord.deleteBindRecord(uid, modelType, deCodePassword, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '删除北斗卡绑定记录成功', "none"); + } else { + this.setResponse(ctx, 404, '删除北斗卡绑定记录失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "deleteBindRecord"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = BindRecordController; \ No newline at end of file diff --git a/app/controller/BindSNRecord.js b/app/controller/BindSNRecord.js new file mode 100644 index 0000000..6b6d95b --- /dev/null +++ b/app/controller/BindSNRecord.js @@ -0,0 +1,75 @@ +'use strict'; + +const Controller = require('../core/base_controller'); + +const fileName = "BindSNRecord"; + +class BindSNRecordController extends Controller { + // 查看SN号绑定记录 + async showBindSNRecord() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const body = ctx.request.body; + const result = await ctx.service.bindSNRecord.showBindSNRecord(body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let BindSNRecordMsg = []; + result.rows.forEach(element => { + BindSNRecordMsg.push(element.dataValues); + }); + const data = { + BindSNRecordMsg: BindSNRecordMsg, + count: result.count + }; + this.setResponse(ctx, 200, '搜索SN号绑定记录成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '搜索SN号绑定记录失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showBindSNRecord"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 删除SN号绑定记录 + async deleteBindSNRecord() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, password, requestMsg } = body + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.bindSNRecord.deleteBindSNRecord(uid, modelType, deCodePassword, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '删除SN号绑定记录成功', "none"); + } else { + this.setResponse(ctx, 404, '删除SN号绑定记录失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "deleteBindSNRecord"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = BindSNRecordController; \ No newline at end of file diff --git a/app/controller/Business.js b/app/controller/Business.js new file mode 100644 index 0000000..241fceb --- /dev/null +++ b/app/controller/Business.js @@ -0,0 +1,207 @@ +'use strict'; + +const Controller = require('../core/base_controller'); + +const fileName = "Business"; + +class BusinessController extends Controller { + // 注册公司业务 + async addBusiness() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const requestMsg = ctx.request.body.requestMsg; + requestMsg.forEach(element => { + const salt = this.generateRandomString(); + element.salt = this.encryptRequest(salt); + element.login_url = this.decryptRequest(element.login_url); + element.client_url = this.decryptRequest(element.client_url); + element.temporary_id = this.decryptRequest(element.temporary_id) == 'true' ? this.shaForm(this.generateRandomString(), salt) : this.decryptRequest(element.temporary_id); + element.client_id = this.generateClientId(); + element.client_secret = this.shaForm(this.generateRandomString(), salt); + element.name = this.decryptRequest(element.name); + element.type = element.type ? this.decryptRequest(element.type) : 2; + element.level = element.level ? this.decryptRequest(element.level) : 0; + element.status = element.status ? this.decryptRequest(element.status) : 0; + element.created_at = new Date(); + element.updated_at = new Date(); + }); + const result = await ctx.service.business.addBusiness(uid, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '新增公司业务成功', "none"); + } else { + this.setResponse(ctx, 404, '新增公司业务失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "addBusiness"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 查看公司业务 + async showBusiness() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const result = await ctx.service.business.showBusiness(body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let BusinessMsg = []; + result.rows.forEach(element => { + BusinessMsg.push(element.dataValues); + }); + const data = { + BusinessMsg: BusinessMsg, + count: result.count + }; + this.setResponse(ctx, 200, '搜索公司业务成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '搜索公司业务失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showBusiness"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 远程搜索公司业务 + async SearchBusiness() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const result = await ctx.service.business.SearchBusiness(body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let business = []; + result.forEach(element => { + business.push(element.dataValues); + }); + const data = { + business: business, + }; + this.setResponse(ctx, 200, '搜索公司业务信息成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '搜索公司业务信息失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showBSide"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 编辑公司业务 + async editBusiness() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, updateMsg, requestMsg, password } = body + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + let salt; + if (updateMsg.salt) { + salt = this.generateRandomString(); + updateMsg.salt = this.encryptRequest(salt); + } else { + delete updateMsg.salt; + } + if (!updateMsg.temporary_id) { + delete updateMsg.temporary_id; + } else if (updateMsg.temporary_id == 'true') { + updateMsg.temporary_id = this.shaForm(this.generateRandomString(), salt); + } + if (updateMsg.client_id) { + updateMsg.client_id = this.generateClientId(); + } else { + delete updateMsg.client_id; + } + if (updateMsg.client_secret) { + updateMsg.client_secret = this.shaForm(this.generateRandomString(), salt); + } else { + delete updateMsg.client_secret; + } + const result = await ctx.service.business.editBusiness(uid, modelType, deCodePassword, updateMsg, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '编辑公司业务成功', "none"); + } else { + this.setResponse(ctx, 404, '编辑公司业务失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "editBusiness"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 删除公司业务 + async deleteBusiness() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, password, requestMsg } = body + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.business.deleteBusiness(uid, modelType, deCodePassword, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '删除公司业务成功', "none"); + } else { + this.setResponse(ctx, 404, '删除公司业务失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "deleteBusiness"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = BusinessController; \ No newline at end of file diff --git a/app/controller/CSide.js b/app/controller/CSide.js new file mode 100644 index 0000000..032670d --- /dev/null +++ b/app/controller/CSide.js @@ -0,0 +1,106 @@ +'use strict'; + +const Controller = require('../core/base_controller'); + +const fileName = "CSide"; + +class CSideController extends Controller { + // 查看C端用户 + async showCSide() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const result = await ctx.service.cSide.showCSide(body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let CSideMsg = []; + result.rows.forEach(element => { + CSideMsg.push(element.dataValues); + }); + const data = { + CSideMsg: CSideMsg, + count: result.count + }; + this.setResponse(ctx, 200, '搜索C端用户成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '搜索C端用户失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showCSide"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 编辑C端用户 + async editCSide() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, updateMsg, requestMsg } = body + const modelType = this.decryptRequest(model); + const result = await ctx.service.cSide.editCSide(uid, modelType, updateMsg, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '编辑C端用户信息成功', "none"); + } else { + this.setResponse(ctx, 404, '编辑C端用户信息失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "editCSide"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 删除C端用户 + async deleteCSide() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, password, requestMsg } = body + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.cSide.deleteCSide(uid, modelType, deCodePassword, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '删除C端用户成功', "none"); + } else { + this.setResponse(ctx, 404, '删除C端用户失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "deleteCSide"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = CSideController; \ No newline at end of file diff --git a/app/controller/ContestAccount.js b/app/controller/ContestAccount.js new file mode 100644 index 0000000..c512fb1 --- /dev/null +++ b/app/controller/ContestAccount.js @@ -0,0 +1,209 @@ +const Controller = require('../core/base_controller'); + +const fileName = "ContestAccount"; + +class ContestAccountController extends Controller { + // 管理系统导入竞赛账号信息 + async importAccount() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const requestMsg = ctx.request.body.requestMsg; + requestMsg.forEach(element => { + const salt = this.generateRandomString(); + element.uid = this.generateNumberString('T'); + element.salt = this.encryptRequest(salt); + element.contest_uid = this.decryptRequest(element.contest_uid); + element.account_name = this.decryptRequest(element.account_name); + element.password = this.shaForm('123456', salt); + element.status = 0; + element.created_at = new Date(); + element.login_status = 0; + }); + const result = await ctx.service.contestAccount.importAccount(requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '操作成功', "none"); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "importAccount"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统创建竞赛账号信息 + async addAccount() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const requestMsg = ctx.request.body.requestMsg; + requestMsg.forEach(element => { + const salt = this.generateRandomString(); + element.uid = this.generateNumberString('T'); + element.salt = this.encryptRequest(salt); + element.contest_uid = this.decryptRequest(element.contest_uid); + element.account_name = this.decryptRequest(element.account_name); + element.password = this.shaForm('123456', salt); + element.status = 0; + element.created_at = new Date(); + element.login_status = 0; + }); + const result = await ctx.service.contestAccount.addAccount(requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '操作成功', "none"); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "addAccount"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统查看竞赛账号信息 + async showAccount() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const body = ctx.request.body; + const result = await ctx.service.contestAccount.showAccount(body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let accountMsg = []; + result.rows.forEach(element => { + accountMsg.push(element.dataValues); + }); + const data = { + accountMsg, + count: result.count + }; + this.setResponse(ctx, 200, '操作成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showAccount"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统编辑竞赛账号信息 + async editAccount() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, updateMsg, requestMsg } = body + const modelType = this.decryptRequest(model); + const result = await ctx.service.contestAccount.editAccount(uid, modelType, updateMsg, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '操作成功', "none"); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "editAccount"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统删除竞赛账号信息 + async delAccount() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, password, requestMsg } = body + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.contestAccount.delAccount(uid, modelType, deCodePassword, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '操作成功', "none"); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "delAccount"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统重置竞赛账号密码 + async resetAccount() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const { account_uid, password } = ctx.request.body; + const accountUid = this.decryptRequest(account_uid); + const resetPassword = this.decryptRequest(password); + const result = await ctx.service.contestAccount.resetAccount(uid, accountUid, resetPassword); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '操作成功', "none"); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "resetAccount"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = ContestAccountController; diff --git a/app/controller/ContestExamination.js b/app/controller/ContestExamination.js new file mode 100644 index 0000000..b468f5d --- /dev/null +++ b/app/controller/ContestExamination.js @@ -0,0 +1,131 @@ +const Controller = require('../core/base_controller'); + +const fileName = "ContestExamination"; + +class ContestExaminationController extends Controller { + // 管理系统查看账号答题情况 + async showExamination() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const body = ctx.request.body; + const result = await ctx.service.contestExamination.showExamination(body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let examinationMsg = []; + result.rows.forEach(element => { + examinationMsg.push(element.dataValues); + }); + const data = { + examinationMsg, + count: result.count + }; + this.setResponse(ctx, 200, '操作成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showExamination"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统编辑账号答题情况 + async editExamination() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, updateMsg, requestMsg } = body + const modelType = this.decryptRequest(model); + const result = await ctx.service.contestExamination.editExamination(uid, modelType, updateMsg, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '操作成功', "none"); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "editExamination"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统删除账号答题情况 + async delExamination() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, password, requestMsg } = body + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.contestExamination.delExamination(uid, modelType, deCodePassword, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '操作成功', "none"); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "delExamination"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统导出账号答题情况 + async downloadExamination() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const result = await ctx.service.contestExamination.downloadExamination(uid, body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '操作成功', "none"); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "downloadExamination"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = ContestExaminationController; diff --git a/app/controller/ContestMsg.js b/app/controller/ContestMsg.js new file mode 100644 index 0000000..523992e --- /dev/null +++ b/app/controller/ContestMsg.js @@ -0,0 +1,177 @@ +const Controller = require('../core/base_controller'); + +const fileName = "ContestMsg"; + +class ContestMsgController extends Controller { + // 管理系统检索竞赛 uid + async searchContestUid() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const result = await ctx.service.contestMsg.searchContestUid(uid, body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let contestUid = []; + result.forEach(element => { + contestUid.push({ value: element.dataValues.uid }); + }); + this.setResponse(ctx, 200, '操作成功', "polymerization", contestUid); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "searchContestUid"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统创建竞赛信息 + async addContest() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const requestMsg = ctx.request.body.requestMsg; + requestMsg.forEach(element => { + element.uid = this.generateNumberString('H'); + element.contest_name = this.decryptRequest(element.contest_name); + element.contest_organizers = this.decryptRequest(element.contest_organizers); + element.contest_term = this.decryptRequest(element.contest_term); + element.type = Number(element.type); + element.status = 0; + element.online_start = new Date(element.online_start); + element.online_end = new Date(element.online_end); + element.offline_start = new Date(element.offline_start); + element.offline_end = new Date(element.offline_end); + element.contest_start = new Date(element.contest_start); + element.contest_end = new Date(element.contest_end); + element.created_at = new Date(); + }); + const result = await ctx.service.contestMsg.addContest(requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '操作成功', "none"); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "addContest"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统查看竞赛信息 + async showContest() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const body = ctx.request.body; + const result = await ctx.service.contestMsg.showContest(body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let contestMsg = []; + result.rows.forEach(element => { + contestMsg.push(element.dataValues); + }); + const data = { + contestMsg, + count: result.count + }; + this.setResponse(ctx, 200, '操作成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showContest"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统编辑竞赛信息 + async editContest() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, updateMsg, requestMsg } = body + const modelType = this.decryptRequest(model); + const result = await ctx.service.contestMsg.editContest(uid, modelType, updateMsg, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '操作成功', "none"); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "editContest"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统删除竞赛信息 + async delContest() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, password, requestMsg } = body + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.contestMsg.delContest(uid, modelType, deCodePassword, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '操作成功', "none"); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "delContest"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = ContestMsgController; diff --git a/app/controller/ContestTopic.js b/app/controller/ContestTopic.js new file mode 100644 index 0000000..f0d0e18 --- /dev/null +++ b/app/controller/ContestTopic.js @@ -0,0 +1,173 @@ +const Controller = require('../core/base_controller'); + +const fileName = "ContestTopic"; + +class ContestTopicController extends Controller { + // 管理系统导入选择题 + async importChoiceTopic() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const requestMsg = ctx.request.body.requestMsg; + requestMsg.forEach(element => { + element.topic = this.decryptRequest(element.topic); + element.options_a = this.decryptRequest(element.options_a); + element.options_b = this.decryptRequest(element.options_b); + element.options_c = this.decryptRequest(element.options_c); + element.options_d = this.decryptRequest(element.options_d); + element.answer = this.decryptRequest(element.answer); + }); + const result = await ctx.service.contestTopic.importChoiceTopic(requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '操作成功', "none"); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "importChoiceTopic"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统创建选择题 + async addChoiceTopic() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const requestMsg = ctx.request.body.requestMsg; + requestMsg.forEach(element => { + element.topic = this.decryptRequest(element.topic); + element.options_a = this.decryptRequest(element.options_a); + element.options_b = this.decryptRequest(element.options_b); + element.options_c = this.decryptRequest(element.options_c); + element.options_d = this.decryptRequest(element.options_d); + element.answer = this.decryptRequest(element.answer); + }); + const result = await ctx.service.contestTopic.addChoiceTopic(requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '操作成功', "none"); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "addChoiceTopic"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统查看选择题 + async showChoiceTopic() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const body = ctx.request.body; + const result = await ctx.service.contestTopic.showChoiceTopic(body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let choiceTopicMsg = []; + result.rows.forEach(element => { + choiceTopicMsg.push(element.dataValues); + }); + const data = { + choiceTopicMsg, + count: result.count + }; + this.setResponse(ctx, 200, '操作成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showChoiceTopic"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统编辑选择题 + async editChoiceTopic() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, updateMsg, requestMsg } = body + const modelType = this.decryptRequest(model); + const result = await ctx.service.contestTopic.editChoiceTopic(uid, modelType, updateMsg, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '操作成功', "none"); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "editChoiceTopic"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统删除选择题 + async delChoiceTopic() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, password, requestMsg } = body + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.contestTopic.delChoiceTopic(uid, modelType, deCodePassword, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '操作成功', "none"); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "delChoiceTopic"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = ContestTopicController; diff --git a/app/controller/Insiders.js b/app/controller/Insiders.js new file mode 100644 index 0000000..c127567 --- /dev/null +++ b/app/controller/Insiders.js @@ -0,0 +1,149 @@ +'use strict'; + +const Controller = require('../core/base_controller'); + +const fileName = "Insiders"; + +class InsidersController extends Controller { + // 注册管理系统用户 + async addInsiders() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const requestMsg = ctx.request.body.requestMsg; + requestMsg.forEach(element => { + const salt = this.generateRandomString(); + element.uid = this.generateNumberString('M'); + element.salt = this.encryptRequest(salt); + element.status = this.decryptRequest(element.role) == '99' ? 2 : 0; + element.role = this.decryptRequest(element.role) == '99' ? 0 : this.decryptRequest(element.role); + element.name = this.decryptRequest(element.name); + element.password = this.shaForm('123456', salt); + element.department = element.department == "" ? "" : this.decryptRequest(element.department); + element.change = this.decryptRequest(element.change); + element.created_at = new Date(); + element.updated_at = new Date(); + element.login_at = new Date(); + element.login_status = 0; + }); + const result = await ctx.service.insiders.addInsiders(uid, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '创建公司员工账号成功', "none"); + } else { + this.setResponse(ctx, 404, '创建公司员工账号失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "addInsiders"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 查看管理系统用户 + async showInsiders() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const result = await ctx.service.insiders.showInsiders(body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let InsidersMsg = []; + result.rows.forEach(element => { + InsidersMsg.push(element.dataValues); + }); + const data = { + InsidersMsg: InsidersMsg, + count: result.count + }; + this.setResponse(ctx, 200, '搜索公司员工成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '搜索公司员工失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showInsiders"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 编辑管理系统用户 + async editInsiders() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, updateMsg, requestMsg } = body + const modelType = this.decryptRequest(model); + const result = await ctx.service.insiders.editInsiders(uid, modelType, updateMsg, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '编辑公司员工账号信息成功', "none"); + } else { + this.setResponse(ctx, 404, '编辑公司员工账号信息失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "editInsiders"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 删除管理系统用户 + async deleteInsiders() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, password, requestMsg } = body + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.insiders.deleteInsiders(uid, modelType, deCodePassword, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '删除公司员工账号成功', "none"); + } else { + this.setResponse(ctx, 404, '删除公司员工账号失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "deleteInsiders"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = InsidersController; \ No newline at end of file diff --git a/app/controller/Monitoring.js b/app/controller/Monitoring.js new file mode 100644 index 0000000..22a8d13 --- /dev/null +++ b/app/controller/Monitoring.js @@ -0,0 +1,75 @@ +'use strict'; + +const Controller = require('../core/base_controller'); + +const fileName = "Monitoring"; + +class MonitoringController extends Controller { + // 查看危险操作记录 + async showMonitoring() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const body = ctx.request.body; + const result = await ctx.service.monitoring.showMonitoring(body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let MonitoringMsg = []; + result.rows.forEach(element => { + MonitoringMsg.push(element.dataValues); + }); + const data = { + MonitoringMsg: MonitoringMsg, + count: result.count + }; + this.setResponse(ctx, 200, '搜索危险操作记录成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '搜索危险操作记录失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showMonitoring"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 删除危险操作记录 + async deleteMonitoring() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, password, requestMsg } = body + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.monitoring.deleteMonitoring(uid, modelType, deCodePassword, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '删除危险操作记录成功', "none"); + } else { + this.setResponse(ctx, 404, '删除危险操作记录失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "deleteMonitoring"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = MonitoringController; \ No newline at end of file diff --git a/app/controller/Organization.js b/app/controller/Organization.js new file mode 100644 index 0000000..13e8496 --- /dev/null +++ b/app/controller/Organization.js @@ -0,0 +1,180 @@ +'use strict'; + +const Controller = require('../core/base_controller'); + +const fileName = "Organization"; + +class OrganizationController extends Controller { + // 注册B端用户单位 + async addOrganization() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const requestMsg = ctx.request.body.requestMsg; + requestMsg.forEach(element => { + element.uid = this.generateNumberString('O'); + element.organization_name = this.decryptRequest(element.organization_name); + element.address = element.address == "" ? "" : this.decryptRequest(element.address); + element.liaison_name = element.liaison_name == "" ? "" : this.decryptRequest(element.liaison_name); + element.phone = element.phone == "" ? "" : this.decryptRequest(element.phone); + element.email = element.email == "" ? "" : this.decryptRequest(element.email); + element.other_information = element.other_information == "" ? "" : this.decryptRequest(element.other_information); + element.post_code = element.post_code == "" ? "" : this.decryptRequest(element.post_code); + element.created_at = new Date(); + element.updated_at = new Date(); + }); + const result = await ctx.service.organization.addOrganization(requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '新增B端用户单位成功', "none"); + } else { + this.setResponse(ctx, 404, '新增B端用户单位失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "addOrganization"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 查看B端用户单位 + async showOrganization() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const result = await ctx.service.organization.showOrganization(body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let OrganizationMsg = []; + result.rows.forEach(element => { + OrganizationMsg.push(element.dataValues); + }); + const data = { + OrganizationMsg: OrganizationMsg, + count: result.count + }; + this.setResponse(ctx, 200, '搜索B端用户单位成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '搜索B端用户单位失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showOrganization"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 远程搜索B端用户单位 + async SearchOrganization() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const result = await ctx.service.organization.SearchOrganization(body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let organization = []; + result.forEach(element => { + organization.push(element.dataValues); + }); + const data = { + organization: organization, + }; + this.setResponse(ctx, 200, '搜索B端用户信息成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '搜索B端用户信息失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showBSide"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 编辑B端用户单位 + async editOrganization() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, updateMsg, requestMsg } = body + const modelType = this.decryptRequest(model); + const result = await ctx.service.organization.editOrganization(uid, modelType, updateMsg, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '编辑B端用户单位成功', "none"); + } else { + this.setResponse(ctx, 404, '编辑B端用户单位失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "editOrganization"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 删除B端用户单位 + async deleteOrganization() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, password, requestMsg } = body + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.organization.deleteOrganization(uid, modelType, deCodePassword, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '删除B端用户单位成功', "none"); + } else { + this.setResponse(ctx, 404, '删除B端用户单位失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "deleteOrganization"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = OrganizationController; \ No newline at end of file diff --git a/app/controller/SNAdmin.js b/app/controller/SNAdmin.js new file mode 100644 index 0000000..b906364 --- /dev/null +++ b/app/controller/SNAdmin.js @@ -0,0 +1,161 @@ +'use strict'; + +const Controller = require('../core/base_controller'); + +const fileName = "SNAdmin"; + +class SNAdminController extends Controller { + // 搜索可分配的SN号 + async searchAllocationSN() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const result = await ctx.service.sNAdmin.searchAllocationSN(); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + const data = { + snArr: result + }; + this.setResponse(ctx, 200, '搜索可分配的SN号成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '搜索可分配的SN号失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "searchAllocationSN"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 搜索可分配的单位用户 + async searchAllocationUser() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const result = await ctx.service.sNAdmin.searchAllocationUser(); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + const data = { + userArr: result + }; + this.setResponse(ctx, 200, '搜索可分配的单位用户成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '搜索可分配的单位用户失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "searchAllocationUser"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // B端分配SN号 + async allocationSN() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const result = await ctx.service.sNAdmin.allocationSN(uid, body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, 'B端分配SN号成功', "none"); + } else { + this.setResponse(ctx, 404, 'B端分配SN号失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "allocationSN"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 查看B端SN号分配记录 + async showAllocationSNRecord() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const body = ctx.request.body; + const result = await ctx.service.sNAdmin.showAllocationSNRecord(body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let SNAdminMsg = []; + result.rows.forEach(element => { + SNAdminMsg.push(element.dataValues); + }); + const data = { + SNAdminMsg: SNAdminMsg, + count: result.count + }; + this.setResponse(ctx, 200, '搜索SN号分配记录成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '搜索SN号分配记录失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showAllocationSNRecord"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 删除B端SN号分配记录 + async deleteAllocationSNRecord() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, password, requestMsg } = body + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.sNAdmin.deleteAllocationSNRecord(uid, modelType, deCodePassword, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '删除SN号分配记录成功', "none"); + } else { + this.setResponse(ctx, 404, '删除SN号分配记录失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "deleteAllocationSNRecord"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = SNAdminController; \ No newline at end of file diff --git a/app/controller/Sn.js b/app/controller/Sn.js new file mode 100644 index 0000000..d94db37 --- /dev/null +++ b/app/controller/Sn.js @@ -0,0 +1,139 @@ +'use strict'; + +const Controller = require('../core/base_controller'); + +const fileName = "SN"; + +class SNController extends Controller { + // 注册SN号 + async addSN() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const requestMsg = ctx.request.body.requestMsg; + requestMsg.forEach(element => { + element.sn_number = this.decryptRequest(element.sn_number); + element.status = 0; + element.created_at = new Date(); + element.updated_at = new Date(); + }); + const result = await ctx.service.sn.addSN(requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '导入SN号成功', "none"); + } else { + this.setResponse(ctx, 404, '导入SN号失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "addSN"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 查看SN号 + async showSN() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const body = ctx.request.body; + const result = await ctx.service.sn.showSN(body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let SNMsg = []; + result.rows.forEach(element => { + SNMsg.push(element.dataValues); + }); + const data = { + SNMsg: SNMsg, + count: result.count + }; + this.setResponse(ctx, 200, '搜索SN号成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '搜索SN号失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showSN"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 编辑SN号 + async editSN() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, password, updateMsg, requestMsg } = body + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.sn.editSN(uid, modelType, deCodePassword, updateMsg, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '编辑SN号成功', "none"); + } else { + this.setResponse(ctx, 404, '编辑SN号失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "editSN"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 删除SN号 + async deleteSN() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const uid = JSON.parse(rdmcode).uid; + const body = ctx.request.body; + const { model, password, requestMsg } = body + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.sn.deleteSN(uid, modelType, deCodePassword, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + this.setResponse(ctx, 200, '删除SN号成功', "none"); + } else { + this.setResponse(ctx, 404, '删除SN号失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "deleteSN"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = SNController; \ No newline at end of file diff --git a/app/controller/home.js b/app/controller/home.js new file mode 100644 index 0000000..4ccb9cf --- /dev/null +++ b/app/controller/home.js @@ -0,0 +1,29 @@ +const { Controller } = require('egg'); + +const fileName = "home"; + +class HomeController extends Controller { + async index() { + const { ctx } = this; + ctx.body = { + code:200, + msg:'test' + } + } + async home() { + const { ctx } = this; + ctx.body = { + code:200, + msg:'home' + } + } + async main() { + const { ctx } = this; + ctx.body = { + code:200, + msg:'main' + } + } +} + +module.exports = HomeController; diff --git a/app/core/base_controller.js b/app/core/base_controller.js new file mode 100644 index 0000000..b29aa98 --- /dev/null +++ b/app/core/base_controller.js @@ -0,0 +1,133 @@ +const { Controller } = require('egg'); + +const sha256 = require("crypto-js/sha256"); + +const CryptoJS = require("crypto-js"); + +const KEY = CryptoJS.enc.Utf8.parse('BDQH'); + +class BaseController extends Controller { + 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); + } + + // 用户uid生成函数 + generateNumberString = (side) => { + // 获取当前日期(年月日) + const now = new Date(); + const year = String(now.getFullYear()).padStart(4, '0'); + const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以加1 + const date = String(now.getDate()).padStart(2, '0'); + const dateString = year + month + date; + + // 获取当前时间戳的后三位 + const timestamp = String(Date.now()).slice(-3); + + // 生成三位随机数字 + const randomDigits = Math.floor(Math.random() * 100).toString().padStart(3, '0'); + + // 组合成最终的15位字符串 + const fullNumberString = dateString + timestamp + randomDigits + side; + + return fullNumberString; + } + + // 随机盐生成函数 + generateRandomString = () => { + const lowerCaseLetters = 'abcdefghijklmnopqrstuvwxyz'; + const upperCaseLetters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; + const numbers = '0123456789'; + + let result = ''; + + // 生成5位随机小写字母 + for (let i = 0; i < 5; i++) { + const randomIndex = Math.floor(Math.random() * lowerCaseLetters.length); + result += lowerCaseLetters[randomIndex]; + } + + // 生成5位随机大写字母 + for (let i = 0; i < 5; i++) { + const randomIndex = Math.floor(Math.random() * upperCaseLetters.length); + result += upperCaseLetters[randomIndex]; + } + + // 生成2位随机数字 + for (let i = 0; i < 2; i++) { + const randomIndex = Math.floor(Math.random() * numbers.length); + result += numbers[randomIndex]; + } + + // 打乱整个字符串 + const characters = result.split(''); + for (let i = characters.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + [characters[i], characters[j]] = [characters[j], characters[i]]; + } + + return characters.join(''); + } + + // 随机生成12位客户端id + generateClientId = () => { + const numbers = '0123456789'; + + let result = ''; + + // 生成4位随机数字 + for (let i = 0; i < 4; i++) { + const randomIndex = Math.floor(Math.random() * numbers.length); + result += numbers[randomIndex]; + } + + // 打乱整个字符串 + const characters = result.split(''); + for (let i = characters.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + [characters[i], characters[j]] = [characters[j], characters[i]]; + } + + // 获取当前日期(年月日) + const now = new Date(); + const year = String(now.getFullYear()).padStart(4, '0'); + const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以加1 + const date = String(now.getDate()).padStart(2, '0'); + const dateString = year + month + date; + + const fullNumberString = dateString + characters.join(''); + + return fullNumberString; + } + + checkUid = async (ctx) => { + const token = ctx.request.header.authorization; + const redis = ctx.app.redis; + const insiders = await redis.get('db2').get(token); + return insiders ? insiders : false; + }; + + setResponse = (ctx, code, msg, model, data = {}) => { + const modelType = { + "none": { code, msg }, + "deconstruction": { code, msg, ...data }, + "polymerization": { code, msg, data } + } + ctx.body = modelType[model]; + } +} + +module.exports = BaseController; \ No newline at end of file diff --git a/app/core/base_service.js b/app/core/base_service.js new file mode 100644 index 0000000..5bf3b3a --- /dev/null +++ b/app/core/base_service.js @@ -0,0 +1,88 @@ +const { Service } = require('egg'); + +const { Op } = require('sequelize'); + +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); + } + + // uid生成函数 + generateNumberString = () => { + // 获取当前日期(年月日) + const now = new Date(); + const year = String(now.getFullYear()).padStart(4, '0'); + const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以加1 + const date = String(now.getDate()).padStart(2, '0'); + const dateString = year + month + date; + + // 获取当前时间戳的后四位 + const timestamp = String(Date.now()).slice(-4); + + // 生成四位随机数字 + const randomDigits = Math.floor(Math.random() * 10000).toString().padStart(4, '0'); + + // 组合成最终的16位数字字符串 + const fullNumberString = dateString + timestamp + randomDigits; + + return fullNumberString; + } + + // 随机盐生成函数 + generateRandomString = () => { + const lowerCaseLetters = 'abcdefghijklmnopqrstuvwxyz'; + const upperCaseLetters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; + const numbers = '0123456789'; + + let result = ''; + + // 生成5位随机小写字母 + for (let i = 0; i < 5; i++) { + const randomIndex = Math.floor(Math.random() * lowerCaseLetters.length); + result += lowerCaseLetters[randomIndex]; + } + + // 生成5位随机大写字母 + for (let i = 0; i < 5; i++) { + const randomIndex = Math.floor(Math.random() * upperCaseLetters.length); + result += upperCaseLetters[randomIndex]; + } + + // 生成2位随机数字 + for (let i = 0; i < 2; i++) { + const randomIndex = Math.floor(Math.random() * numbers.length); + result += numbers[randomIndex]; + } + + // 打乱整个字符串 + const characters = result.split(''); + for (let i = characters.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + [characters[i], characters[j]] = [characters[j], characters[i]]; + } + + return characters.join(''); + } +} + +module.exports = BaseService; \ No newline at end of file diff --git a/app/middleware/log.js b/app/middleware/log.js new file mode 100644 index 0000000..6d7323a --- /dev/null +++ b/app/middleware/log.js @@ -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('新内容已追加到文件'); + }); + } + }); +}; \ No newline at end of file diff --git a/app/model/BShortMsg.js b/app/model/BShortMsg.js new file mode 100644 index 0000000..0a7cee8 --- /dev/null +++ b/app/model/BShortMsg.js @@ -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; +}; \ No newline at end of file diff --git a/app/model/BSide.js b/app/model/BSide.js new file mode 100644 index 0000000..726431c --- /dev/null +++ b/app/model/BSide.js @@ -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; +}; \ No newline at end of file diff --git a/app/model/BSnMsg.js b/app/model/BSnMsg.js new file mode 100644 index 0000000..5285709 --- /dev/null +++ b/app/model/BSnMsg.js @@ -0,0 +1,21 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, STRING, TEXT, DATE } = app.Sequelize; + + const BSnMsg = app.model.define('bsn-msg', { + id: { type: INTEGER(8), primaryKey: true, autoIncrement: true }, + user_uid: CHAR(15), + sn_number: STRING(8), + original_msg: TEXT, + msg_data: TEXT, + created_at: DATE, + },{ + freezeTableName: true, + timestamp: true, + createdAt: true, + updatedAt: false, + }); + + return BSnMsg; +}; \ No newline at end of file diff --git a/app/model/BSubscribe.js b/app/model/BSubscribe.js new file mode 100644 index 0000000..3f27e77 --- /dev/null +++ b/app/model/BSubscribe.js @@ -0,0 +1,22 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, DATE } = app.Sequelize; + + const BSubscribe = app.model.define('bsubscribe', { + id: { type: INTEGER(11), primaryKey: true, autoIncrement: true }, + user_uid: CHAR(15), + business: INTEGER(3), + status: INTEGER(3), + type: INTEGER(3), + created_at: DATE, + updated_at: DATE, + },{ + freezeTableName: true, + timestamp: true, + createdAt: true, + updatedAt: true, + }); + + return BSubscribe; +}; \ No newline at end of file diff --git a/app/model/BindBSNrecord.js b/app/model/BindBSNrecord.js new file mode 100644 index 0000000..06c4497 --- /dev/null +++ b/app/model/BindBSNrecord.js @@ -0,0 +1,20 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, STRING, DATE } = app.Sequelize; + + const BindBSNrecord = app.model.define('bind-bsnrecord', { + id: { type: INTEGER(11), primaryKey: true, autoIncrement: true }, + user_uid: CHAR(15), + sn_number: STRING(8), + type: INTEGER(1), + created_at: DATE, + },{ + freezeTableName: true, + timestamp: true, + createdAt: true, + updatedAt: false, + }); + + return BindBSNrecord; +}; \ No newline at end of file diff --git a/app/model/BindBrecord.js b/app/model/BindBrecord.js new file mode 100644 index 0000000..a9e5cad --- /dev/null +++ b/app/model/BindBrecord.js @@ -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; +}; \ No newline at end of file diff --git a/app/model/BuserBind.js b/app/model/BuserBind.js new file mode 100644 index 0000000..107137f --- /dev/null +++ b/app/model/BuserBind.js @@ -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 }, + user_uid: CHAR(15), + card_id: CHAR(8), + },{ + freezeTableName: true, + timestamp: false, + createdAt: false, + updatedAt: false, + }); + + return BuserBind; +}; \ No newline at end of file diff --git a/app/model/BuserSNAdmin.js b/app/model/BuserSNAdmin.js new file mode 100644 index 0000000..5ce1e71 --- /dev/null +++ b/app/model/BuserSNAdmin.js @@ -0,0 +1,19 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, TEXT } = app.Sequelize; + + const BuserSnAdmin = app.model.define('buser-snadmin', { + id: { type: INTEGER(8), primaryKey: true, autoIncrement: true }, + user_uid: CHAR(15), + length: INTEGER(3), + sn_set: TEXT, + },{ + freezeTableName: true, + timestamp: true, + createdAt: false, + updatedAt: false, + }); + + return BuserSnAdmin; +}; \ No newline at end of file diff --git a/app/model/BuserSNBind.js b/app/model/BuserSNBind.js new file mode 100644 index 0000000..c167ce4 --- /dev/null +++ b/app/model/BuserSNBind.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, STRING } = app.Sequelize; + + const BuserSNBind = app.model.define('buser-snbind', { + id: { type: INTEGER(8), primaryKey: true, autoIncrement: true }, + user_uid: CHAR(15), + sn_number: STRING(8), + },{ + freezeTableName: true, + timestamp: true, + createdAt: false, + updatedAt: false, + }); + + return BuserSNBind; +}; \ No newline at end of file diff --git a/app/model/BuserToken.js b/app/model/BuserToken.js new file mode 100644 index 0000000..8ee153e --- /dev/null +++ b/app/model/BuserToken.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR } = app.Sequelize; + + const BuserToken = app.model.define('buser-token', { + id: { type: INTEGER(8), primaryKey: true, autoIncrement: true }, + user_uid: CHAR(15), + token: CHAR(64), + },{ + freezeTableName: true, + timestamp: false, + createdAt: false, + updatedAt: false, + }); + + return BuserToken; +}; \ No newline at end of file diff --git a/app/model2/BindCSNrecord.js b/app/model2/BindCSNrecord.js new file mode 100644 index 0000000..8d9464b --- /dev/null +++ b/app/model2/BindCSNrecord.js @@ -0,0 +1,20 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, STRING, DATE } = app.Sequelize; + + const BindCSNrecord = app.model2.define('bind-csnrecord', { + id: { type: INTEGER(11), primaryKey: true, autoIncrement: true }, + user_uid: CHAR(15), + sn_number: STRING(8), + type: INTEGER(1), + created_at: DATE, + },{ + freezeTableName: true, + timestamp: true, + createdAt: true, + updatedAt: false, + }); + + return BindCSNrecord; +}; \ No newline at end of file diff --git a/app/model2/BindCrecord.js b/app/model2/BindCrecord.js new file mode 100644 index 0000000..f12dfa3 --- /dev/null +++ b/app/model2/BindCrecord.js @@ -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; +}; \ No newline at end of file diff --git a/app/model2/CSNMsg.js b/app/model2/CSNMsg.js new file mode 100644 index 0000000..768bcb5 --- /dev/null +++ b/app/model2/CSNMsg.js @@ -0,0 +1,21 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, STRING, TEXT, DATE } = app.Sequelize; + + const CSNMsg = app.model2.define('csn-msg', { + id: { type: INTEGER(8), primaryKey: true, autoIncrement: true }, + user_uid: CHAR(15), + sn_number: STRING(8), + original_msg: TEXT, + msg_data: TEXT, + created_at: DATE, + },{ + freezeTableName: true, + timestamp: true, + createdAt: true, + updatedAt: false, + }); + + return CSNMsg; +}; \ No newline at end of file diff --git a/app/model2/CShortMsg.js b/app/model2/CShortMsg.js new file mode 100644 index 0000000..ddc4dc3 --- /dev/null +++ b/app/model2/CShortMsg.js @@ -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; +}; \ No newline at end of file diff --git a/app/model2/CSide.js b/app/model2/CSide.js new file mode 100644 index 0000000..2c433ef --- /dev/null +++ b/app/model2/CSide.js @@ -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: STRING(200), + 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; +}; \ No newline at end of file diff --git a/app/model2/CSubscribe.js b/app/model2/CSubscribe.js new file mode 100644 index 0000000..2b1437f --- /dev/null +++ b/app/model2/CSubscribe.js @@ -0,0 +1,22 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, DATE } = app.Sequelize; + + const CSubscribe = app.model2.define('csubscribe', { + id: { type: INTEGER(11), primaryKey: true, autoIncrement: true }, + user_uid: CHAR(15), + business: INTEGER(3), + status: INTEGER(3), + type: INTEGER(3), + created_at: DATE, + updated_at: DATE, + },{ + freezeTableName: true, + timestamp: true, + createdAt: true, + updatedAt: true, + }); + + return CSubscribe; +}; \ No newline at end of file diff --git a/app/model2/CuserBind.js b/app/model2/CuserBind.js new file mode 100644 index 0000000..dab636a --- /dev/null +++ b/app/model2/CuserBind.js @@ -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; +}; \ No newline at end of file diff --git a/app/model2/CuserSNBind.js b/app/model2/CuserSNBind.js new file mode 100644 index 0000000..a4dbc57 --- /dev/null +++ b/app/model2/CuserSNBind.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, STRING } = app.Sequelize; + + const CuserSNBind = app.model2.define('cuser-snbind', { + id: { type: INTEGER(8), primaryKey: true, autoIncrement: true }, + user_uid: CHAR(15), + sn_number: STRING(8), + },{ + freezeTableName: true, + timestamp: true, + createdAt: false, + updatedAt: false, + }); + + return CuserSNBind; +}; \ No newline at end of file diff --git a/app/model3/BDCard.js b/app/model3/BDCard.js new file mode 100644 index 0000000..414352d --- /dev/null +++ b/app/model3/BDCard.js @@ -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; +}; \ No newline at end of file diff --git a/app/model3/Business.js b/app/model3/Business.js new file mode 100644 index 0000000..375c5b8 --- /dev/null +++ b/app/model3/Business.js @@ -0,0 +1,28 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, STRING, DATE } = app.Sequelize; + + const Business = app.model3.define('business', { + id: { type: INTEGER(3), primaryKey: true, autoIncrement: true }, + salt: CHAR(24), + login_url: STRING(200), + client_url: STRING(200), + temporary_id: CHAR(64), + client_id: CHAR(12), + client_secret: CHAR(64), + name: STRING(30), + type: INTEGER(3), + level: INTEGER(3), + status: INTEGER(3), + created_at: DATE, + updated_at: DATE, + },{ + freezeTableName: true, + timestamp: true, + createdAt: true, + updatedAt: true, + }); + + return Business; +}; \ No newline at end of file diff --git a/app/model3/Insiders.js b/app/model3/Insiders.js new file mode 100644 index 0000000..0ca9bc2 --- /dev/null +++ b/app/model3/Insiders.js @@ -0,0 +1,28 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, STRING, DATE } = app.Sequelize; + + const Insiders = app.model3.define('insiders', { + id: { type: INTEGER(5), primaryKey: true, autoIncrement: true }, + uid: CHAR(15), + salt: CHAR(24), + status: INTEGER(3), + role: INTEGER(3), + name: STRING(20), + password: CHAR(64), + department: STRING(20), + change: STRING(200), + created_at: DATE, + updated_at: DATE, + login_at: DATE, + login_status: INTEGER(3) + },{ + freezeTableName: true, + timestamp: true, + createdAt: true, + updatedAt: true, + }); + + return Insiders; +}; \ No newline at end of file diff --git a/app/model3/Monitoring.js b/app/model3/Monitoring.js new file mode 100644 index 0000000..129bccf --- /dev/null +++ b/app/model3/Monitoring.js @@ -0,0 +1,23 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, DATE } = app.Sequelize; + + const Monitoring = app.model3.define('monitoring', { + id: { type: INTEGER(5), primaryKey: true, autoIncrement: true }, + operate: INTEGER(3), + operate_msg: CHAR(200), + type: INTEGER(3), + status: INTEGER(3), + affect_entries: INTEGER(5), + user: CHAR(15), + created_at: DATE, + },{ + freezeTableName: true, + timestamp: true, + createdAt: true, + updatedAt: false, + }); + + return Monitoring; +}; \ No newline at end of file diff --git a/app/model3/Organization.js b/app/model3/Organization.js new file mode 100644 index 0000000..fc7f194 --- /dev/null +++ b/app/model3/Organization.js @@ -0,0 +1,26 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, STRING, DATE } = app.Sequelize; + + const Organization = app.model3.define('organization', { + id: { type: INTEGER(5), primaryKey: true, autoIncrement: true }, + uid: CHAR(16), + organization_name: STRING(100), + address: STRING(300), + liaison_name: STRING(20), + phone: CHAR(11), + email: STRING(254), + other_information: STRING(200), + post_code: CHAR(6), + created_at: DATE, + updated_at: DATE, + },{ + freezeTableName: true, + timestamp: true, + createdAt: true, + updatedAt: true, + }); + + return Organization; +}; \ No newline at end of file diff --git a/app/model3/SNNumber.js b/app/model3/SNNumber.js new file mode 100644 index 0000000..5298db5 --- /dev/null +++ b/app/model3/SNNumber.js @@ -0,0 +1,20 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, STRING, DATE } = app.Sequelize; + + const SNNumber = app.model3.define('sn-number', { + id: { type: INTEGER(8), primaryKey: true, autoIncrement: true }, + sn_number: STRING(8), + status: INTEGER(3), + created_at: DATE, + updated_at: DATE, + },{ + freezeTableName: true, + timestamp: true, + createdAt: true, + updatedAt: true, + }); + + return SNNumber; +}; \ No newline at end of file diff --git a/app/model4/Account.js b/app/model4/Account.js new file mode 100644 index 0000000..6cae864 --- /dev/null +++ b/app/model4/Account.js @@ -0,0 +1,24 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, 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: CHAR(20), + password: CHAR(64), + status: INTEGER(3), + created_at: DATE, + login_status: INTEGER(3), + },{ + freezeTableName: true, + timestamp: true, + createdAt: true, + updatedAt: false, + }); + + return Account; +}; \ No newline at end of file diff --git a/app/model4/ChoiceTopic.js b/app/model4/ChoiceTopic.js new file mode 100644 index 0000000..ef6d89b --- /dev/null +++ b/app/model4/ChoiceTopic.js @@ -0,0 +1,22 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR } = app.Sequelize; + + const ChoiceTopic = app.model4.define('choice-topic', { + id: { type: INTEGER(8), primaryKey: true, autoIncrement: true }, + topic: CHAR(300), + options_a: CHAR(300), + options_b: CHAR(300), + options_c: CHAR(300), + options_d: CHAR(300), + answer: CHAR(300), + },{ + freezeTableName: true, + timestamp: false, + createdAt: false, + updatedAt: false, + }); + + return ChoiceTopic; +}; \ No newline at end of file diff --git a/app/model4/Contest.js b/app/model4/Contest.js new file mode 100644 index 0000000..5736f72 --- /dev/null +++ b/app/model4/Contest.js @@ -0,0 +1,29 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, DATE } = app.Sequelize; + + const Contest = app.model4.define('contest', { + id: { type: INTEGER(8), primaryKey: true, autoIncrement: true }, + uid: CHAR(15), + contest_name: CHAR(50), + contest_organizers: CHAR(50), + contest_term: CHAR(5), + type: INTEGER(3), + status: INTEGER(3), + online_start: DATE, + online_end: DATE, + offline_start: DATE, + offline_end: DATE, + contest_start: DATE, + contest_end: DATE, + created_at: DATE, + },{ + freezeTableName: true, + timestamp: true, + createdAt: true, + updatedAt: false, + }); + + return Contest; +}; \ No newline at end of file diff --git a/app/model4/Examination.js b/app/model4/Examination.js new file mode 100644 index 0000000..2b6a4cf --- /dev/null +++ b/app/model4/Examination.js @@ -0,0 +1,34 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, STRING, DATE } = app.Sequelize; + + const Examination = app.model4.define('examination', { + id: { type: INTEGER(8), primaryKey: true, autoIncrement: true }, + user_uid: CHAR(15), + contest_uid: CHAR(15), + exam_type: INTEGER(3), + topic_type: INTEGER(3), + topic1: CHAR(2), + topic2: CHAR(2), + topic3: CHAR(50), + topic5: CHAR(10), + answer: STRING(20), + answer1: CHAR(2), + answer2: CHAR(2), + answer3: CHAR(10), + answer4: CHAR(20), + answer5: CHAR(10), + score: INTEGER(3), + score_collection: CHAR(9), + created_at: DATE, + updated_at: DATE, + },{ + freezeTableName: true, + timestamp: true, + createdAt: true, + updatedAt: true, + }); + + return Examination; +}; \ No newline at end of file diff --git a/app/model4/TSNMsg.js b/app/model4/TSNMsg.js new file mode 100644 index 0000000..1458bc1 --- /dev/null +++ b/app/model4/TSNMsg.js @@ -0,0 +1,21 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, STRING, TEXT, DATE } = app.Sequelize; + + const TSNMsg = app.model4.define('tsn-msg', { + id: { type: INTEGER(8), primaryKey: true, autoIncrement: true }, + user_uid: CHAR(15), + sn_number: STRING(8), + original_msg: TEXT, + msg_data: TEXT, + created_at: DATE, + },{ + freezeTableName: true, + timestamp: true, + createdAt: true, + updatedAt: false, + }); + + return TSNMsg; +}; \ No newline at end of file diff --git a/app/model4/TShortMsg.js b/app/model4/TShortMsg.js new file mode 100644 index 0000000..ae1d7a7 --- /dev/null +++ b/app/model4/TShortMsg.js @@ -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; +}; \ No newline at end of file diff --git a/app/model4/TuserBind.js b/app/model4/TuserBind.js new file mode 100644 index 0000000..97a9f1c --- /dev/null +++ b/app/model4/TuserBind.js @@ -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; +}; \ No newline at end of file diff --git a/app/model4/TuserSNBind.js b/app/model4/TuserSNBind.js new file mode 100644 index 0000000..5e672ba --- /dev/null +++ b/app/model4/TuserSNBind.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, STRING } = app.Sequelize; + + const TuserSNBind = app.model4.define('tuser-snbind', { + id: { type: INTEGER(8), primaryKey: true, autoIncrement: true }, + user_uid: CHAR(15), + sn_number: STRING(8), + },{ + freezeTableName: true, + timestamp: true, + createdAt: false, + updatedAt: false, + }); + + return TuserSNBind; +}; \ No newline at end of file diff --git a/app/router.js b/app/router.js new file mode 100644 index 0000000..1014526 --- /dev/null +++ b/app/router.js @@ -0,0 +1,145 @@ +/** + * @param {Egg.Application} app - egg application + */ +module.exports = app => { + const { router, controller } = app; + router.get('/main', controller.home.main); + router.get('/home', controller.home.home); + router.get('/main/home', controller.home.index); + + // 注册北斗卡 + router.post("/addBdCard", controller.bdCard.addBdCard); + // 查看北斗卡 + router.post("/showBdCard", controller.bdCard.showBdCard); + // 编辑北斗卡 + router.post("/editBdCard", controller.bdCard.editBdCard); + // 删除北斗卡 + router.post("/deleteBdCard", controller.bdCard.deleteBdCard); + + // 查看绑定记录 + router.post("/showBindRecord", controller.bindRecord.showBindRecord); + // 删除绑定记录 + router.post("/deleteBindRecord", controller.bindRecord.deleteBindRecord); + + // 注册公司业务 + router.post("/addBusiness", controller.business.addBusiness); + // 查看公司业务 + router.post("/showBusiness", controller.business.showBusiness); + // 远程搜索公司业务 + router.post("/SearchBusiness", controller.business.SearchBusiness); + // 编辑公司业务 + router.post("/editBusiness", controller.business.editBusiness); + // 删除公司业务 + router.post("/deleteBusiness", controller.business.deleteBusiness); + + // 注册B端用户 + router.post("/addBSide", controller.bSide.addBSide); + // 查看B端用户 + router.post("/showBSide", controller.bSide.showBSide); + // 编辑B端用户 + router.post("/editBSide", controller.bSide.editBSide); + // 删除B端用户 + router.post("/deleteBSide", controller.bSide.deleteBSide); + + // 查看C端用户 + router.post("/showCSide", controller.cSide.showCSide); + // 编辑C端用户 + router.post("/editCSide", controller.cSide.editCSide); + // 删除C端用户 + router.post("/deleteCSide", controller.cSide.deleteCSide); + + // 注册管理系统用户 + router.post("/addInsiders", controller.insiders.addInsiders); + // 查看管理系统用户 + router.post("/showInsiders", controller.insiders.showInsiders); + // 编辑管理系统用户 + router.post("/editInsiders", controller.insiders.editInsiders); + // 删除管理系统用户 + router.post("/deleteInsiders", controller.insiders.deleteInsiders); + + // 注册B端用户单位 + router.post("/addOrganization", controller.organization.addOrganization); + // 查看B端用户单位 + router.post("/showOrganization", controller.organization.showOrganization); + // 远程搜索B端用户单位 + router.post("/SearchOrganization", controller.organization.SearchOrganization); + // 编辑B端用户单位 + router.post("/editOrganization", controller.organization.editOrganization); + // 删除B端用户单位 + router.post("/deleteOrganization", controller.organization.deleteOrganization); + + // 查看监控记录 + router.post("/showMonitoring", controller.monitoring.showMonitoring); + // 删除监控记录 + router.post("/deleteMonitoring", controller.monitoring.deleteMonitoring); + + // 管理系统检索竞赛 uid + router.post("/searchContestUid", controller.contestMsg.searchContestUid); + // 管理系统创建竞赛信息 + router.post("/addContest", controller.contestMsg.addContest); + // 管理系统查看竞赛信息 + router.post("/showContest", controller.contestMsg.showContest); + // 管理系统编辑竞赛信息 + router.post("/editContest", controller.contestMsg.editContest); + // 管理系统删除竞赛信息 + router.post("/delContest", controller.contestMsg.delContest); + + // 管理系统导入选择题 + router.post("/importChoiceTopic", controller.contestTopic.importChoiceTopic); + // 管理系统创建选择题 + router.post("/addChoiceTopic", controller.contestTopic.addChoiceTopic); + // 管理系统查看选择题 + router.post("/showChoiceTopic", controller.contestTopic.showChoiceTopic); + // 管理系统编辑选择题 + router.post("/editChoiceTopic", controller.contestTopic.editChoiceTopic); + // 管理系统删除选择题 + router.post("/delChoiceTopic", controller.contestTopic.delChoiceTopic); + + // 管理系统导入竞赛账号信息 + router.post("/importAccount", controller.contestAccount.importAccount); + // 管理系统创建竞赛账号信息 + router.post("/addAccount", controller.contestAccount.addAccount); + // 管理系统查看竞赛账号信息 + router.post("/showAccount", controller.contestAccount.showAccount); + // 管理系统编辑竞赛账号信息 + router.post("/editAccount", controller.contestAccount.editAccount); + // 管理系统删除竞赛账号信息 + router.post("/delAccount", controller.contestAccount.delAccount); + + // 管理系统重置竞赛账号密码 + router.post("/resetAccount", controller.contestAccount.resetAccount); + + // 管理系统查看账号答题情况 + router.post("/showExamination", controller.contestExamination.showExamination); + // 管理系统编辑账号答题情况 + router.post("/editExamination", controller.contestExamination.editExamination); + // 管理系统删除账号答题情况 + router.post("/delExamination", controller.contestExamination.delExamination); + // 管理系统导出账号答题情况 + router.post("/downloadExamination", controller.contestExamination.downloadExamination); + + // 注册SN号 + router.post("/addSN", controller.sn.addSN); + // 查看SN号 + router.post("/showSN", controller.sn.showSN); + // 编辑SN号 + router.post("/editSN", controller.sn.editSN); + // 删除SN号 + router.post("/deleteSN", controller.sn.deleteSN); + + // 查看SN号绑定记录 + router.post("/showBindSNRecord", controller.bindSNRecord.showBindSNRecord); + // 删除SN号绑定记录 + router.post("/deleteBindSNRecord", controller.bindSNRecord.deleteBindSNRecord); + + // 搜索可分配的SN号 + router.get("/searchAllocationSN", controller.sNAdmin.searchAllocationSN); + // 搜索可分配的单位用户 + router.get("/searchAllocationUser", controller.sNAdmin.searchAllocationUser); + // B端分配SN号 + router.post("/allocationSN", controller.sNAdmin.allocationSN); + // 查看B端SN号分配记录 + router.post("/showAllocationSNRecord", controller.sNAdmin.showAllocationSNRecord); + // 删除B端SN号分配记录 + router.post("/deleteAllocationSNRecord", controller.sNAdmin.deleteAllocationSNRecord); +}; diff --git a/app/service/BSide.js b/app/service/BSide.js new file mode 100644 index 0000000..e07921a --- /dev/null +++ b/app/service/BSide.js @@ -0,0 +1,173 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fileName = "BSide"; + +class BSideService extends Service { + // 注册B端用户 + async addBSide(form) { + const { ctx } = this; + try { + const result = await ctx.model.BSide.bulkCreate(form); + return result.length == 0 ? false : true; + } catch (error) { + const blockName = fileName + "--" + "addBSide"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 查看B端用户 + async showBSide(body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['status', 'role', 'account_name', 'organization', 'user_name', 'phone', 'msg', 'created_at', 'updated_at', 'login_at', 'login_status'], + where = {}, order = [], dbOptions, + joinSubstring = ['organization'], + substring = ['account_name', 'user_name', 'phone', 'msg'], + key = ['status', 'role', 'login_status'], + between = ['created_at', 'updated_at', 'login_at']; + const Organization = await ctx.model3.Organization.findAll({ attributes: ['uid', 'organization_name'] }); + attributes.forEach(element => { + if (searchOptions[element]) { + if (searchOptions[element] == '*空') { + if (joinSubstring.includes(element)) { + where[element] = null; + } else { + where[element] = [null, '']; + } + } else if (joinSubstring.includes(element)) { + let targetKeyArr = []; + Organization.forEach(item => { + if (item.dataValues.organization_name.includes(searchOptions[element])) { + targetKeyArr.push(item.dataValues.uid); + } + }); + where[element] = targetKeyArr.length > 0 ? targetKeyArr : 'null'; + } else 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] == true) { + order.push([element, 'ASC']); + } else if (sortOptions[element] == false) { + order.push([element, 'DESC']); + } + }); + dbOptions = { attributes, offset, limit, where, order }; + const result = await ctx.model.BSide.findAndCountAll(dbOptions); + result.rows.forEach(element => { + if (element.dataValues.organization !== null) { + element.dataValues.organization = Organization.find(item => item.dataValues.uid == element.dataValues.organization).dataValues.organization_name; + } + }); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showBSide"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 编辑B端用户 + async editBSide(uid, modelType, updateMsg, requestMsg) { + const { ctx } = this; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.role < 6) return false; + const Organization = await ctx.model3.Organization.findAll({ attributes: ['uid', 'organization_name'] }); + let where = {}; + if (modelType == "single") { + let { account_name, organization } = requestMsg; + if (organization !== null) { + organization = Organization.find(item => item.dataValues.organization_name == organization).dataValues.uid; + } + where = { account_name, organization }; + } else if (modelType == "multiple") { + let account_name = [], organization_name = [], organization = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + account_name.push(element.account_name); + organization_name.push(element.organization); + }); + } + organization_name.forEach(element => { + if (element !== null) { + organization.push(Organization.find(item => item.dataValues.organization_name == element).dataValues.uid); + } + }); + where = { account_name, organization }; + if (where.organization.length == 0) { + delete where.organization; + } + } + updateMsg.updated_at = new Date(); + const resultList = await ctx.model.BSide.update(updateMsg, { where }); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + const blockName = fileName + "--" + "editBSide"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 删除B端用户 + async deleteBSide(uid, modelType, password, requestMsg) { + const { ctx } = this; + const systemMonitoring = { + operate: 2, + operate_msg: '删除B端用户', + type: 0, + status: 0, + affect_entries: 0, + user: uid, + created_at: new Date() + }; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 6) { + if (!result) systemMonitoring.status = 0; + else if (result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt))) systemMonitoring.status = 1; + else if (result.dataValues.role < 6) systemMonitoring.status = 2; + await ctx.model3.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { account_name, organization } = requestMsg; + where = { account_name, organization }; + } else if (modelType == "multiple") { + let account_name = [], organization = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + account_name.push(element.account_name), + organization.push(element.organization) + }); + } + where = { account_name, organization }; + } + const resultList = await ctx.model.BSide.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model3.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model3.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "deleteBSide"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = BSideService; \ No newline at end of file diff --git a/app/service/BdCard.js b/app/service/BdCard.js new file mode 100644 index 0000000..c52bab7 --- /dev/null +++ b/app/service/BdCard.js @@ -0,0 +1,225 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fileName = "BdCard"; + +class BdCardService extends Service { + // 注册北斗卡 + async addBdCard(form) { + const { ctx } = this; + try { + const result = await ctx.model3.BDCard.bulkCreate(form); + return result.length == 0 ? false : true; + } catch (error) { + const blockName = fileName + "--" + "addBdCard"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 查看北斗卡 + async showBdCard(body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['card_id', 'card_imsi', 'type', 'status', 'created_at', 'updated_at'], + where = {}, order = [], dbOptions, joinSubstring = [], + substring = ['card_id', 'card_imsi'], key = ['type', 'status'], between = ['created_at', 'updated_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]; + } 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']); + } + }); + const [bside, cside, contest, bsideBind, csideBind, contestBind ] = await Promise.all([ + ctx.model.BSide.findAll({ attributes: ['uid', 'account_name'] }), + ctx.model2.CSide.findAll({ attributes: ['uid', 'account_name'] }), + ctx.model4.Account.findAll({ attributes: ['uid', 'account_name'] }), + ctx.model.BuserBind.findAll({ attributes: ['user_uid', 'card_id'] }), + ctx.model2.CuserBind.findAll({ attributes: ['user_uid', 'card_id'] }), + ctx.model4.TuserBind.findAll({ attributes: ['user_uid', 'card_id'] }) + ]); + if (searchOptions.account_name) { + if (searchOptions.account_name == '*空') { + if (where.status == '1' || where.status == '2' || where.status == '3') { + where.status = null; + } else if (where.status == undefined) { + where.status = 0; + } + } else { + let cardArr = []; + if (where.status == '1' || where.status == undefined) { + bside.filter(item => { + if (item.dataValues.account_name.includes(searchOptions.account_name)) { + bsideBind.filter(item2 => { + if (item2.dataValues.user_uid == item.dataValues.uid) { + cardArr.push(item2.dataValues.card_id); + } + }); + } + }); + } + if (where.status == '2' || where.status == undefined) { + cside.filter(item => { + if (item.dataValues.account_name.includes(searchOptions.account_name)) { + csideBind.filter(item2 => { + if (item2.dataValues.user_uid == item.dataValues.uid) { + cardArr.push(item2.dataValues.card_id); + } + }); + } + }); + } + if (where.status == '3' || where.status == undefined) { + contest.filter(item => { + if (item.dataValues.account_name.includes(searchOptions.account_name)) { + contestBind.filter(item2 => { + if (item2.dataValues.user_uid == item.dataValues.uid) { + cardArr.push(item2.dataValues.card_id); + } + }); + } + }); + } + where.card_id = [...cardArr]; + } + } + dbOptions = { attributes, offset, limit, where, order }; + const result = await ctx.model3.BDCard.findAndCountAll(dbOptions); + result.rows.forEach(element => { + element.dataValues.account_name = ''; + bsideBind.filter(item => { + if (item.dataValues.card_id == element.dataValues.card_id) { + bside.filter(item2 => { + if (item2.dataValues.uid == item.dataValues.user_uid) { + element.dataValues.account_name = item2.dataValues.account_name; + } + }); + } + }); + csideBind.filter(item => { + if (item.dataValues.card_id == element.dataValues.card_id) { + cside.filter(item2 => { + if (item2.dataValues.uid == item.dataValues.user_uid) { + element.dataValues.account_name = item2.dataValues.account_name; + } + }); + } + }); + contestBind.filter(item => { + if (item.dataValues.card_id == element.dataValues.card_id) { + contest.filter(item2 => { + if (item2.dataValues.uid == item.dataValues.user_uid) { + element.dataValues.account_name = item2.dataValues.account_name; + } + }); + } + }); + }); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showBdCard"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 编辑北斗卡 + async editBdCard(uid, modelType, password, updateMsg, requestMsg) { + const { ctx } = this; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 6) return false; + let where = {}; + if (modelType == "single") { + where = requestMsg; + } else if (modelType == "multiple") { + let card_id = [], card_imsi = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + card_id.push(element.card_id); + card_imsi.push(element.card_imsi); + }); + } + where = { card_id, card_imsi }; + } + updateMsg.updated_at = new Date(); + const resultList = await ctx.model3.BDCard.update(updateMsg, { where }); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + const blockName = fileName + "--" + "editBdCard"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 删除北斗卡 + async deleteBdCard(uid, modelType, password, requestMsg) { + const { ctx } = this; + const systemMonitoring = { + operate: 2, + operate_msg: '删除北斗卡', + type: 0, + status: 0, + affect_entries: 0, + user: uid, + created_at: new Date() + }; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 6) { + if (!result) systemMonitoring.status = 0; + else if (result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt))) systemMonitoring.status = 1; + else if (result.dataValues.role < 6) systemMonitoring.status = 2; + await ctx.model3.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + where = requestMsg; + } else if (modelType == "multiple") { + let card_id = [], card_imsi = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + card_id.push(element.card_id), + card_imsi.push(element.card_imsi) + }); + } + where = { card_id, card_imsi }; + } + const resultList = await ctx.model3.BDCard.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model3.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model3.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "deleteBdCard"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = BdCardService; \ No newline at end of file diff --git a/app/service/BindRecord.js b/app/service/BindRecord.js new file mode 100644 index 0000000..bc71540 --- /dev/null +++ b/app/service/BindRecord.js @@ -0,0 +1,179 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fileName = "BindRecord"; + +class BindRecordService extends Service { + // 查看北斗卡绑定记录 + async showBindRecord(body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['user_uid', 'card_id', 'type', 'created_at'], + where = {}, order = [], dbOptions, joinSubstring = [], + substring = ['user_uid', 'card_id'], + key = ['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]; + } 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']); + } + }); + const [bside, cside, bsideRecord, csideRecord] = await Promise.all([ + ctx.model.BSide.findAll({ attributes: ['uid', 'account_name'] }), + ctx.model2.CSide.findAll({ attributes: ['uid', 'account_name'] }), + ctx.model.BindBrecord.findAll({ attributes: ['user_uid', 'card_id', 'created_at'] }), + ctx.model2.BindCrecord.findAll({ attributes: ['user_uid', 'card_id', 'created_at'] }) + ]); + if (searchOptions.account_name) { + if (searchOptions.account_name == '*空') { + where.user_uid = [null, '']; + } else { + let userArr = [], cardArr = [], createdArr = []; + bside.filter(item => { + if (item.dataValues.account_name.includes(searchOptions.account_name)) { + bsideRecord.filter(item2 => { + if (item2.dataValues.user_uid == item.dataValues.uid) { + userArr.push(item2.dataValues.user_uid); + cardArr.push(item2.dataValues.card_id); + createdArr.push(item2.dataValues.created_at); + } + }); + } + }); + cside.filter(item => { + if (item.dataValues.account_name.includes(searchOptions.account_name)) { + csideRecord.filter(item2 => { + if (item2.dataValues.user_uid == item.dataValues.uid) { + userArr.push(item2.dataValues.user_uid); + cardArr.push(item2.dataValues.card_id); + createdArr.push(item2.dataValues.created_at); + } + }); + } + }); + where.user_uid = [...userArr]; + where.card_id = [...cardArr]; + where.created_at = [...createdArr]; + } + } + dbOptions = { attributes, offset, limit, where, order }; + let result; + if (searchOptions.side !== undefined && searchOptions.side !== '') { + if (searchOptions.side == '0') { + result = await ctx.model.BindBrecord.findAndCountAll(dbOptions); + } else if (searchOptions.side == '1') { + result = await ctx.model2.BindCrecord.findAndCountAll(dbOptions); + } + } else { + dbOptions.limit = Math.floor(limit / 2); + dbOptions.offset = Math.floor(offset / 2); + const [bresult, cresult] = await Promise.all([ + ctx.model.BindBrecord.findAndCountAll(dbOptions), + ctx.model2.BindCrecord.findAndCountAll(dbOptions) + ]); + result = { + count: bresult.count + cresult.count, + rows: bresult.rows.concat(cresult.rows) + }; + result.rows.sort((a, b) => b.dataValues.created_at - a.dataValues.created_at); + } + result.rows.forEach(element => { + element.dataValues.account_name = ''; + element.dataValues.side = element.dataValues.user_uid[element.dataValues.user_uid.length - 1] == 'B' ? '0' : '1'; + bside.filter(item => { + if (item.dataValues.uid == element.dataValues.user_uid) { + element.dataValues.account_name = item.dataValues.account_name; + } else { + cside.filter(item2 => { + if (item2.dataValues.uid == element.dataValues.user_uid) { + element.dataValues.account_name = item2.dataValues.account_name; + } + }); + } + }); + }); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showBindRecord"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 删除北斗卡绑定记录 + async deleteBindRecord(uid, modelType, password, requestMsg) { + const { ctx } = this; + const systemBindRecord = { + operate: 2, + operate_msg: '删除北斗卡绑定记录', + type: 1, + status: 0, + affect_entries: 0, + user: uid, + created_at: new Date() + }; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 9) { + if (!result) systemBindRecord.status = 0; + else if (result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt))) systemBindRecord.status = 1; + else if (result.dataValues.role < 9) systemBindRecord.status = 2; + await ctx.model3.Monitoring.create(systemBindRecord); + return false; + }; + let where = {}; + if (modelType == "single") { + const { card_id, type, created_at } = requestMsg; + where = { card_id, type, created_at }; + } else if (modelType == "multiple") { + let card_id = [], type = [], created_at = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + card_id.push(element.card_id), + type.push(element.type), + created_at.push(element.created_at) + }); + } + where = { card_id, type, created_at }; + } + const [bresultList, cresultList] = await Promise.all([ + ctx.model.BindBrecord.destroy({ where }), + ctx.model2.BindCrecord.destroy({ where }) + ]); + systemBindRecord.status = bresultList + cresultList == 0 ? 3 : 4; + systemBindRecord.affect_entries = bresultList + cresultList; + await ctx.model3.Monitoring.create(systemBindRecord); + return bresultList + cresultList == 0 ? false : true; + } catch (error) { + systemBindRecord.status = 5; + await ctx.model3.Monitoring.create(systemBindRecord); + const blockName = fileName + "--" + "deleteBindRecord"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = BindRecordService; \ No newline at end of file diff --git a/app/service/BindSNRecord.js b/app/service/BindSNRecord.js new file mode 100644 index 0000000..d30d953 --- /dev/null +++ b/app/service/BindSNRecord.js @@ -0,0 +1,179 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fileName = "BindSNRecord"; + +class BindSNRecordService extends Service { + // 查看SN号绑定记录 + async showBindSNRecord(body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['user_uid', 'sn_number', 'type', 'created_at'], + where = {}, order = [], dbOptions, joinSubstring = [], + substring = ['user_uid', 'sn_number'], + key = ['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]; + } 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']); + } + }); + const [bside, cside, bsideRecord, csideRecord] = await Promise.all([ + ctx.model.BSide.findAll({ attributes: ['uid', 'account_name'] }), + ctx.model2.CSide.findAll({ attributes: ['uid', 'account_name'] }), + ctx.model.BindBSNrecord.findAll({ attributes: ['user_uid', 'sn_number', 'created_at'] }), + ctx.model2.BindCSNrecord.findAll({ attributes: ['user_uid', 'sn_number', 'created_at'] }) + ]); + if (searchOptions.account_name) { + if (searchOptions.account_name == '*空') { + where.user_uid = [null, '']; + } else { + let userArr = [], SNArr = [], createdArr = []; + bside.filter(item => { + if (item.dataValues.account_name.includes(searchOptions.account_name)) { + bsideRecord.filter(item2 => { + if (item2.dataValues.user_uid == item.dataValues.uid) { + userArr.push(item2.dataValues.user_uid); + SNArr.push(item2.dataValues.sn_number); + createdArr.push(item2.dataValues.created_at); + } + }); + } + }); + cside.filter(item => { + if (item.dataValues.account_name.includes(searchOptions.account_name)) { + csideRecord.filter(item2 => { + if (item2.dataValues.user_uid == item.dataValues.uid) { + userArr.push(item2.dataValues.user_uid); + SNArr.push(item2.dataValues.sn_number); + createdArr.push(item2.dataValues.created_at); + } + }); + } + }); + where.user_uid = [...userArr]; + where.sn_number = [...SNArr]; + where.created_at = [...createdArr]; + } + } + dbOptions = { attributes, offset, limit, where, order }; + let result; + if (searchOptions.side !== undefined && searchOptions.side !== '') { + if (searchOptions.side == '0') { + result = await ctx.model.BindBSNrecord.findAndCountAll(dbOptions); + } else if (searchOptions.side == '1') { + result = await ctx.model2.BindCSNrecord.findAndCountAll(dbOptions); + } + } else { + dbOptions.limit = Math.floor(limit / 2); + dbOptions.offset = Math.floor(offset / 2); + const [bresult, cresult] = await Promise.all([ + ctx.model.BindBSNrecord.findAndCountAll(dbOptions), + ctx.model2.BindCSNrecord.findAndCountAll(dbOptions) + ]); + result = { + count: bresult.count + cresult.count, + rows: bresult.rows.concat(cresult.rows) + }; + result.rows.sort((a, b) => b.dataValues.created_at - a.dataValues.created_at); + } + result.rows.forEach(element => { + element.dataValues.account_name = ''; + element.dataValues.side = element.dataValues.user_uid[element.dataValues.user_uid.length - 1] == 'B' ? '0' : '1'; + bside.filter(item => { + if (item.dataValues.uid == element.dataValues.user_uid) { + element.dataValues.account_name = item.dataValues.account_name; + } else { + cside.filter(item2 => { + if (item2.dataValues.uid == element.dataValues.user_uid) { + element.dataValues.account_name = item2.dataValues.account_name; + } + }); + } + }); + }); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showBindSNRecord"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 删除SN号绑定记录 + async deleteBindSNRecord(uid, modelType, password, requestMsg) { + const { ctx } = this; + const systemBindSNRecord = { + operate: 2, + operate_msg: '删除SN号绑定记录', + type: 1, + status: 0, + affect_entries: 0, + user: uid, + created_at: new Date() + }; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 9) { + if (!result) systemBindSNRecord.status = 0; + else if (result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt))) systemBindSNRecord.status = 1; + else if (result.dataValues.role < 9) systemBindSNRecord.status = 2; + await ctx.model3.Monitoring.create(systemBindSNRecord); + return false; + }; + let where = {}; + if (modelType == "single") { + const { sn_number, type, created_at } = requestMsg; + where = { sn_number, type, created_at }; + } else if (modelType == "multiple") { + let sn_number = [], type = [], created_at = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + sn_number.push(element.sn_number), + type.push(element.type), + created_at.push(element.created_at) + }); + } + where = { sn_number, type, created_at }; + } + const [bresultList, cresultList] = await Promise.all([ + ctx.model.BindBSNrecord.destroy({ where }), + ctx.model2.BindCSNrecord.destroy({ where }) + ]); + systemBindSNRecord.status = bresultList + cresultList == 0 ? 3 : 4; + systemBindSNRecord.affect_entries = bresultList + cresultList; + await ctx.model3.Monitoring.create(systemBindSNRecord); + return bresultList + cresultList == 0 ? false : true; + } catch (error) { + systemBindSNRecord.status = 5; + await ctx.model3.Monitoring.create(systemBindSNRecord); + const blockName = fileName + "--" + "deleteBindSNRecord"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = BindSNRecordService; \ No newline at end of file diff --git a/app/service/Business.js b/app/service/Business.js new file mode 100644 index 0000000..3592960 --- /dev/null +++ b/app/service/Business.js @@ -0,0 +1,211 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fileName = "Business"; + +class BusinessService extends Service { + // 注册公司业务 + async addBusiness(uid, form) { + const { ctx } = this; + const systemMonitoring = { + operate: 0, + operate_msg: '注册公司业务', + type: 1, + status: 0, + affect_entries: 0, + user: uid, + created_at: new Date() + }; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.role < 9) { + if (!result) systemMonitoring.status = 0; + else if (result.dataValues.role < 9) systemMonitoring.status = 2; + await ctx.model3.Monitoring.create(systemMonitoring); + return false; + }; + const resultList = await ctx.model3.Business.bulkCreate(form); + systemMonitoring.status = resultList.length == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList.length; + await ctx.model3.Monitoring.create(systemMonitoring); + return resultList.length == 0 ? false : true; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model3.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "addBusiness"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 查看公司业务 + async showBusiness(body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['salt', 'login_url', 'client_url', 'temporary_id', 'client_id', 'client_secret', 'name', 'type', 'level', 'status', 'created_at', 'updated_at'], + where = {}, order = [], dbOptions, joinSubstring = [], + substring = ['login_url', 'client_url', 'client_id', 'name'], key = ['type', 'level', 'status'], between = ['created_at', 'updated_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]; + } 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 result = await ctx.model3.Business.findAndCountAll(dbOptions); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showBusiness"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + //远程搜索公司业务 + async SearchBusiness(body) { + const { ctx } = this; + try { + let { query, key, timeBefor } = body; + let attributes = ['temporary_id', 'name', 'created_at'], where = {}, dbOptions; + if (query == '*空') { + delete where[key] + } else { + where[key] = { [Op.substring]: query }; + } + where.created_at = { [Op.lt]: timeBefor }; + dbOptions = { attributes, where }; + const Business = await ctx.model3.Business.findAll(dbOptions); + return Business.length == 0 ? false : Business; + } catch (error) { + const blockName = fileName + "--" + "SearchBusiness"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 编辑公司业务 + async editBusiness(uid, modelType, password, updateMsg, requestMsg) { + const { ctx } = this; + const systemMonitoring = { + operate: 1, + operate_msg: '编辑公司业务', + type: 1, + status: 0, + affect_entries: 0, + user: uid, + created_at: new Date() + }; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 9) { + if (!result) systemMonitoring.status = 0; + else if (result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt))) systemMonitoring.status = 1; + else if (result.dataValues.role < 9) systemMonitoring.status = 2; + await ctx.model3.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { temporary_id, client_id, client_secret, name } = requestMsg; + where = { temporary_id, client_id, client_secret, name }; + } else if (modelType == "multiple") { + let temporary_id = [], client_id = [], client_secret = [], name = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + temporary_id.push(element.temporary_id), + client_id.push(element.client_id), + client_secret.push(element.client_secret), + name.push(element.name) + }); + } + where = { temporary_id, client_id, client_secret, name }; + } + updateMsg.updated_at = new Date(); + const resultList = await ctx.model3.Business.update(updateMsg, { where }); + systemMonitoring.status = resultList[0] == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList[0]; + await ctx.model3.Monitoring.create(systemMonitoring); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model3.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "editBusiness"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 删除公司业务 + async deleteBusiness(uid, modelType, password, requestMsg) { + const { ctx } = this; + const systemMonitoring = { + operate: 2, + operate_msg: '删除公司业务', + type: 2, + status: 0, + affect_entries: 0, + user: uid, + created_at: new Date() + }; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 9) { + if (!result) systemMonitoring.status = 0; + else if (result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt))) systemMonitoring.status = 1; + else if (result.dataValues.role < 9) systemMonitoring.status = 2; + await ctx.model3.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { temporary_id, client_id, client_secret, name } = requestMsg; + where = { temporary_id, client_id, client_secret, name }; + } else if (modelType == "multiple") { + let temporary_id = [], client_id = [], client_secret = [], name = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + temporary_id.push(element.temporary_id), + client_id.push(element.client_id), + client_secret.push(element.client_secret), + name.push(element.name) + }); + } + where = { temporary_id, client_id, client_secret, name }; + } + const resultList = await ctx.model3.Business.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model3.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model3.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "deleteBusiness"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = BusinessService; \ No newline at end of file diff --git a/app/service/CSide.js b/app/service/CSide.js new file mode 100644 index 0000000..4fc12b8 --- /dev/null +++ b/app/service/CSide.js @@ -0,0 +1,133 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fileName = "CSide"; + +class CSideService extends Service { + // 查看C端用户 + async showCSide(body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['status', 'role', 'account_name', 'user_name', 'phone', 'gender', 'age', 'email', 'address', 'post_code', 'created_at', 'updated_at', 'login_at', 'login_status'], + where = {}, order = [], dbOptions, joinSubstring = [], + substring = ['account_name', 'user_name', 'phone', 'email', 'address', 'post_code'], + key = ['status', 'role', 'gender', 'age', 'login_status'], + between = ['created_at', 'updated_at', 'login_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]; + } 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 result = await ctx.model2.CSide.findAndCountAll(dbOptions); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showCSide"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 编辑C端用户 + async editCSide(uid, modelType, updateMsg, requestMsg) { + const { ctx } = this; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.role < 6) return false; + let where = {}; + if (modelType == "single") { + const { account_name, phone } = requestMsg; + where = { account_name, phone }; + } else if (modelType == "multiple") { + let account_name = [], phone = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + account_name.push(element.account_name), + phone.push(element.phone) + }); + } + where = { account_name, phone }; + } + updateMsg.updated_at = new Date(); + const resultList = await ctx.model2.CSide.update(updateMsg, { where }); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + const blockName = fileName + "--" + "editCSide"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 删除C端用户 + async deleteCSide(uid, modelType, password, requestMsg) { + const { ctx } = this; + const systemMonitoring = { + operate: 2, + operate_msg: '删除C端用户', + type: 0, + status: 0, + affect_entries: 0, + user: uid, + created_at: new Date() + }; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 6) { + if (!result) systemMonitoring.status = 0; + else if (result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt))) systemMonitoring.status = 1; + else if (result.dataValues.role < 6) systemMonitoring.status = 2; + await ctx.model3.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { account_name, phone } = requestMsg; + where = { account_name, phone }; + } else if (modelType == "multiple") { + let account_name = [], phone = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + account_name.push(element.account_name), + phone.push(element.phone) + }); + } + where = { account_name, phone }; + } + const resultList = await ctx.model2.CSide.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model3.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model3.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "deleteCSide"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = CSideService; \ No newline at end of file diff --git a/app/service/ContestAccount.js b/app/service/ContestAccount.js new file mode 100644 index 0000000..74726db --- /dev/null +++ b/app/service/ContestAccount.js @@ -0,0 +1,200 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fileName = "ContestAccount"; + +class ContestAccountService extends Service { + // 管理系统导入报名账号信息 + async importAccount(form) { + const { ctx } = this; + try { + const result = await ctx.model4.Account.bulkCreate(form); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "importAccount"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统创建竞赛账号信息 + async addAccount(form) { + const { ctx } = this; + try { + const result = await ctx.model4.Account.bulkCreate(form); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "addAccount"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统查看竞赛账号信息 + async showAccount(body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['uid', 'contest_uid', 'account_name', 'status', 'created_at', 'login_status'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['uid', 'contest_uid', 'account_name'], + key = ['status', 'login_status'], + 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 (joinSubstring.includes(element)) { + let targetKeyArr = []; + where[element] = targetKeyArr.length > 0 ? targetKeyArr : 'null'; + } else 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] == true) { + order.push([element, 'ASC']); + } else if (sortOptions[element] == false) { + order.push([element, 'DESC']); + } + }); + dbOptions = { attributes, offset, limit, where, order }; + const result = await ctx.model4.Account.findAndCountAll(dbOptions); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showAccount"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统编辑竞赛账号信息 + async editAccount(uid, modelType, updateMsg, requestMsg) { + const { ctx } = this; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.role < 6) return false; + let where = {}; + if (modelType == "single") { + const { uid, contest_uid, account_name, status, created_at, login_status } = requestMsg; + where = { uid, contest_uid, account_name, status, created_at, login_status }; + } else if (modelType == "multiple") { + let uid = [], contest_uid = [], account_name = [], status = [], created_at = [], login_status = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + uid.push(element.uid), + contest_uid.push(element.contest_uid), + account_name.push(element.account_name), + status.push(element.status), + created_at.push(element.created_at), + login_status.push(element.login_status) + }); + } + where = { uid, contest_uid, account_name, status, created_at, login_status }; + } + updateMsg.updated_at = new Date(); + const resultList = await ctx.model4.Account.update(updateMsg, { where }); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + const blockName = fileName + "--" + "editAccount"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统删除竞赛账号信息 + async delAccount(uid, modelType, password, requestMsg) { + const { ctx } = this; + const systemMonitoring = { + operate: 2, + operate_msg: '删除竞赛账号信息', + type: 0, + status: 0, + affect_entries: 0, + user: uid, + created_at: new Date() + }; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 9) { + if (!result) systemMonitoring.status = 0; + else if (result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt))) systemMonitoring.status = 1; + else if (result.dataValues.role < 9) systemMonitoring.status = 2; + await ctx.model3.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { uid, contest_uid, account_name, status, created_at, login_status } = requestMsg; + where = { uid, contest_uid, account_name, status, created_at, login_status }; + } else if (modelType == "multiple") { + let uid = [], contest_uid = [], account_name = [], status = [], created_at = [], login_status = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + uid.push(element.uid), + contest_uid.push(element.contest_uid), + account_name.push(element.account_name), + status.push(element.status), + created_at.push(element.created_at), + login_status.push(element.login_status) + }); + } + where = { uid, contest_uid, account_name, status, created_at, login_status }; + } + const resultList = await ctx.model4.Account.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model3.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + const blockName = fileName + "--" + "delAccount"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统重置竞赛账号密码 + async resetAccount(uid, accountUid, password) { + const { ctx } = this; + const systemMonitoring = { + operate: 2, + operate_msg: '重置竞赛账号密码', + type: 0, + status: 0, + affect_entries: 0, + user: uid, + created_at: new Date() + }; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 9) { + if (!result) systemMonitoring.status = 0; + else if (result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt))) systemMonitoring.status = 1; + else if (result.dataValues.role < 9) systemMonitoring.status = 2; + await ctx.model3.Monitoring.create(systemMonitoring); + return false; + }; + const salt = this.generateRandomString(); + const resetResult = await ctx.model4.Account.update({ salt: this.encryptRequest(salt), password: this.shaForm('123456', salt) }, { where: { uid: accountUid } }); + return resetResult[0] == 0 ? false : true; + } catch (error) { + const blockName = fileName + "--" + "resetAccount"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = ContestAccountService; \ No newline at end of file diff --git a/app/service/ContestExamination.js b/app/service/ContestExamination.js new file mode 100644 index 0000000..fc09d0d --- /dev/null +++ b/app/service/ContestExamination.js @@ -0,0 +1,163 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fileName = "ContestExamination"; + +class ContestExaminationService extends Service { + // 管理系统查看账号答题情况 + async showExamination(body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['user_uid', 'contest_uid', 'exam_type', 'topic_type', 'score', 'created_at', 'updated_at'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['user_uid', 'contest_uid', 'score'], + key = ['exam_type', 'topic_type'], + between = ['created_at', 'updated_at']; + attributes.forEach(element => { + if (searchOptions[element]) { + if (searchOptions[element] == '*空') { + if (joinSubstring.includes(element)) { + where[element] = null; + } else { + where[element] = [null, '']; + } + } else if (joinSubstring.includes(element)) { + let targetKeyArr = []; + where[element] = targetKeyArr.length > 0 ? targetKeyArr : 'null'; + } else 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] == true) { + order.push([element, 'ASC']); + } else if (sortOptions[element] == false) { + order.push([element, 'DESC']); + } + }); + dbOptions = { attributes, offset, limit, where, order }; + const result = await ctx.model4.Examination.findAndCountAll(dbOptions); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showExamination"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统编辑账号答题情况 + async editExamination(uid, modelType, updateMsg, requestMsg) { + const { ctx } = this; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.role < 6) return false; + let where = {}; + if (modelType == "single") { + const { user_uid, contest_uid, exam_type, topic_type, score, created_at, updated_at } = requestMsg; + where = { user_uid, contest_uid, exam_type, topic_type, score, created_at, updated_at }; + } else if (modelType == "multiple") { + let user_uid = [], contest_uid = [], exam_type = [], topic_type = [], score = [], created_at = [], updated_at = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + user_uid.push(element.user_uid), + contest_uid.push(element.contest_uid), + exam_type.push(element.exam_type), + topic_type.push(element.topic_type), + score.push(element.score), + created_at.push(element.created_at), + updated_at.push(element.updated_at) + }); + } + where = { user_uid, contest_uid, exam_type, topic_type, score, created_at, updated_at }; + } + updateMsg.updated_at = new Date(); + const resultList = await ctx.model4.Examination.update(updateMsg, { where }); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + const blockName = fileName + "--" + "editExamination"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统删除账号答题情况 + async delExamination(uid, modelType, password, requestMsg) { + const { ctx } = this; + const systemMonitoring = { + operate: 2, + operate_msg: '删除账号答题情况', + type: 0, + status: 0, + affect_entries: 0, + user: uid, + created_at: new Date() + }; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 9) { + if (!result) systemMonitoring.status = 0; + else if (result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt))) systemMonitoring.status = 1; + else if (result.dataValues.role < 9) systemMonitoring.status = 2; + await ctx.model3.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { user_uid, contest_uid, exam_type, topic_type, score, created_at, updated_at } = requestMsg; + where = { user_uid, contest_uid, exam_type, topic_type, score, created_at, updated_at }; + } else if (modelType == "multiple") { + let user_uid = [], contest_uid = [], exam_type = [], topic_type = [], score = [], created_at = [], updated_at = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + user_uid.push(element.user_uid), + contest_uid.push(element.contest_uid), + exam_type.push(element.exam_type), + topic_type.push(element.topic_type), + score.push(element.score), + created_at.push(element.created_at), + updated_at.push(element.updated_at) + }); + } + where = { user_uid, contest_uid, exam_type, topic_type, score, created_at, updated_at }; + } + const resultList = await ctx.model4.Examination.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model3.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + const blockName = fileName + "--" + "delExamination"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统导出账号答题情况 + async downloadExamination(uid, body) { + const { ctx } = this; + try { + console.log(uid); + console.log(body); + // 使用分数和时间排序后导出 + // const result = await ctx.model4.Examination.findAll({ where: { body } }); + // console.log(result); + // return result.length == 0 ? false : result; + return true; + } catch (error) { + const blockName = fileName + "--" + "downloadExamination"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = ContestExaminationService; \ No newline at end of file diff --git a/app/service/ContestMsg.js b/app/service/ContestMsg.js new file mode 100644 index 0000000..951055e --- /dev/null +++ b/app/service/ContestMsg.js @@ -0,0 +1,182 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fileName = "ContestMsg"; + +class ContestMsgService extends Service { + // 管理系统检索竞赛 uid + async searchContestUid(uid, body) { + const { ctx } = this; + try { + const result = await ctx.model4.Contest.findAll({ where: { uid: { [Op.substring]: body.contest_uid } } }); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "searchContestUid"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统创建竞赛信息 + async addContest(form) { + const { ctx } = this; + try { + const result = await ctx.model4.Contest.bulkCreate(form); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "addContest"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统查看竞赛信息 + async showContest(body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['uid', 'contest_name', 'contest_organizers', 'contest_term', 'type', 'status', 'online_start', 'online_end', 'offline_start', 'offline_end', 'contest_start', 'contest_end', 'created_at'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['uid', 'contest_name', 'contest_organizers', 'contest_term'], + key = ['type', 'status'], + between = ['online_start', 'online_end', 'offline_start', 'offline_end', 'contest_start', 'contest_end', 'created_at']; + attributes.forEach(element => { + if (searchOptions[element]) { + if (searchOptions[element] == '*空') { + if (joinSubstring.includes(element)) { + where[element] = null; + } else { + where[element] = [null, '']; + } + } else if (joinSubstring.includes(element)) { + let targetKeyArr = []; + where[element] = targetKeyArr.length > 0 ? targetKeyArr : 'null'; + } else 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] == true) { + order.push([element, 'ASC']); + } else if (sortOptions[element] == false) { + order.push([element, 'DESC']); + } + }); + dbOptions = { attributes, offset, limit, where, order }; + const result = await ctx.model4.Contest.findAndCountAll(dbOptions); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showContest"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统编辑竞赛信息 + async editContest(uid, modelType, updateMsg, requestMsg) { + const { ctx } = this; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.role < 6) return false; + let where = {}; + if (modelType == "single") { + const { uid, contest_name, contest_organizers, contest_term, type, status, online_start, online_end, offline_start, offline_end, contest_start, contest_end, created_at } = requestMsg; + where = { uid, contest_name, contest_organizers, contest_term, type, status, online_start, online_end, offline_start, offline_end, contest_start, contest_end, created_at }; + } else if (modelType == "multiple") { + let uid = [], contest_name = [], contest_organizers = [], contest_term = [], type = [], status = [], online_start = [], online_end = [], offline_start = [], offline_end = [], contest_start = [], contest_end = [], created_at = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + uid.push(element.uid), + contest_name.push(element.contest_name), + contest_organizers.push(element.contest_organizers), + contest_term.push(element.contest_term), + type.push(element.type), + status.push(element.status), + online_start.push(element.online_start), + online_end.push(element.online_end), + offline_start.push(element.offline_start), + offline_end.push(element.offline_end), + contest_start.push(element.contest_start), + contest_end.push(element.contest_end), + created_at.push(element.created_at) + }); + } + where = { uid, contest_name, contest_organizers, contest_term, type, status, online_start, online_end, offline_start, offline_end, contest_start, contest_end, created_at }; + } + const resultList = await ctx.model4.Contest.update(updateMsg, { where }); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + const blockName = fileName + "--" + "editContest"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统删除竞赛信息 + async delContest(uid, modelType, password, requestMsg) { + const { ctx } = this; + const systemMonitoring = { + operate: 2, + operate_msg: '删除竞赛信息', + type: 0, + status: 0, + affect_entries: 0, + user: uid, + created_at: new Date() + }; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 9) { + if (!result) systemMonitoring.status = 0; + else if (result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt))) systemMonitoring.status = 1; + else if (result.dataValues.role < 9) systemMonitoring.status = 2; + await ctx.model3.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { uid, contest_name, contest_organizers, contest_term, type, status, online_start, online_end, offline_start, offline_end, contest_start, contest_end, created_at } = requestMsg; + where = { uid, contest_name, contest_organizers, contest_term, type, status, online_start, online_end, offline_start, offline_end, contest_start, contest_end, created_at }; + } else if (modelType == "multiple") { + let uid = [], contest_name = [], contest_organizers = [], contest_term = [], type = [], status = [], online_start = [], online_end = [], offline_start = [], offline_end = [], contest_start = [], contest_end = [], created_at = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + uid.push(element.uid), + contest_name.push(element.contest_name), + contest_organizers.push(element.contest_organizers), + contest_term.push(element.contest_term), + type.push(element.type), + status.push(element.status), + online_start.push(element.online_start), + online_end.push(element.online_end), + offline_start.push(element.offline_start), + offline_end.push(element.offline_end), + contest_start.push(element.contest_start), + contest_end.push(element.contest_end), + created_at.push(element.created_at) + }); + } + where = { uid, contest_name, contest_organizers, contest_term, type, status, online_start, online_end, offline_start, offline_end, contest_start, contest_end, created_at }; + } + const resultList = await ctx.model4.Contest.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model3.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + const blockName = fileName + "--" + "delContest"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = ContestMsgService; \ No newline at end of file diff --git a/app/service/ContestTopic.js b/app/service/ContestTopic.js new file mode 100644 index 0000000..404d068 --- /dev/null +++ b/app/service/ContestTopic.js @@ -0,0 +1,169 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fileName = "ContestChoiceTopic"; + +class ContestChoiceTopicService extends Service { + // 管理系统导入选择题 + async importChoiceTopic(form) { + const { ctx } = this; + try { + const result = await ctx.model4.ChoiceTopic.bulkCreate(form); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "importChoiceTopic"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统创建选择题 + async addChoiceTopic(form) { + const { ctx } = this; + try { + const result = await ctx.model4.ChoiceTopic.bulkCreate(form); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "addChoiceTopic"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统查看选择题 + async showChoiceTopic(body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['topic', 'options_a', 'options_b', 'options_c', 'options_d', 'answer'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['topic', 'options_a', 'options_b', 'options_c', 'options_d'], + key = ['answer'], + between = []; + attributes.forEach(element => { + if (searchOptions[element]) { + if (searchOptions[element] == '*空') { + if (joinSubstring.includes(element)) { + where[element] = null; + } else { + where[element] = [null, '']; + } + } else if (joinSubstring.includes(element)) { + let targetKeyArr = []; + where[element] = targetKeyArr.length > 0 ? targetKeyArr : 'null'; + } else 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] == true) { + order.push([element, 'ASC']); + } else if (sortOptions[element] == false) { + order.push([element, 'DESC']); + } + }); + dbOptions = { attributes, offset, limit, where, order }; + const result = await ctx.model4.ChoiceTopic.findAndCountAll(dbOptions); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showChoiceTopic"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统编辑选择题 + async editChoiceTopic(uid, modelType, updateMsg, requestMsg) { + const { ctx } = this; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.role < 6) return false; + let where = {}; + if (modelType == "single") { + const { topic, options_a, options_b, options_c, options_d, answer } = requestMsg; + where = { topic, options_a, options_b, options_c, options_d, answer }; + } else if (modelType == "multiple") { + let topic = [], options_a = [], options_b = [], options_c = [], options_d = [], answer = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + topic.push(element.topic), + options_a.push(element.options_a), + options_b.push(element.options_b), + options_c.push(element.options_c), + options_d.push(element.options_d), + answer.push(element.answer) + }); + } + where = { topic, options_a, options_b, options_c, options_d, answer }; + } + updateMsg.updated_at = new Date(); + const resultList = await ctx.model4.ChoiceTopic.update(updateMsg, { where }); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + const blockName = fileName + "--" + "editChoiceTopic"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统删除选择题 + async delChoiceTopic(uid, modelType, password, requestMsg) { + const { ctx } = this; + const systemMonitoring = { + operate: 2, + operate_msg: '删除竞赛题目', + type: 0, + status: 0, + affect_entries: 0, + user: uid, + created_at: new Date() + }; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 9) { + if (!result) systemMonitoring.status = 0; + else if (result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt))) systemMonitoring.status = 1; + else if (result.dataValues.role < 9) systemMonitoring.status = 2; + await ctx.model3.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { topic, options_a, options_b, options_c, options_d, answer } = requestMsg; + where = { topic, options_a, options_b, options_c, options_d, answer }; + } else if (modelType == "multiple") { + let topic = [], options_a = [], options_b = [], options_c = [], options_d = [], answer = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + topic.push(element.topic), + options_a.push(element.options_a), + options_b.push(element.options_b), + options_c.push(element.options_c), + options_d.push(element.options_d), + answer.push(element.answer) + }); + } + where = { topic, options_a, options_b, options_c, options_d, answer }; + } + const resultList = await ctx.model4.ChoiceTopic.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model3.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + const blockName = fileName + "--" + "delChoiceTopic"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = ContestChoiceTopicService; \ No newline at end of file diff --git a/app/service/Insiders.js b/app/service/Insiders.js new file mode 100644 index 0000000..d8b88eb --- /dev/null +++ b/app/service/Insiders.js @@ -0,0 +1,193 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fileName = "Insiders"; + +class InsidersService extends Service { + // 注册管理系统用户 + async addInsiders(uid, form) { + const { ctx } = this; + const systemMonitoring = { + operate: 0, + operate_msg: '注册管理系统用户', + type: 1, + status: 0, + affect_entries: 0, + user: uid, + created_at: new Date() + }; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.role < 9) { + if (!result) systemMonitoring.status = 0; + else if (result.dataValues.role < 9) systemMonitoring.status = 2; + await ctx.model3.Monitoring.create(systemMonitoring); + return false; + }; + const resultList = await ctx.model3.Insiders.bulkCreate(form); + systemMonitoring.status = resultList.length == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList.length; + await ctx.model3.Monitoring.create(systemMonitoring); + return resultList.length == 0 ? false : true; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model3.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "addInsiders"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 查看管理系统用户 + async showInsiders(body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['uid', 'status', 'role', 'name', 'department', 'change', 'created_at', 'updated_at', 'login_at', 'login_status'], + where = {}, order = [], dbOptions, joinSubstring = [], + substring = ['uid', 'name', 'department', 'change'], + key = ['status', 'role', 'login_status'], + between = ['created_at', 'updated_at', 'login_at']; + where.role = { [Op.not]: 99 }; + 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)) { + if(element == 'role' && searchOptions[element] == 99) { + where.role = { [Op.not]: 99 }; + } else{ + where[element] = searchOptions[element]; + } + } 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 resultList = await ctx.model3.Insiders.findAndCountAll(dbOptions); + return resultList.rows.length == 0 ? false : resultList; + } catch (error) { + const blockName = fileName + "--" + "showInsiders"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 编辑管理系统用户 + async editInsiders(uid, modelType, updateMsg, requestMsg) { + const { ctx } = this; + const systemMonitoring = { + operate: 1, + operate_msg: '编辑管理系统用户', + type: 1, + status: 0, + affect_entries: 0, + user: uid, + created_at: new Date() + }; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.role < 9) { + if (!result) systemMonitoring.status = 0; + else if (result.dataValues.role < 9) systemMonitoring.status = 2; + await ctx.model3.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { uid, name } = requestMsg; + where = { uid, name }; + } else if (modelType == "multiple") { + let uid = [], name = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + uid.push(element.uid), + name.push(element.name) + }); + } + where = { uid, name }; + } + updateMsg.updated_at = new Date(); + where.role = { [Op.not]: 99 }; + const resultList = await ctx.model3.Insiders.update(updateMsg, { where }); + systemMonitoring.status = resultList[0] == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList[0]; + await ctx.model3.Monitoring.create(systemMonitoring); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model3.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "editInsiders"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 删除管理系统用户 + async deleteInsiders(uid, modelType, password, requestMsg) { + const { ctx } = this; + const systemMonitoring = { + operate: 2, + operate_msg: '删除管理系统用户', + type: 2, + status: 0, + affect_entries: 0, + user: uid, + created_at: new Date() + }; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 9) { + if (!result) systemMonitoring.status = 0; + else if (result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt))) systemMonitoring.status = 1; + else if (result.dataValues.role < 9) systemMonitoring.status = 2; + await ctx.model3.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { uid, name } = requestMsg; + where = { uid, name }; + } else if (modelType == "multiple") { + let uid = [], name = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + uid.push(element.uid), + name.push(element.name) + }); + } + where = { uid, name }; + } + where.role = { [Op.not]: 99 }; + const resultList = await ctx.model3.Insiders.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model3.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model3.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "deleteInsiders"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = InsidersService; \ No newline at end of file diff --git a/app/service/Monitoring.js b/app/service/Monitoring.js new file mode 100644 index 0000000..561fe0c --- /dev/null +++ b/app/service/Monitoring.js @@ -0,0 +1,125 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fileName = "Monitoring"; + +class MonitoringService extends Service { + // 查看危险操作记录 + async showMonitoring(body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['operate', 'operate_msg', 'type', 'status', 'affect_entries', 'user', 'created_at'], + where = {}, order = [], dbOptions, joinSubstring = [], + substring = ['operate_msg', 'user'], + key = ['type', 'status', 'operate'], + 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]; + } 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']); + } + }); + const insiders = await ctx.model3.Insiders.findAll({ attributes: ['uid', 'name'] }); + if (searchOptions.name) { + if (searchOptions.name == '*空') { + where.user = [null, '']; + } else { + let uidArr = []; + insiders.filter(item => { + if (item.dataValues.name.includes(searchOptions.name)) { + uidArr.push(item.dataValues.uid); + } + }); + where.user = [...uidArr]; + } + } + dbOptions = { attributes, offset, limit, where, order }; + const result = await ctx.model3.Monitoring.findAndCountAll(dbOptions); + result.rows.forEach(element => { + element.dataValues.name = ''; + insiders.filter(item => { + if (item.dataValues.uid == element.dataValues.user) { + element.dataValues.name = item.dataValues.name; + } + }); + }); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showMonitoring"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 删除危险操作记录 + async deleteMonitoring(uid, modelType, password, requestMsg) { + const { ctx } = this; + const systemMonitoring = { + operate: 2, + operate_msg: '删除危险操作记录', + type: 2, + status: 0, + affect_entries: 0, + user: uid, + created_at: new Date() + }; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 9) { + if (!result) systemMonitoring.status = 0; + else if (result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt))) systemMonitoring.status = 1; + else if (result.dataValues.role < 9) systemMonitoring.status = 2; + await ctx.model3.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { user, created_at } = requestMsg; + where = { user, created_at }; + } else if (modelType == "multiple") { + let user = [], created_at = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + user.push(element.user), + created_at.push(element.created_at) + }); + } + where = { user, created_at }; + } + const resultList = await ctx.model3.Monitoring.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model3.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model3.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "deleteMonitoring"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = MonitoringService; \ No newline at end of file diff --git a/app/service/Organization.js b/app/service/Organization.js new file mode 100644 index 0000000..24702b2 --- /dev/null +++ b/app/service/Organization.js @@ -0,0 +1,171 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fileName = "Organization"; + +class OrganizationService extends Service { + // 注册B端用户单位 + async addOrganization(form) { + const { ctx } = this; + try { + const result = await ctx.model3.Organization.bulkCreate(form); + return result.length == 0 ? false : true; + } catch (error) { + const blockName = fileName + "--" + "addOrganization"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 查看B端用户单位 + async showOrganization(body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['uid', 'organization_name', 'address', 'liaison_name', 'phone', 'email', 'other_information', 'post_code', 'created_at', 'updated_at'], + where = {}, order = [], dbOptions, joinSubstring = [], + substring = ['uid', 'organization_name', 'address', 'liaison_name', 'phone', 'email', 'other_information', 'post_code'], + key = [], between = ['created_at', 'updated_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]; + } 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 result = await ctx.model3.Organization.findAndCountAll(dbOptions); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showOrganization"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + //远程搜索B端用户单位 + async SearchOrganization(body) { + const { ctx } = this; + try { + let { query, key } = body; + let attributes = ['uid', 'organization_name', 'created_at'], where = {}, dbOptions; + if (query == '*空') { + delete where[key] + } else { + where[key] = { [Op.substring]: query }; + } + dbOptions = { attributes, where }; + const Organization = await ctx.model3.Organization.findAll(dbOptions); + return Organization.length == 0 ? false : Organization; + } catch (error) { + const blockName = fileName + "--" + "SearchOrganization"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 编辑B端用户单位 + async editOrganization(uid, modelType, updateMsg, requestMsg) { + const { ctx } = this; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.role < 6) { + if (!result) systemMonitoring.status = 0; + else if (result.dataValues.role < 6) systemMonitoring.status = 2; + await ctx.model3.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { uid, organization_name } = requestMsg; + where = { uid, organization_name }; + } else if (modelType == "multiple") { + let uid = [], organization_name = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + uid.push(element.uid), + organization_name.push(element.organization_name) + }); + } + where = { uid, organization_name }; + } + updateMsg.updated_at = new Date(); + const resultList = await ctx.model3.Organization.update(updateMsg, { where }); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + const blockName = fileName + "--" + "editOrganization"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 删除B端用户单位 + async deleteOrganization(uid, modelType, password, requestMsg) { + const { ctx } = this; + const systemMonitoring = { + operate: 2, + operate_msg: '删除B端用户单位', + type: 0, + status: 0, + affect_entries: 0, + user: uid, + created_at: new Date() + }; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 6) { + if (!result) systemMonitoring.status = 0; + else if (result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt))) systemMonitoring.status = 1; + else if (result.dataValues.role < 6) systemMonitoring.status = 2; + await ctx.model3.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { uid, organization_name } = requestMsg; + where = { uid, organization_name }; + } else if (modelType == "multiple") { + let uid = [], organization_name = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + uid.push(element.uid), + organization_name.push(element.organization_name) + }); + } + where = { uid, organization_name }; + } + const resultList = await ctx.model3.Organization.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model3.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model3.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "deleteOrganization"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = OrganizationService; \ No newline at end of file diff --git a/app/service/SNAdmin.js b/app/service/SNAdmin.js new file mode 100644 index 0000000..c8db688 --- /dev/null +++ b/app/service/SNAdmin.js @@ -0,0 +1,205 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fileName = "SNAdmin"; + +class SNAdminService extends Service { + // 搜索可分配的SN号 + async searchAllocationSN() { + const { ctx } = this; + try { + const where = { status: 0 }; + const result = await ctx.model3.SNNumber.findAll({ attributes: ['sn_number'], where }); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "searchAllocationSN"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 搜索可分配的单位用户 + async searchAllocationUser() { + const { ctx } = this; + try { + const where = { status: { [Op.not]: 2 }, role: 1 }; + const bside = await ctx.model.BSide.findAll({ attributes: ['uid', 'account_name'], where }); + const buser = await ctx.model.BuserSNAdmin.findAll({ attributes: ['user_uid'] }); + let result = []; + bside.forEach(element => { + buser.filter(item => { + if (item.dataValues.user_uid !== element.dataValues.uid) { + result.push(element); + } + }); + }); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "searchAllocationUser"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // B端分配SN号 + async allocationSN(uid, body) { + const { ctx } = this; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.role < 6) return false; + const { user_uid, length, sn_set } = body; + const adminResult = await ctx.model.BuserSNAdmin.create({ user_uid, length, sn_set }); + if (adminResult == 0) return false; + const where = { sn_number: sn_set.split(',') }; + const updateMsg = { status: 4, updated_at: new Date() }; + const resultList = await ctx.model3.SNNumber.update(updateMsg, { where }); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + const blockName = fileName + "--" + "allocationSN"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 查看B端SN号分配记录 + async showAllocationSNRecord(body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['user_uid', 'length', 'sn_set'], + where = {}, order = [], dbOptions, joinSubstring = [], + substring = ['user_uid', 'sn_set'], + key = ['length'], + between = []; + 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]; + } 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']); + } + }); + // const [bside, bsideSNRecord] = await Promise.all([ + // ctx.model.BSide.findAll({ attributes: ['uid', 'account_name'] }), + // ctx.model.BindBSNrecord.findAll({ attributes: ['user_uid', 'sn_number', 'type'] }) + // ]); + // if (searchOptions.account_name) { + // if (searchOptions.account_name == '*空') { + // where.user_uid = [null, '']; + // } else { + // let userArr = [], lengthArr = [], SNArr = []; + // bside.filter(item => { + // if (item.dataValues.account_name.includes(searchOptions.account_name)) { + // bsideSNRecord.filter(item2 => { + // if (item2.dataValues.user_uid == item.dataValues.uid) { + // userArr.push(item2.dataValues.user_uid); + // lengthArr.push(item2.dataValues.length); + // SNArr.push(item2.dataValues.sn_set); + // } + // }); + // } + // }); + // where.user_uid = [...userArr]; + // where.length = [...lengthArr]; + // where.sn_set = [...SNArr]; + // } + // } + dbOptions = { attributes, offset, limit, where, order }; + // let result; + dbOptions.limit = Math.floor(limit / 2); + dbOptions.offset = Math.floor(offset / 2); + // const [bresult] = await Promise.all([ + // ctx.model.BuserSNAdmin.findAndCountAll(dbOptions) + // ]); + // result = { + // count: bresult.count, + // rows: bresult.rows + // }; + const bside = await ctx.model.BSide.findAll({ attributes: ['uid', 'account_name'] }); + const result = await ctx.model.BuserSNAdmin.findAndCountAll(dbOptions); + result.rows.forEach(element => { + element.dataValues.account_name = ''; + bside.filter(item => { + if (item.dataValues.uid == element.dataValues.user_uid) { + element.dataValues.account_name = item.dataValues.account_name; + } + }); + }); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showAllocationSNRecord"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 删除B端SN号分配记录 + async deleteAllocationSNRecord(uid, modelType, password, requestMsg) { + const { ctx } = this; + const systemSNAdmin = { + operate: 2, + operate_msg: '删除SN号分配记录', + type: 1, + status: 0, + affect_entries: 0, + user: uid, + created_at: new Date() + }; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 9) { + if (!result) systemSNAdmin.status = 0; + else if (result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt))) systemSNAdmin.status = 1; + else if (result.dataValues.role < 9) systemSNAdmin.status = 2; + await ctx.model3.Monitoring.create(systemSNAdmin); + return false; + }; + let where = {}; + if (modelType == "single") { + const { sn_set } = requestMsg; + where = { sn_set }; + } else if (modelType == "multiple") { + let sn_set = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + sn_set.push(element.sn_set) + }); + } + where = { sn_set }; + } + const [bresultList] = await Promise.all([ + ctx.model.BuserSNAdmin.destroy({ where }) + ]); + systemSNAdmin.status = bresultList == 0 ? 3 : 4; + systemSNAdmin.affect_entries = bresultList; + await ctx.model3.Monitoring.create(systemSNAdmin); + return bresultList == 0 ? false : true; + } catch (error) { + systemSNAdmin.status = 5; + await ctx.model3.Monitoring.create(systemSNAdmin); + const blockName = fileName + "--" + "deleteAllocationSNRecord"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = SNAdminService; \ No newline at end of file diff --git a/app/service/Sn.js b/app/service/Sn.js new file mode 100644 index 0000000..fc98485 --- /dev/null +++ b/app/service/Sn.js @@ -0,0 +1,223 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fileName = "SN"; + +class SNService extends Service { + // 注册SN号 + async addSN(form) { + const { ctx } = this; + try { + const result = await ctx.model3.SNNumber.bulkCreate(form); + return result.length == 0 ? false : true; + } catch (error) { + const blockName = fileName + "--" + "addSN"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 查看SN号 + async showSN(body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['sn_number', 'status', 'created_at', 'updated_at'], + where = {}, order = [], dbOptions, joinSubstring = [], + substring = ['sn_number'], key = ['status'], between = ['created_at', 'updated_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]; + } 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']); + } + }); + const [bside, cside, contest, bsideSNBind, csideSNBind, contestSNBind] = await Promise.all([ + ctx.model.BSide.findAll({ attributes: ['uid', 'account_name'] }), + ctx.model2.CSide.findAll({ attributes: ['uid', 'account_name'] }), + ctx.model4.Account.findAll({ attributes: ['uid', 'account_name'] }), + ctx.model.BuserSNBind.findAll({ attributes: ['user_uid', 'sn_number'] }), + ctx.model2.CuserSNBind.findAll({ attributes: ['user_uid', 'sn_number'] }), + ctx.model4.TuserSNBind.findAll({ attributes: ['user_uid', 'sn_number'] }) + ]); + if (searchOptions.account_name) { + if (searchOptions.account_name == '*空') { + if (where.status == '1' || where.status == '2' || where.status == '3') { + where.status = null; + } else if (where.status == undefined) { + where.status = 0; + } + } else { + let cardArr = []; + if (where.status == '1' || where.status == undefined) { + bside.filter(item => { + if (item.dataValues.account_name.includes(searchOptions.account_name)) { + bsideSNBind.filter(item2 => { + if (item2.dataValues.user_uid == item.dataValues.uid) { + cardArr.push(item2.dataValues.sn_number); + } + }); + } + }); + } + if (where.status == '2' || where.status == undefined) { + cside.filter(item => { + if (item.dataValues.account_name.includes(searchOptions.account_name)) { + csideSNBind.filter(item2 => { + if (item2.dataValues.user_uid == item.dataValues.uid) { + cardArr.push(item2.dataValues.sn_number); + } + }); + } + }); + } + if (where.status == '3' || where.status == undefined) { + contest.filter(item => { + if (item.dataValues.account_name.includes(searchOptions.account_name)) { + contestSNBind.filter(item2 => { + if (item2.dataValues.user_uid == item.dataValues.uid) { + cardArr.push(item2.dataValues.sn_number); + } + }); + } + }); + } + where.sn_number = [...cardArr]; + } + } + dbOptions = { attributes, offset, limit, where, order }; + const result = await ctx.model3.SNNumber.findAndCountAll(dbOptions); + result.rows.forEach(element => { + element.dataValues.account_name = ''; + bsideSNBind.filter(item => { + if (item.dataValues.sn_number == element.dataValues.sn_number) { + bside.filter(item2 => { + if (item2.dataValues.uid == item.dataValues.user_uid) { + element.dataValues.account_name = item2.dataValues.account_name; + } + }); + } + }); + csideSNBind.filter(item => { + if (item.dataValues.sn_number == element.dataValues.sn_number) { + cside.filter(item2 => { + if (item2.dataValues.uid == item.dataValues.user_uid) { + element.dataValues.account_name = item2.dataValues.account_name; + } + }); + } + }); + contestSNBind.filter(item => { + if (item.dataValues.sn_number == element.dataValues.sn_number) { + contest.filter(item2 => { + if (item2.dataValues.uid == item.dataValues.user_uid) { + element.dataValues.account_name = item2.dataValues.account_name; + } + }); + } + }); + }); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showSN"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 编辑SN号 + async editSN(uid, modelType, password, updateMsg, requestMsg) { + const { ctx } = this; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 6) return false; + let where = {}; + if (modelType == "single") { + where = requestMsg; + } else if (modelType == "multiple") { + let sn_number = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + sn_number.push(element.sn_number); + }); + } + where = { sn_number }; + } + updateMsg.updated_at = new Date(); + const resultList = await ctx.model3.SNNumber.update(updateMsg, { where }); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + const blockName = fileName + "--" + "editSN"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 删除SN号 + async deleteSN(uid, modelType, password, requestMsg) { + const { ctx } = this; + const systemMonitoring = { + operate: 2, + operate_msg: '删除SN号', + type: 0, + status: 0, + affect_entries: 0, + user: uid, + created_at: new Date() + }; + try { + const result = await ctx.model3.Insiders.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 6) { + if (!result) systemMonitoring.status = 0; + else if (result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt))) systemMonitoring.status = 1; + else if (result.dataValues.role < 6) systemMonitoring.status = 2; + await ctx.model3.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + where = requestMsg; + } else if (modelType == "multiple") { + let sn_number = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + sn_number.push(element.sn_number) + }); + } + where = { sn_number }; + } + const resultList = await ctx.model3.SNNumber.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model3.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model3.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "deleteSN"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = SNService; \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..04e5b60 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,16 @@ +environment: + matrix: + - nodejs_version: '8' + - nodejs_version: '10' + - nodejs_version: '12' + +install: + - ps: Install-Product node $env:nodejs_version + - npm i npminstall@5 && node_modules\.bin\npminstall + +test_script: + - node --version + - npm --version + - npm run test + +build: off diff --git a/config/config.default.js b/config/config.default.js new file mode 100644 index 0000000..3eb0e84 --- /dev/null +++ b/config/config.default.js @@ -0,0 +1,179 @@ +/* eslint valid-jsdoc: "off" */ + +/** + * @param {Egg.EggAppInfo} appInfo app info + */ +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 + '_1715070315660_7890'; + + // add your middleware config here + // config.middleware = []; + + config.security = { + csrf:{ + enable:false + }, + }; + + 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, + } + } + + // 生产环境 + // 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, + // } + // } + }; + + 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:'accountManager' + }; + + return { + ...config, + ...userConfig, + }; +}; diff --git a/config/plugin.js b/config/plugin.js new file mode 100644 index 0000000..b42b67c --- /dev/null +++ b/config/plugin.js @@ -0,0 +1,32 @@ +/** @type Egg.EggPlugin */ +module.exports = { + // had enabled by egg + // static: { + // enable: true, + // } + + // dayjs : { + // enable: true, + // package: 'dayjs', + // }, + + redis : { + enable: true, + package: 'egg-redis', + }, + + sequelize : { + enable: true, + package: 'egg-sequelize', + }, + + validate : { + enable: true, + package: 'egg-validate', + }, + + // nodexlsx : { + // enable: true, + // package: 'node-xlsx', + // }, +}; diff --git a/controllerLog/2024/10/25.txt b/controllerLog/2024/10/25.txt new file mode 100644 index 0000000..7983d40 --- /dev/null +++ b/controllerLog/2024/10/25.txt @@ -0,0 +1,5 @@ +[2024-10-25>>>11:9:1]>>>CSide--editCSide>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-10-25>>>11:9:1]>>>CSide--deleteCSide>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-10-25>>>11:10:1]>>>CSide--editCSide>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-10-25>>>11:10:1]>>>CSide--deleteCSide>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-10-25>>>11:10:18]>>>CSide--editCSide>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') diff --git a/controllerLog/2024/10/29.txt b/controllerLog/2024/10/29.txt new file mode 100644 index 0000000..6d4685d --- /dev/null +++ b/controllerLog/2024/10/29.txt @@ -0,0 +1,14 @@ +[2024-10-29>>>11:45:23]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-10-29>>>11:45:23]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-10-29>>>11:46:22]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-10-29>>>11:46:22]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-10-29>>>11:54:59]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-10-29>>>11:54:59]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-10-29>>>11:55:33]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-10-29>>>11:55:33]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-10-29>>>11:57:37]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-10-29>>>11:57:37]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-10-29>>>11:58:36]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-10-29>>>11:58:36]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-10-29>>>11:59:11]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-10-29>>>11:59:11]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'data') diff --git a/controllerLog/2024/11/12.txt b/controllerLog/2024/11/12.txt new file mode 100644 index 0000000..84fa46a --- /dev/null +++ b/controllerLog/2024/11/12.txt @@ -0,0 +1,3 @@ +[2024-11-12>>>14:4:57]>>>Organization--addOrganization>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-11-12>>>14:13:56]>>>Organization--addOrganization>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-11-12>>>14:14:54]>>>Organization--deleteOrganization>>>>TypeError: Cannot read properties of undefined (reading 'data') diff --git a/controllerLog/2024/11/18.txt b/controllerLog/2024/11/18.txt new file mode 100644 index 0000000..b4ed815 --- /dev/null +++ b/controllerLog/2024/11/18.txt @@ -0,0 +1,3 @@ +[2024-11-18>>>16:23:14]>>>Monitoring--deleteMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'deleteMonitoring') +[2024-11-18>>>16:25:1]>>>Monitoring--deleteMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'deleteMonitoring') +[2024-11-18>>>16:26:9]>>>Monitoring--deleteMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'deleteMonitoring') diff --git a/controllerLog/2024/11/19.txt b/controllerLog/2024/11/19.txt new file mode 100644 index 0000000..e277f79 --- /dev/null +++ b/controllerLog/2024/11/19.txt @@ -0,0 +1,4 @@ +[2024-11-19>>>11:30:34]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-19>>>11:42:54]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-19>>>11:43:34]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-19>>>15:21:41]>>>Business--editBusiness>>>>ReferenceError: password is not defined diff --git a/controllerLog/2024/11/21.txt b/controllerLog/2024/11/21.txt new file mode 100644 index 0000000..22b717f --- /dev/null +++ b/controllerLog/2024/11/21.txt @@ -0,0 +1,6 @@ +[2024-11-21>>>16:28:3]>>>Monitoring--deleteMonitoring>>>>SequelizeDatabaseError: (conn:359, no: 1366, SQLState: 22007) Incorrect integer value: 'delete' for column 'operate' at row 1 +sql: INSERT INTO `monitoring` (`id`,`operate`,`operate_msg`,`type`,`status`,`affect_entries`,`user`,`created_at`) VALUES (DEFAULT,?,?,?,?,?,?,?); - parameters:['delete','删除危险操作记录',2,5,1,'20240613332101M','2024-11-21 08:28:03.120'] +[2024-11-21>>>16:34:36]>>>Insiders--addInsiders>>>>ReferenceError: uid is not defined +[2024-11-21>>>16:36:46]>>>Insiders--addInsiders>>>>ReferenceError: uid is not defined +[2024-11-21>>>16:37:11]>>>Insiders--addInsiders>>>>ReferenceError: uid is not defined +[2024-11-21>>>16:37:49]>>>Insiders--addInsiders>>>>ReferenceError: uid is not defined diff --git a/controllerLog/2024/11/27.txt b/controllerLog/2024/11/27.txt new file mode 100644 index 0000000..d4be40c --- /dev/null +++ b/controllerLog/2024/11/27.txt @@ -0,0 +1,19 @@ +[2024-11-27>>>17:27:40]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-27>>>17:28:8]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-27>>>17:29:24]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-27>>>17:30:24]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-27>>>17:31:50]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-27>>>17:32:10]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-27>>>17:32:25]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-27>>>17:32:48]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-27>>>17:33:24]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-27>>>17:33:53]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-27>>>17:35:13]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-27>>>17:35:43]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-27>>>17:36:43]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-27>>>17:37:18]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-27>>>17:38:48]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-27>>>17:41:58]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-27>>>17:42:55]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-27>>>17:43:22]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-27>>>17:45:41]>>>Business--addBusiness>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') diff --git a/controllerLog/2024/11/29.txt b/controllerLog/2024/11/29.txt new file mode 100644 index 0000000..562724c --- /dev/null +++ b/controllerLog/2024/11/29.txt @@ -0,0 +1 @@ +[2024-11-29>>>16:25:21]>>>Business--editBusiness>>>>TypeError: Cannot read properties of undefined (reading 'salt') diff --git a/controllerLog/2024/11/5.txt b/controllerLog/2024/11/5.txt new file mode 100644 index 0000000..ca11b39 --- /dev/null +++ b/controllerLog/2024/11/5.txt @@ -0,0 +1,37 @@ +[2024-11-5>>>14:25:55]>>>BdCard--editBdCard>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-11-5>>>14:39:20]>>>BdCard--editBdCard>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-11-5>>>14:39:52]>>>BdCard--editBdCard>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-11-5>>>15:5:48]>>>BdCard--addBdCard>>>>Error: Malformed UTF-8 data +[2024-11-5>>>15:9:18]>>>BdCard--addBdCard>>>>Error: Malformed UTF-8 data +[2024-11-5>>>15:12:34]>>>BdCard--addBdCard>>>>Error: Malformed UTF-8 data +[2024-11-5>>>15:15:34]>>>BdCard--addBdCard>>>>Error: Malformed UTF-8 data +[2024-11-5>>>15:42:32]>>>BdCard--addBdCard>>>>ReferenceError: Cannot access 'requestMsg' before initialization +[2024-11-5>>>15:42:51]>>>BdCard--addBdCard>>>>ReferenceError: Cannot access 'requestMsg' before initialization +[2024-11-5>>>15:44:23]>>>BdCard--addBdCard>>>>ReferenceError: Cannot access 'requestMsg' before initialization +[2024-11-5>>>15:48:37]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>16:20:35]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>16:20:56]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>16:28:2]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>16:56:30]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>16:58:25]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>16:58:54]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>17:9:39]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>17:29:39]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>17:30:19]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>17:31:5]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>17:31:30]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>17:32:32]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>17:33:38]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>17:35:21]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>17:37:7]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>17:37:47]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>17:45:53]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>17:46:36]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>17:46:53]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>17:47:25]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>17:48:30]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>17:51:0]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>17:51:24]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>17:52:13]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>17:54:1]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-5>>>17:54:28]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') diff --git a/controllerLog/2024/11/6.txt b/controllerLog/2024/11/6.txt new file mode 100644 index 0000000..8d3861f --- /dev/null +++ b/controllerLog/2024/11/6.txt @@ -0,0 +1,2 @@ +[2024-11-6>>>9:48:36]>>>BdCard--addBdCard>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2024-11-6>>>11:26:55]>>>BdCard--deleteBdCard>>>>TypeError: Cannot read properties of undefined (reading 'data') diff --git a/controllerLog/2024/11/8.txt b/controllerLog/2024/11/8.txt new file mode 100644 index 0000000..2c10f0f --- /dev/null +++ b/controllerLog/2024/11/8.txt @@ -0,0 +1,39 @@ +[2024-11-8>>>11:37:51]>>>Organization--showOrganization>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-11-8>>>11:37:51]>>>Organization--showOrganization>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-11-8>>>11:40:4]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-11-8>>>11:40:4]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-11-8>>>11:51:38]>>>Business--showBusiness>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-11-8>>>11:51:38]>>>Business--showBusiness>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-11-8>>>11:51:40]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>11:51:40]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>11:53:50]>>>Business--showBusiness>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-11-8>>>11:53:50]>>>Business--showBusiness>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-11-8>>>11:54:46]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>11:54:46]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>11:56:5]>>>Business--showBusiness>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-11-8>>>11:56:6]>>>Business--showBusiness>>>>TypeError: Cannot read properties of undefined (reading 'data') +[2024-11-8>>>11:56:7]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>11:56:7]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>11:57:30]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>11:57:37]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>11:57:38]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>12:2:55]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>12:2:56]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>12:3:9]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>12:3:9]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>12:3:23]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>12:3:24]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>12:3:43]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>12:3:43]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>12:3:57]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>12:3:57]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>12:4:44]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>12:4:44]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>12:6:0]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>12:6:0]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>12:6:24]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>12:6:24]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>12:6:31]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>12:6:31]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>12:6:34]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') +[2024-11-8>>>12:6:34]>>>Monitoring--showMonitoring>>>>TypeError: Cannot read properties of undefined (reading 'showMonitoring') diff --git a/controllerLog/2025/6/20.txt b/controllerLog/2025/6/20.txt new file mode 100644 index 0000000..5ee9368 --- /dev/null +++ b/controllerLog/2025/6/20.txt @@ -0,0 +1,8 @@ +[2025-6-20>>>15:22:54]>>>ContestTopic--addChoiceTopic>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2025-6-20>>>15:23:12]>>>ContestTopic--addChoiceTopic>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2025-6-20>>>15:26:14]>>>ContestTopic--addChoiceTopic>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2025-6-20>>>15:29:35]>>>ContestTopic--addChoiceTopic>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2025-6-20>>>16:34:59]>>>ContestAccount--addAccount>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2025-6-20>>>17:21:24]>>>ContestMsg--searchContestUid>>>>TypeError: Cannot read properties of undefined (reading 'searchContestUid') +[2025-6-20>>>17:21:25]>>>ContestMsg--searchContestUid>>>>TypeError: Cannot read properties of undefined (reading 'searchContestUid') +[2025-6-20>>>17:21:29]>>>ContestMsg--searchContestUid>>>>TypeError: Cannot read properties of undefined (reading 'searchContestUid') diff --git a/controllerLog/2026/3/16.txt b/controllerLog/2026/3/16.txt new file mode 100644 index 0000000..83b24a8 --- /dev/null +++ b/controllerLog/2026/3/16.txt @@ -0,0 +1,3 @@ +[2026-3-16>>>15:58:43]>>>SNAdmin--allocationSN>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2026-3-16>>>16:4:30]>>>SNAdmin--allocationSN>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2026-3-16>>>16:5:56]>>>SNAdmin--allocationSN>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') diff --git a/database/config.json b/database/config.json new file mode 100644 index 0000000..1b65e53 --- /dev/null +++ b/database/config.json @@ -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" + } +} diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 0000000..1bbed3f --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,5 @@ +{ + "include": [ + "**/*" + ] +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..0104a68 --- /dev/null +++ b/package.json @@ -0,0 +1,50 @@ +{ + "name": "account-manager", + "version": "1.0.0", + "description": "", + "private": true, + "egg": { + "declarations": true + }, + "dependencies": { + "crypto-js": "^4.2.0", + "dayjs": "^1.11.11", + "egg": "^3.17.5", + "egg-redis": "^2.6.0", + "egg-scripts": "2", + "egg-sequelize": "^6.0.0", + "egg-validate": "^2.0.2", + "ioredis": "^5.4.1", + "mariadb": "^3.3.0", + "mysql2": "^3.9.7", + "node-xlsx": "^0.24.0", + "sequelize": "^6.37.4" + }, + "devDependencies": { + "egg-bin": "6", + "egg-mock": "5", + "eslint": "8", + "eslint-config-egg": "13", + "sequelize-cli": "^6.6.2" + }, + "engines": { + "node": ">=16.0.0" + }, + "scripts": { + "reload": "egg-scripts stop --title=egg-server-account-manager && egg-scripts start --daemon --port=8012 --title=egg-server-account-manager --ignore-stderr", + "start": "egg-scripts start --daemon --port=8012 --title=egg-server-account-manager --ignore-stderr", + "stop": "egg-scripts stop --title=egg-server-account-manager", + "dev": "egg-bin dev --port=8012", + "test": "npm run lint -- --fix && npm run test:local", + "test:local": "egg-bin test", + "cov": "egg-bin cov", + "lint": "eslint .", + "ci": "npm run lint && npm run cov" + }, + "repository": { + "type": "git", + "url": "" + }, + "author": "", + "license": "MIT" +} diff --git a/serviceLog/2024/10/25.txt b/serviceLog/2024/10/25.txt new file mode 100644 index 0000000..42119b3 --- /dev/null +++ b/serviceLog/2024/10/25.txt @@ -0,0 +1,3 @@ +[2024-10-25>>>11:9:1]>>>CSide--showCSide>>>>ReferenceError: body is not defined +[2024-10-25>>>11:10:1]>>>CSide--showCSide>>>>ReferenceError: body is not defined +[2024-10-25>>>11:10:18]>>>CSide--showCSide>>>>ReferenceError: body is not defined diff --git a/serviceLog/2024/10/29.txt b/serviceLog/2024/10/29.txt new file mode 100644 index 0000000..275e391 --- /dev/null +++ b/serviceLog/2024/10/29.txt @@ -0,0 +1,40 @@ +[2024-10-29>>>9:37:23]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:37:24]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:39:4]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:39:4]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:39:5]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:39:12]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:39:12]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:39:13]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:39:16]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:39:16]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:39:17]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:40:36]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:40:36]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:40:37]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:41:3]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:41:3]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:41:5]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:41:27]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:41:27]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:41:29]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:41:48]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:41:48]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:41:49]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:42:16]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:42:16]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:42:17]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:46:26]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:46:26]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:46:27]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:54:21]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:54:21]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>9:54:22]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>11:43:27]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>11:43:27]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'findAndCountAll') +[2024-10-29>>>11:54:20]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2024-10-29>>>11:54:20]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2024-10-29>>>11:56:46]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2024-10-29>>>11:56:46]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2024-10-29>>>11:57:1]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2024-10-29>>>11:57:2]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'length') diff --git a/serviceLog/2024/11/11.txt b/serviceLog/2024/11/11.txt new file mode 100644 index 0000000..5b00aac --- /dev/null +++ b/serviceLog/2024/11/11.txt @@ -0,0 +1,262 @@ +[2024-11-11>>>16:22:20]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:22:20]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:22:20]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:22:20]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:22:20]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:25:14]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:25:14]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:25:14]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:25:14]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:25:14]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:25:33]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:25:34]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:25:34]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:25:34]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:25:34]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:25:47]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:25:47]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:25:47]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:25:47]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:25:47]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:26:30]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:26:30]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:26:30]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:26:30]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:26:30]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:27:57]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:27:57]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:27:57]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:27:57]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:27:57]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:28:30]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:28:30]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:28:30]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:28:30]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:28:30]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:31:42]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:31:43]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:31:43]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:31:43]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:31:43]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:31:53]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:31:53]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:31:53]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:31:53]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:31:53]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:32:2]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:32:2]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:32:2]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:32:2]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:32:3]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:33:31]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:33:31]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:33:31]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:33:31]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:33:31]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:33:59]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:33:59]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:33:59]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:33:59]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:33:59]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:34:16]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:34:17]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:34:17]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:34:17]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:34:17]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:34:53]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:34:53]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:34:53]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:34:53]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:34:53]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:35:22]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:35:23]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:35:23]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:35:23]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:35:23]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:36:11]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:36:11]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:36:11]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:36:11]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:36:11]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:38:9]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:38:9]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias organization in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:38:9]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias organization in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:38:9]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias organization in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:38:9]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias organization in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:39:53]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'uid' and association 'uid' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:39:53]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias uid in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:39:53]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias uid in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:39:53]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias uid in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:39:53]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias uid in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:43:10]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model organization. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:43:10]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias organization in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:43:10]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias organization in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:43:10]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias organization in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:43:10]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias organization in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:43:34]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:43:34]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:43:34]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:43:34]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:43:34]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:43:58]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:43:58]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:43:58]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:43:58]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:43:59]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>16:44:29]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is associated to b-side using an alias. You must use the 'as' keyword to specify the alias within your include statement. +[2024-11-11>>>16:44:29]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:44:29]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:44:29]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:44:30]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:45:12]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is associated to b-side using an alias. You must use the 'as' keyword to specify the alias within your include statement. +[2024-11-11>>>16:45:12]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias sfdsgs in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:45:12]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias sfdsgs in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:45:12]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias sfdsgs in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:45:12]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias sfdsgs in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:45:43]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is associated to b-side using an alias. You must use the 'as' keyword to specify the alias within your include statement. +[2024-11-11>>>16:45:43]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias organization_name in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:45:43]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias organization_name in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:45:43]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias organization_name in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:45:43]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias organization_name in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:47:9]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:47:9]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:47:9]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:47:9]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:47:9]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:47:35]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:47:35]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:47:35]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:47:35]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:47:35]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:47:53]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:47:53]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:47:53]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:47:53]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:47:53]>>>BSide--showBSide>>>>Error: Naming collision between attribute 'organization' and association 'organization' on model b-side. To remedy this, change either foreignKey or as in your association definition +[2024-11-11>>>16:49:52]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:378, no: 1146, SQLState: 42S02) Table 'bside.organization' doesn't exist +sql: SELECT count(`b-side`.`id`) AS `count` FROM `b-side` AS `b-side` LEFT OUTER JOIN `organization` AS `test` ON `b-side`.`test_id` = `test`.`id`; - parameters:[] +[2024-11-11>>>16:49:52]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:49:52]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:49:52]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:49:52]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:52:1]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:384, no: 1146, SQLState: 42S02) Table 'bside.organization' doesn't exist +sql: SELECT count(`b-side`.`id`) AS `count` FROM `b-side` AS `b-side` LEFT OUTER JOIN `organization` AS `test` ON `b-side`.`organization` = `test`.`uid`; - parameters:[] +[2024-11-11>>>16:52:1]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:52:1]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:52:1]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:52:2]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:52:14]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:394, no: 1146, SQLState: 42S02) Table 'bside.organization' doesn't exist +sql: SELECT count(`b-side`.`id`) AS `count` FROM `b-side` AS `b-side` LEFT OUTER JOIN `organization` AS `test` ON `b-side`.`uid` = `test`.`organization`; - parameters:[] +[2024-11-11>>>16:52:14]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:52:14]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:52:14]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:52:14]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:53:1]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:402, no: 1146, SQLState: 42S02) Table 'bside.organization' doesn't exist +sql: SELECT count(`b-side`.`id`) AS `count` FROM `b-side` AS `b-side` LEFT OUTER JOIN `organization` AS `test` ON `b-side`.`organization` = `test`.`uid`; - parameters:[] +[2024-11-11>>>16:53:1]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:53:1]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:53:1]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>16:53:1]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>17:12:56]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>17:12:56]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>17:12:56]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>17:12:56]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>17:12:56]>>>BSide--showBSide>>>>SequelizeEagerLoadingError: organization is not associated to b-side! +[2024-11-11>>>17:16:41]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:465, no: 1146, SQLState: 42S02) Table 'bside.organization' doesn't exist +sql: SELECT count(`b-side`.`id`) AS `count` FROM `b-side` AS `b-side` LEFT OUTER JOIN `organization` AS `test` ON `b-side`.`organization` = `test`.`uid`; - parameters:[] +[2024-11-11>>>17:16:41]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>17:16:41]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>17:16:41]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>17:16:42]>>>BSide--showBSide>>>>SequelizeAssociationError: You have used the alias test in two separate associations. Aliased associations must have unique aliases. +[2024-11-11>>>17:22:29]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:485, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:22:29]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:485, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:22:29]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:485, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:22:29]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:485, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:22:29]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:491, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:23:52]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:496, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:23:52]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:496, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:23:52]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:496, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:23:52]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:496, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:23:52]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:503, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:24:19]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:511, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:24:19]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:511, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:24:19]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:511, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:24:19]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:511, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:24:19]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:516, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:24:59]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:528, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:25:0]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:528, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:25:0]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:528, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:25:0]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:528, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:25:0]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:536, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:25:12]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:541, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:25:12]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:541, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:25:13]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:541, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:25:13]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:541, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:25:13]>>>BSide--showBSide>>>>SequelizeDatabaseError: (conn:549, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `id`, `uid`, `organization`, `address`, `liaison_name`, `phone`, `email`, `other_information`, `post_code`, `created_at`, `updated_at`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FROM `organization` AS `organization`; - parameters:[] +[2024-11-11>>>17:27:1]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'find') +[2024-11-11>>>17:27:2]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'find') +[2024-11-11>>>17:27:2]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'find') +[2024-11-11>>>17:27:2]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'find') +[2024-11-11>>>17:27:2]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'find') +[2024-11-11>>>17:47:46]>>>BSide--showBSide>>>>ReferenceError: item is not defined +[2024-11-11>>>17:47:51]>>>BSide--showBSide>>>>ReferenceError: item is not defined +[2024-11-11>>>17:54:17]>>>BSide--showBSide>>>>ReferenceError: foreignKey is not defined +[2024-11-11>>>17:54:47]>>>BSide--showBSide>>>>ReferenceError: model is not defined +[2024-11-11>>>17:56:7]>>>BSide--showBSide>>>>ReferenceError: model is not defined +[2024-11-11>>>17:56:12]>>>BSide--showBSide>>>>ReferenceError: model is not defined +[2024-11-11>>>17:56:45]>>>BSide--showBSide>>>>ReferenceError: item is not defined +[2024-11-11>>>17:56:49]>>>BSide--showBSide>>>>ReferenceError: item is not defined +[2024-11-11>>>17:57:14]>>>BSide--showBSide>>>>ReferenceError: tragetKey is not defined +[2024-11-11>>>17:57:45]>>>BSide--showBSide>>>>Error: Invalid value Promise { + , + [Symbol(async_id_symbol)]: 368, + [Symbol(trigger_async_id_symbol)]: 355, + [Symbol(kResourceStore)]: { + request: [Object], + response: [Object], + app: [Object], + originalUrl: '/showBSide', + req: '', + res: '', + socket: '' + } +} +[2024-11-11>>>17:58:25]>>>BSide--showBSide>>>>Error: Invalid value Promise { + , + [Symbol(async_id_symbol)]: 599, + [Symbol(trigger_async_id_symbol)]: 586, + [Symbol(kResourceStore)]: { + request: [Object], + response: [Object], + app: [Object], + originalUrl: '/showBSide', + req: '', + res: '', + socket: '' + } +} diff --git a/serviceLog/2024/11/12.txt b/serviceLog/2024/11/12.txt new file mode 100644 index 0000000..a2d5a16 --- /dev/null +++ b/serviceLog/2024/11/12.txt @@ -0,0 +1,55 @@ +[2024-11-12>>>13:59:18]>>>Organization--addOrganization>>>>SequelizeDatabaseError: (conn:466, no: 1364, SQLState: HY000) Field 'organization_name' doesn't have a default value +sql: INSERT INTO `organization` (`id`,`uid`,`address`,`liaison_name`,`phone`,`email`,`other_information`,`post_code`,`created_at`,`updated_at`) VALUES (NULL,'202411121849042O','','','','','','','2024-11-12 05:59:18.186','2024-11-12 05:59:18.186'); - parameters:[] +[2024-11-12>>>14:5:52]>>>Organization--addOrganization>>>>SequelizeDatabaseError: (conn:497, no: 1364, SQLState: HY000) Field 'organization_name' doesn't have a default value +sql: INSERT INTO `organization` (`id`,`uid`,`address`,`liaison_name`,`phone`,`email`,`other_information`,`post_code`,`created_at`,`updated_at`) VALUES (NULL,'202411129909680O','','','','','','','2024-11-12 06:05:51.992','2024-11-12 06:05:51.992'); - parameters:[] +[2024-11-12>>>14:6:23]>>>Organization--addOrganization>>>>SequelizeDatabaseError: (conn:501, no: 1364, SQLState: HY000) Field 'organization_name' doesn't have a default value +sql: INSERT INTO `organization` (`id`,`uid`,`address`,`liaison_name`,`phone`,`email`,`other_information`,`post_code`,`created_at`,`updated_at`) VALUES (NULL,'202411121807029O','','','','','','','2024-11-12 06:06:23.184','2024-11-12 06:06:23.184'); - parameters:[] +[2024-11-12>>>14:7:53]>>>Organization--addOrganization>>>>SequelizeDatabaseError: (conn:515, no: 1364, SQLState: HY000) Field 'organization_name' doesn't have a default value +sql: INSERT INTO `organization` (`id`,`uid`,`address`,`liaison_name`,`phone`,`email`,`other_information`,`post_code`,`created_at`,`updated_at`) VALUES (NULL,'202411129379077O','','','','','','','2024-11-12 06:07:52.995','2024-11-12 06:07:52.995'); - parameters:[] +[2024-11-12>>>14:8:27]>>>Organization--addOrganization>>>>SequelizeDatabaseError: (conn:522, no: 1364, SQLState: HY000) Field 'organization_name' doesn't have a default value +sql: INSERT INTO `organization` (`id`,`uid`,`address`,`liaison_name`,`phone`,`email`,`other_information`,`post_code`,`created_at`,`updated_at`) VALUES (NULL,'20241112580449O','','','','','','','2024-11-12 06:08:27.587','2024-11-12 06:08:27.587'); - parameters:[] +[2024-11-12>>>14:9:57]>>>Organization--addOrganization>>>>SequelizeDatabaseError: (conn:529, no: 1364, SQLState: HY000) Field 'organization_name' doesn't have a default value +sql: INSERT INTO `organization` (`id`,`uid`,`address`,`liaison_name`,`phone`,`email`,`other_information`,`post_code`,`created_at`,`updated_at`) VALUES (NULL,'202411121856928O','','','','','','','2024-11-12 06:09:57.190','2024-11-12 06:09:57.190'); - parameters:[] +[2024-11-12>>>14:12:4]>>>Organization--addOrganization>>>>SequelizeDatabaseError: (conn:552, no: 1364, SQLState: HY000) Field 'organization_name' doesn't have a default value +sql: INSERT INTO `organization` (`id`,`uid`,`address`,`liaison_name`,`phone`,`email`,`other_information`,`post_code`,`created_at`,`updated_at`) VALUES (NULL,'202411122489351O','','','','','','','2024-11-12 06:12:04.250','2024-11-12 06:12:04.250'); - parameters:[] +[2024-11-12>>>15:17:56]>>>BSide--addBSide>>>>SequelizeDatabaseError: (conn:765, no: 1406, SQLState: 22001) Data too long for column 'uid' at row 1 +sql: INSERT INTO `b-side` (`id`,`uid`,`salt`,`status`,`role`,`account_name`,`password`,`organization`,`user_name`,`phone`,`msg`,`created_at`,`updated_at`,`login_at`,`login_status`) VALUES (NULL,'202411120535530B','oTbq3bFpO63pMbiqeOwZxg==',0,'0','test_single','... - parameters:[] +[2024-11-12>>>15:23:15]>>>BSide--addBSide>>>>SequelizeDatabaseError: (conn:790, no: 1406, SQLState: 22001) Data too long for column 'uid' at row 1 +sql: INSERT INTO `b-side` (`id`,`uid`,`salt`,`status`,`role`,`account_name`,`password`,`organization`,`user_name`,`phone`,`msg`,`created_at`,`updated_at`,`login_at`,`login_status`) VALUES (NULL,'202411124851526B','oP5oYDXMsaim7cR8Fq83lg==',0,'0','test','7bc1a3f... - parameters:[] +[2024-11-12>>>15:23:42]>>>BSide--addBSide>>>>SequelizeDatabaseError: (conn:801, no: 1406, SQLState: 22001) Data too long for column 'uid' at row 1 +sql: INSERT INTO `b-side` (`id`,`uid`,`salt`,`status`,`role`,`account_name`,`password`,`organization`,`user_name`,`phone`,`msg`,`created_at`,`updated_at`,`login_at`,`login_status`) VALUES (NULL,'202411125438577B','CbBmLYJl+Dzy+3kr8tC4fg==',0,'0','s','9cc1435cc5... - parameters:[] +[2024-11-12>>>15:24:52]>>>BSide--addBSide>>>>SequelizeDatabaseError: (conn:812, no: 1406, SQLState: 22001) Data too long for column 'uid' at row 1 +sql: INSERT INTO `b-side` (`id`,`uid`,`salt`,`status`,`role`,`account_name`,`password`,`organization`,`user_name`,`phone`,`msg`,`created_at`,`updated_at`,`login_at`,`login_status`) VALUES (NULL,'202411129585147B','0FpjVqkqSd07HlN/PfzLuQ==',0,'0','test_singel','... - parameters:[] +[2024-11-12>>>15:25:52]>>>BSide--addBSide>>>>SequelizeForeignKeyConstraintError: (conn:830, no: 1452, SQLState: 23000) Cannot add or update a child row: a foreign key constraint fails (`bside`.`b-side`, CONSTRAINT `FK_b-side_organization` FOREIGN KEY (`organization`) REFERENCES `insiders`.`organization` (`uid`)) +sql: INSERT INTO `b-side` (`id`,`uid`,`salt`,`status`,`role`,`account_name`,`password`,`organization`,`user_name`,`phone`,`msg`,`created_at`,`updated_at`,`login_at`,`login_status`) VALUES (NULL,'20241112371274B','oP3g8dePlcg7h6DFcHHRww==',0,'0','test_single','e... - parameters:[] +[2024-11-12>>>15:33:9]>>>BSide--addBSide>>>>SequelizeDatabaseError: (conn:837, no: 1406, SQLState: 22001) Data too long for column 'uid' at row 1 +sql: INSERT INTO `b-side` (`id`,`uid`,`salt`,`status`,`role`,`account_name`,`password`,`organization`,`user_name`,`phone`,`msg`,`created_at`,`updated_at`,`login_at`,`login_status`) VALUES (NULL,'20249787930B','gcjnH0WyYaIqyxPOpN85xg==',0,'0','test_single','... - parameters:[][2024-11-12>>>15:34:28]>>>BSide--addBSide>>>>SequelizeDatabaseError: (conn:844, no: 1406, SQLState: 22001) Data too long for column 'uid' at row 1 +sql: INSERT INTO `b-side` (`id`,`uid`,`salt`,`status`,`role`,`account_name`,`password`,`organization`,`user_name`,`phone`,`msg`,`created_at`,`updated_at`,`login_at`,`login_status`) VALUES (NULL,'202411123906493B','65yL/0C4Y14+GL34liFbrQ==',0,'0','test_single','... - parameters:[] +[2024-11-12>>>15:34:50]>>>BSide--addBSide>>>>SequelizeDatabaseError: (conn:850, no: 1406, SQLState: 22001) Data too long for column 'uid' at row 1 +sql: INSERT INTO `b-side` (`id`,`uid`,`salt`,`status`,`role`,`account_name`,`password`,`organization`,`user_name`,`phone`,`msg`,`created_at`,`updated_at`,`login_at`,`login_status`) VALUES (NULL,'202411127806816B','lKE+pyt6+nEIB2V+QJ3eeg==',0,'0','test_single','... - parameters:[] +[2024-11-12>>>15:35:13]>>>BSide--addBSide>>>>SequelizeDatabaseError: (conn:861, no: 1406, SQLState: 22001) Data too long for column 'uid' at row 1 +sql: INSERT INTO `b-side` (`id`,`uid`,`salt`,`status`,`role`,`account_name`,`password`,`organization`,`user_name`,`phone`,`msg`,`created_at`,`updated_at`,`login_at`,`login_status`) VALUES (NULL,'202411123966720B','1jcut0/2sLGWgKu9hv5maA==',0,'0','test_single','... - parameters:[] +[2024-11-12>>>15:35:39]>>>BSide--addBSide>>>>SequelizeDatabaseError: (conn:868, no: 1406, SQLState: 22001) Data too long for column 'uid' at row 1 +sql: INSERT INTO `b-side` (`id`,`uid`,`salt`,`status`,`role`,`account_name`,`password`,`organization`,`user_name`,`phone`,`msg`,`created_at`,`updated_at`,`login_at`,`login_status`) VALUES (NULL,'202411123087820B','5EvMohmYGaMRCICKE0+VAA==',0,'0','test_single','... - parameters:[] +[2024-11-12>>>15:35:58]>>>BSide--addBSide>>>>SequelizeDatabaseError: (conn:879, no: 1406, SQLState: 22001) Data too long for column 'uid' at row 1 +sql: INSERT INTO `b-side` (`id`,`uid`,`salt`,`status`,`role`,`account_name`,`password`,`organization`,`user_name`,`phone`,`msg`,`created_at`,`updated_at`,`login_at`,`login_status`) VALUES (NULL,'202411123323030B','74WyUZkgXlTHkgf9N7FzdQ==',0,'0','test_single','... - parameters:[] +[2024-11-12>>>15:38:7]>>>BSide--addBSide>>>>SequelizeForeignKeyConstraintError: (conn:892, no: 1452, SQLState: 23000) Cannot add or update a child row: a foreign key constraint fails (`bside`.`b-side`, CONSTRAINT `FK_b-side_organization` FOREIGN KEY (`organization`) REFERENCES `insiders`.`organization` (`uid`)) +sql: INSERT INTO `b-side` (`id`,`uid`,`salt`,`status`,`role`,`account_name`,`password`,`organization`,`user_name`,`phone`,`msg`,`created_at`,`updated_at`,`login_at`,`login_status`) VALUES (NULL,'20241112926031B','erBNHYGWsmXNhYP5W1u9mQ==',0,'0','test_single','8... - parameters:[] +[2024-11-12>>>15:43:24]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-12>>>15:43:30]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-12>>>15:43:30]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-12>>>15:43:30]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-12>>>15:43:30]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-12>>>15:43:30]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-12>>>15:43:59]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-12>>>15:43:59]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-12>>>15:43:59]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-12>>>15:43:59]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-12>>>15:43:59]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-12>>>15:45:9]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-12>>>15:45:35]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-12>>>15:46:12]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-12>>>15:48:50]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-12>>>15:50:34]>>>BSide--showBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-12>>>16:13:28]>>>BSide--showBSide>>>>Error: Invalid value { [Symbol(substring)]: '1' } +[2024-11-12>>>16:13:34]>>>BSide--showBSide>>>>Error: Invalid value { [Symbol(substring)]: '20241112535643O' } diff --git a/serviceLog/2024/11/15.txt b/serviceLog/2024/11/15.txt new file mode 100644 index 0000000..a92f511 --- /dev/null +++ b/serviceLog/2024/11/15.txt @@ -0,0 +1,2 @@ +[2024-11-15>>>17:41:17]>>>BSide--editBSide>>>>SequelizeDatabaseError: (conn:1447, no: 1366, SQLState: 22007) Incorrect integer value: '' for column 'status' at row 1 +sql: UPDATE `b-side` SET `status`=?,`role`=?,`organization`=?,`updated_at`=? WHERE `account_name` = ? AND `organization` IS NULL - parameters:['','','','2024-11-15 09:41:17.766','test_many0'] diff --git a/serviceLog/2024/11/18.txt b/serviceLog/2024/11/18.txt new file mode 100644 index 0000000..6b456b7 --- /dev/null +++ b/serviceLog/2024/11/18.txt @@ -0,0 +1,23 @@ +[2024-11-18>>>9:35:15]>>>BSide--editBSide>>>>SequelizeDatabaseError: (conn:36, no: 1366, SQLState: 22007) Incorrect integer value: '' for column 'status' at row 1 +sql: UPDATE `b-side` SET `status`=?,`role`=?,`organization`=?,`updated_at`=? WHERE `account_name` = ? AND `organization` IS NULL - parameters:['','','','2024-11-18 01:35:15.131','test_many0'] +[2024-11-18>>>9:35:58]>>>BSide--editBSide>>>>SequelizeDatabaseError: (conn:39, no: 1366, SQLState: 22007) Incorrect integer value: '' for column 'status' at row 1 +sql: UPDATE `b-side` SET `status`=?,`role`=?,`organization`=?,`updated_at`=? WHERE `account_name` = ? AND `organization` IS NULL - parameters:['','','','2024-11-18 01:35:58.080','test_many0'] +[2024-11-18>>>10:42:46]>>>Organization--SearchOrganization>>>>ReferenceError: dbOptions is not defined +[2024-11-18>>>10:43:17]>>>Organization--SearchOrganization>>>>SequelizeDatabaseError: (conn:155, no: 1054, SQLState: 42S22) Unknown column 'organization' in 'field list' +sql: SELECT `organization` FROM `organization` AS `organization` WHERE `organization`.`organization` LIKE '%a%'; - parameters:[] +[2024-11-18>>>10:52:14]>>>Organization--SearchOrganization>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2024-11-18>>>11:48:0]>>>BSide--editBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-18>>>11:49:34]>>>BSide--editBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-18>>>11:50:34]>>>BSide--editBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-18>>>11:51:19]>>>BSide--editBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-18>>>11:51:58]>>>BSide--editBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-18>>>11:52:12]>>>BSide--editBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-18>>>11:53:16]>>>BSide--editBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-18>>>11:54:9]>>>BSide--editBSide>>>>SequelizeDatabaseError: (conn:357, no: 1366, SQLState: 22007) Incorrect integer value: '' for column 'status' at row 7 +sql: UPDATE `b-side` SET `status`=?,`role`=?,`organization`=?,`updated_at`=? WHERE `account_name` = ? AND `organization` = ? - parameters:['','','','2024-11-18 03:54:09.629','b7','1'] +[2024-11-18>>>11:55:37]>>>BSide--editBSide>>>>SequelizeDatabaseError: (conn:366, no: 1366, SQLState: 22007) Incorrect integer value: '' for column 'status' at row 7 +sql: UPDATE `b-side` SET `status`=?,`role`=?,`updated_at`=? WHERE `account_name` = ? AND `organization` = ? - parameters:['','','2024-11-18 03:55:37.944','b7','1'] +[2024-11-18>>>12:9:32]>>>BSide--editBSide>>>>SequelizeDatabaseError: (conn:372, no: 1366, SQLState: 22007) Incorrect integer value: '' for column 'status' at row 7 +sql: UPDATE `b-side` SET `status`=?,`role`=?,`organization`=?,`updated_at`=? WHERE `account_name` = ? AND `organization` = ? - parameters:['','','20241112535643O','2024-11-18 04:09:32.064','b7','1'] +[2024-11-18>>>16:18:28]>>>CSide--deleteCSide>>>>SequelizeForeignKeyConstraintError: (conn:708, no: 1451, SQLState: 23000) Cannot delete or update a parent row: a foreign key constraint fails (`cside`.`csubscribe`, CONSTRAINT `FK_csubscribe_c-side` FOREIGN KEY (`user_uid`) REFERENCES `c-side` (`uid`)) +sql: DELETE FROM `c-side` WHERE `account_name` = 'test0' AND `phone` = '18435854945' - parameters:[] diff --git a/serviceLog/2024/11/19.txt b/serviceLog/2024/11/19.txt new file mode 100644 index 0000000..9115856 --- /dev/null +++ b/serviceLog/2024/11/19.txt @@ -0,0 +1,22 @@ +[2024-11-19>>>9:55:44]>>>Insiders--editInsiders>>>>SequelizeDatabaseError: (conn:46, no: 1366, SQLState: 22007) Incorrect integer value: '' for column 'status' at row 1 +sql: UPDATE `insiders` SET `status`=?,`role`=?,`updated_at`=? WHERE `uid` = ? AND `name` = ? - parameters:['','0','2024-11-19 01:55:44.521','20240613332103M','3'] +[2024-11-19>>>9:57:28]>>>Insiders--editInsiders>>>>SequelizeDatabaseError: (conn:47, no: 1366, SQLState: 22007) Incorrect integer value: '' for column 'status' at row 1 +sql: UPDATE `insiders` SET `status`=?,`role`=?,`updated_at`=? WHERE `uid` = ? AND `name` = ? - parameters:['','','2024-11-19 01:57:28.561','20240613332103M','3'] +[2024-11-19>>>9:57:54]>>>Insiders--editInsiders>>>>SequelizeDatabaseError: (conn:48, no: 1366, SQLState: 22007) Incorrect integer value: '' for column 'role' at row 1 +sql: UPDATE `insiders` SET `status`=?,`role`=?,`updated_at`=? WHERE `uid` = ? AND `name` = ? - parameters:['1','','2024-11-19 01:57:54.206','20240613332103M','3'] +[2024-11-19>>>9:58:7]>>>Insiders--editInsiders>>>>SequelizeDatabaseError: (conn:49, no: 1366, SQLState: 22007) Incorrect integer value: '' for column 'status' at row 1 +sql: UPDATE `insiders` SET `status`=?,`role`=?,`updated_at`=? WHERE `uid` = ? AND `name` = ? - parameters:['','0','2024-11-19 01:58:07.744','20240613332103M','3'] +[2024-11-19>>>9:58:29]>>>CSide--editCSide>>>>SequelizeDatabaseError: (conn:50, no: 1366, SQLState: 22007) Incorrect integer value: '' for column 'status' at row 5 +sql: UPDATE `c-side` SET `status`=?,`role`=?,`updated_at`=? WHERE `account_name` = ? AND `phone` = ? - parameters:['','','2024-11-19 01:58:29.621','test','18435854946'] +[2024-11-19>>>12:7:2]>>>Business--addBusiness>>>>SequelizeDatabaseError: (conn:189, no: 1406, SQLState: 22001) Data too long for column 'client_id' at row 1 +sql: INSERT INTO `business` (`id`,`salt`,`login_url`,`client_url`,`temporary_id`,`client_id`,`client_secret`,`name`,`type`,`level`,`status`,`created_at`,`updated_at`) VALUES (NULL,'MKR1Df6nr75VFdmWImaGAQ==','测试0','测试0','bad36cf09e20964a67645a3f3665e180af2b047c2... - parameters:[] +[2024-11-19>>>12:9:26]>>>Business--addBusiness>>>>SequelizeDatabaseError: (conn:201, no: 1406, SQLState: 22001) Data too long for column 'client_id' at row 1 +sql: INSERT INTO `business` (`id`,`salt`,`login_url`,`client_url`,`temporary_id`,`client_id`,`client_secret`,`name`,`type`,`level`,`status`,`created_at`,`updated_at`) VALUES (NULL,'6NUGFgoWuPgsO5rfPd7RAw==','测试0','测试0','bbaeccda41ec3becdfdeb18ca39168d7515f78d4e... - parameters:[] +[2024-11-19>>>15:56:54]>>>Business--editBusiness>>>>SequelizeDatabaseError: (conn:361, no: 1366, SQLState: 22007) Incorrect integer value: '[object Object]' for column 'type' at row 6 +sql: UPDATE `business` SET `salt`=?,`login_url`=?,`client_url`=?,`temporary_id`=?,`client_id`=?,`client_secret`=?,`name`=?,`type`=?,`level`=?,`status`=?,`updated_at`=? WHERE `temporary_id` = ? AND `client_id` = ? AND `client_secret` = ? AND `name` = ? - paramet... +[2024-11-19>>>15:58:2]>>>Business--editBusiness>>>>SequelizeDatabaseError: (conn:369, no: 1366, SQLState: 22007) Incorrect integer value: '[object Object]' for column 'type' at row 6 +sql: UPDATE `business` SET `salt`=?,`login_url`=?,`client_url`=?,`temporary_id`=?,`client_id`=?,`client_secret`=?,`name`=?,`type`=?,`level`=?,`status`=?,`updated_at`=? WHERE `temporary_id` = ? AND `client_id` = ? AND `client_secret` = ? AND `name` = ? - paramet... +[2024-11-19>>>16:40:17]>>>Business--editBusiness>>>>SequelizeDatabaseError: (conn:458, no: 1366, SQLState: 22007) Incorrect integer value: '[object Object]' for column 'type' at row 7 +sql: UPDATE `business` SET `login_url`=?,`client_url`=?,`name`=?,`type`=?,`level`=?,`status`=?,`updated_at`=? WHERE `temporary_id` = ? AND `client_id` = ? AND `client_secret` = ? AND `name` = ? - parameters:['测试21','测试21','测试21','[object Object]','[object Objec... +[2024-11-19>>>16:41:37]>>>Business--editBusiness>>>>SequelizeDatabaseError: (conn:461, no: 1366, SQLState: 22007) Incorrect integer value: '[object Object]' for column 'type' at row 7 +sql: UPDATE `business` SET `login_url`=?,`client_url`=?,`name`=?,`type`=?,`level`=?,`status`=?,`updated_at`=? WHERE `temporary_id` = ? AND `client_id` = ? AND `client_secret` = ? AND `name` = ? - parameters:['测试2','测试2','测试2','[object Object]','[object Object]'... diff --git a/serviceLog/2024/11/28.txt b/serviceLog/2024/11/28.txt new file mode 100644 index 0000000..eced53c --- /dev/null +++ b/serviceLog/2024/11/28.txt @@ -0,0 +1,14 @@ +[2024-11-28>>>16:39:56]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-28>>>16:39:56]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-28>>>16:40:8]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'user_uid') +[2024-11-28>>>16:40:8]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'user_uid') +[2024-11-28>>>17:19:2]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'account_name') +[2024-11-28>>>17:19:3]>>>BdCard--showBdCard>>>>TypeError: Cannot read properties of undefined (reading 'account_name') +[2024-11-28>>>17:21:5]>>>BdCard--showBdCard>>>>SequelizeDatabaseError: (conn:715, no: 1054, SQLState: 42S22) Unknown column 'user_uid' in 'field list' +sql: SELECT `user_uid`, `account_name` FROM `b-side` AS `b-side`; - parameters:[] +[2024-11-28>>>17:21:5]>>>BdCard--showBdCard>>>>SequelizeDatabaseError: (conn:715, no: 1054, SQLState: 42S22) Unknown column 'user_uid' in 'field list' +sql: SELECT `user_uid`, `account_name` FROM `b-side` AS `b-side`; - parameters:[] +[2024-11-28>>>17:21:18]>>>BdCard--showBdCard>>>>SequelizeDatabaseError: (conn:722, no: 1054, SQLState: 42S22) Unknown column 'user_uid' in 'field list' +sql: SELECT `user_uid`, `account_name` FROM `b-side` AS `b-side`; - parameters:[] +[2024-11-28>>>17:21:18]>>>BdCard--showBdCard>>>>SequelizeDatabaseError: (conn:722, no: 1054, SQLState: 42S22) Unknown column 'user_uid' in 'field list' +sql: SELECT `user_uid`, `account_name` FROM `b-side` AS `b-side`; - parameters:[] diff --git a/serviceLog/2024/11/29.txt b/serviceLog/2024/11/29.txt new file mode 100644 index 0000000..cfea7b8 --- /dev/null +++ b/serviceLog/2024/11/29.txt @@ -0,0 +1,5 @@ +[2024-11-29>>>16:37:22]>>>BSide--editBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-29>>>16:40:53]>>>BSide--editBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-29>>>16:42:22]>>>BSide--editBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-29>>>16:43:0]>>>BSide--editBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2024-11-29>>>16:43:47]>>>BSide--editBSide>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') diff --git a/serviceLog/2024/11/4.txt b/serviceLog/2024/11/4.txt new file mode 100644 index 0000000..202ff6b --- /dev/null +++ b/serviceLog/2024/11/4.txt @@ -0,0 +1 @@ +[2024-11-4>>>16:27:20]>>>BdCard--editBdCard>>>>TypeError: Cannot set properties of undefined (setting 'updated_at') diff --git a/serviceLog/2024/11/5.txt b/serviceLog/2024/11/5.txt new file mode 100644 index 0000000..2ba33bd --- /dev/null +++ b/serviceLog/2024/11/5.txt @@ -0,0 +1,9 @@ +[2024-11-5>>>14:19:3]>>>BdCard--editBdCard>>>>TypeError: Cannot set properties of undefined (setting 'updated_at') +[2024-11-5>>>14:28:49]>>>BdCard--editBdCard>>>>SequelizeDatabaseError: (conn:226, no: 1054, SQLState: 42S22) Unknown column 'origin_createdAt' in 'where clause' +sql: UPDATE `bd-card` SET `type`=?,`updated_at`=? WHERE `card_id` = ? AND `card_imsi` = ? AND `type` = ? AND `status` = ? AND `created_at` = ? AND `updated_at` = ? AND `origin_createdAt` = ? AND `origin_updatedAt` = ? - parameters:['0','2024-11-05 06:28:49.456'... +[2024-11-5>>>14:37:16]>>>BdCard--editBdCard>>>>SequelizeDatabaseError: (conn:234, no: 1054, SQLState: 42S22) Unknown column 'origin_createdAt' in 'where clause' +sql: UPDATE `bd-card` SET `type`=?,`updated_at`=? WHERE `card_id` = ? AND `card_imsi` = ? AND `type` = ? AND `status` = ? AND `created_at` = ? AND `updated_at` = ? AND `origin_createdAt` IS NULL AND `origin_updatedAt` IS NULL - parameters:['0','2024-11-05 06:37... +[2024-11-5>>>14:45:5]>>>BdCard--editBdCard>>>>SequelizeDatabaseError: (conn:254, no: 1054, SQLState: 42S22) Unknown column 'origin_createdAt' in 'where clause' +sql: UPDATE `bd-card` SET `type`=?,`updated_at`=? WHERE `card_id` = ? AND `card_imsi` = ? AND `type` = ? AND `status` = ? AND `created_at` = ? AND `updated_at` = ? AND `origin_createdAt` = ? AND `origin_updatedAt` = ? - parameters:['2','2024-11-05 06:45:05.280'... +[2024-11-5>>>14:59:53]>>>BdCard--editBdCard>>>>SequelizeDatabaseError: (conn:270, no: 1292, SQLState: 22007) Incorrect datetime value: 'Invalid date' +sql: UPDATE `bd-card` SET `type`=?,`updated_at`=? WHERE `card_id` = ? AND `card_imsi` = ? AND `type` = ? AND `status` = ? AND `created_at` = ? AND `updated_at` = ? - parameters:['1','2024-11-05 06:59:53.451','15590202','084906100113386945',0,2,'Invalid date','I... diff --git a/serviceLog/2024/11/6.txt b/serviceLog/2024/11/6.txt new file mode 100644 index 0000000..b014f8c --- /dev/null +++ b/serviceLog/2024/11/6.txt @@ -0,0 +1,18 @@ +[2024-11-6>>>11:15:21]>>>BdCard--editBdCard>>>>SequelizeDatabaseError: (conn:164, no: 1054, SQLState: 42S22) Unknown column 'location' in 'where clause' +sql: UPDATE `bd-card` SET `type`=?,`updated_at`=? WHERE `card_id` = ? AND `card_imsi` = ? AND `type` = ? AND `status` = ? AND `created_at` = ? AND `updated_at` = ? AND `location` = ? - parameters:['1','2024-11-06 03:15:21.408','15990999','084906100113388999',0,... +[2024-11-6>>>11:16:4]>>>BdCard--editBdCard>>>>SequelizeDatabaseError: (conn:172, no: 1054, SQLState: 42S22) Unknown column 'location' in 'where clause' +sql: UPDATE `bd-card` SET `type`=?,`updated_at`=? WHERE `card_id` = ? AND `card_imsi` = ? AND `type` = ? AND `status` = ? AND `created_at` = ? AND `updated_at` = ? AND `location` = ? - parameters:['1','2024-11-06 03:16:04.810','15990999','084906100113388999',1,... +[2024-11-6>>>11:16:14]>>>BdCard--editBdCard>>>>SequelizeDatabaseError: (conn:172, no: 1054, SQLState: 42S22) Unknown column 'location' in 'where clause' +sql: UPDATE `bd-card` SET `type`=?,`updated_at`=? WHERE `card_id` = ? AND `card_imsi` = ? AND `type` = ? AND `status` = ? AND `created_at` = ? AND `updated_at` = ? AND `location` = ? - parameters:['0','2024-11-06 03:16:14.149','15990999','084906100113388999',1,... +[2024-11-6>>>11:16:24]>>>BdCard--editBdCard>>>>SequelizeDatabaseError: (conn:172, no: 1054, SQLState: 42S22) Unknown column 'location' in 'where clause' +sql: UPDATE `bd-card` SET `type`=?,`updated_at`=? WHERE `card_id` = ? AND `card_imsi` = ? AND `type` = ? AND `status` = ? AND `created_at` = ? AND `updated_at` = ? AND `location` = ? - parameters:['0','2024-11-06 03:16:24.059','15990999','084906100113388999',1,... +[2024-11-6>>>11:16:42]>>>BdCard--editBdCard>>>>SequelizeDatabaseError: (conn:178, no: 1054, SQLState: 42S22) Unknown column 'location' in 'where clause' +sql: UPDATE `bd-card` SET `type`=?,`updated_at`=? WHERE `card_id` = ? AND `card_imsi` = ? AND `type` = ? AND `status` = ? AND `created_at` = ? AND `updated_at` = ? AND `location` = ? - parameters:['0','2024-11-06 03:16:42.651','15990999','084906100113388999',1,... +[2024-11-6>>>11:16:51]>>>BdCard--editBdCard>>>>SequelizeDatabaseError: (conn:178, no: 1054, SQLState: 42S22) Unknown column 'location' in 'where clause' +sql: UPDATE `bd-card` SET `type`=?,`updated_at`=? WHERE `card_id` = ? AND `card_imsi` = ? AND `type` = ? AND `status` = ? AND `created_at` = ? AND `updated_at` = ? AND `location` = ? - parameters:['0','2024-11-06 03:16:51.315','15990999','084906100113388999',1,... +[2024-11-6>>>11:17:39]>>>BdCard--editBdCard>>>>SequelizeDatabaseError: (conn:186, no: 1054, SQLState: 42S22) Unknown column 'location' in 'where clause' +sql: UPDATE `bd-card` SET `type`=?,`updated_at`=? WHERE `card_id` = ? AND `card_imsi` = ? AND `type` = ? AND `status` = ? AND `created_at` = ? AND `updated_at` = ? AND `location` = ? - parameters:['1','2024-11-06 03:17:39.693','15990899','084906100113388899',0,... +[2024-11-6>>>11:17:54]>>>BdCard--editBdCard>>>>SequelizeDatabaseError: (conn:187, no: 1054, SQLState: 42S22) Unknown column 'location' in 'where clause' +sql: UPDATE `bd-card` SET `type`=?,`updated_at`=? WHERE `card_id` = ? AND `card_imsi` = ? AND `type` = ? AND `status` = ? AND `created_at` = ? AND `updated_at` = ? AND `location` = ? - parameters:['1','2024-11-06 03:17:54.177','15990899','084906100113388899',0,... +[2024-11-6>>>11:22:24]>>>BdCard--editBdCard>>>>SequelizeDatabaseError: (conn:213, no: 1054, SQLState: 42S22) Unknown column 'location' in 'where clause' +sql: UPDATE `bd-card` SET `type`=?,`updated_at`=? WHERE `card_id` = ? AND `card_imsi` = ? AND `type` = ? AND `status` = ? AND `location` = ? - parameters:['1','2024-11-06 03:22:24.002','15990999','084906100113388999',0,0,1] diff --git a/serviceLog/2024/11/8.txt b/serviceLog/2024/11/8.txt new file mode 100644 index 0000000..9f23f6e --- /dev/null +++ b/serviceLog/2024/11/8.txt @@ -0,0 +1,4 @@ +[2024-11-8>>>11:35:7]>>>Organization--showOrganization>>>>ReferenceError: body is not defined +[2024-11-8>>>11:35:8]>>>Organization--showOrganization>>>>ReferenceError: body is not defined +[2024-11-8>>>11:35:14]>>>BSide--showBSide>>>>ReferenceError: body is not defined +[2024-11-8>>>11:35:14]>>>BSide--showBSide>>>>ReferenceError: body is not defined diff --git a/serviceLog/2024/12/2.txt b/serviceLog/2024/12/2.txt new file mode 100644 index 0000000..bf817f0 --- /dev/null +++ b/serviceLog/2024/12/2.txt @@ -0,0 +1,8 @@ +[2024-12-2>>>17:24:59]>>>BindRecord--showBindRecord>>>>SequelizeDatabaseError: (conn:181, no: 1064, SQLState: 42000) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-5, 5' at line 1 +sql: SELECT `user_uid`, `card_id`, `type`, `created_at` FROM `bind-brecord` AS `bind-brecord` ORDER BY `bind-brecord`.`created_at` DESC LIMIT -5, 5; - parameters:[] +[2024-12-2>>>17:24:59]>>>BindRecord--showBindRecord>>>>SequelizeDatabaseError: (conn:181, no: 1064, SQLState: 42000) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-5, 5' at line 1 +sql: SELECT `user_uid`, `card_id`, `type`, `created_at` FROM `bind-brecord` AS `bind-brecord` ORDER BY `bind-brecord`.`created_at` DESC LIMIT -5, 5; - parameters:[] +[2024-12-2>>>17:25:1]>>>BindRecord--showBindRecord>>>>SequelizeDatabaseError: (conn:180, no: 1064, SQLState: 42000) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-5, 5' at line 1 +sql: SELECT `user_uid`, `card_id`, `type`, `created_at` FROM `bind-brecord` AS `bind-brecord` ORDER BY `bind-brecord`.`created_at` DESC LIMIT -5, 5; - parameters:[] +[2024-12-2>>>17:25:1]>>>BindRecord--showBindRecord>>>>SequelizeDatabaseError: (conn:180, no: 1064, SQLState: 42000) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-5, 5' at line 1 +sql: SELECT `user_uid`, `card_id`, `type`, `created_at` FROM `bind-brecord` AS `bind-brecord` ORDER BY `bind-brecord`.`created_at` DESC LIMIT -5, 5; - parameters:[] diff --git a/serviceLog/2024/12/3.txt b/serviceLog/2024/12/3.txt new file mode 100644 index 0000000..deeb05a --- /dev/null +++ b/serviceLog/2024/12/3.txt @@ -0,0 +1,12 @@ +[2024-12-3>>>9:57:5]>>>BindRecord--showBindRecord>>>>SequelizeDatabaseError: (conn:95, no: 1064, SQLState: 42000) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-5, 5' at line 1 +sql: SELECT `user_uid`, `card_id`, `type`, `created_at` FROM `bind-brecord` AS `bind-brecord` ORDER BY `bind-brecord`.`created_at` DESC LIMIT -5, 5; - parameters:[] +[2024-12-3>>>9:57:7]>>>BindRecord--showBindRecord>>>>SequelizeDatabaseError: (conn:98, no: 1064, SQLState: 42000) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-5, 5' at line 1 +sql: SELECT `user_uid`, `card_id`, `type`, `created_at` FROM `bind-brecord` AS `bind-brecord` ORDER BY `bind-brecord`.`created_at` DESC LIMIT -5, 5; - parameters:[] +[2024-12-3>>>9:57:7]>>>BindRecord--showBindRecord>>>>SequelizeDatabaseError: (conn:98, no: 1064, SQLState: 42000) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-5, 5' at line 1 +sql: SELECT `user_uid`, `card_id`, `type`, `created_at` FROM `bind-brecord` AS `bind-brecord` ORDER BY `bind-brecord`.`created_at` DESC LIMIT -5, 5; - parameters:[] +[2024-12-3>>>10:7:23]>>>BindRecord--showBindRecord>>>>SequelizeDatabaseError: (conn:142, no: 1064, SQLState: 42000) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-5, 5' at line 1 +sql: SELECT `user_uid`, `card_id`, `type`, `created_at` FROM `bind-brecord` AS `bind-brecord` ORDER BY `bind-brecord`.`created_at` DESC LIMIT -5, 5; - parameters:[] +[2024-12-3>>>10:7:49]>>>BindRecord--showBindRecord>>>>SequelizeDatabaseError: (conn:152, no: 1064, SQLState: 42000) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-5, 5' at line 1 +sql: SELECT `user_uid`, `card_id`, `type`, `created_at` FROM `bind-brecord` AS `bind-brecord` ORDER BY `bind-brecord`.`created_at` DESC LIMIT -5, 5; - parameters:[] +[2024-12-3>>>11:11:33]>>>BindRecord--showBindRecord>>>>SequelizeDatabaseError: (conn:354, no: 1064, SQLState: 42000) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-5, 5' at line 1 +sql: SELECT `user_uid`, `card_id`, `type`, `created_at` FROM `bind-brecord` AS `bind-brecord` ORDER BY `bind-brecord`.`created_at` DESC LIMIT -5, 5; - parameters:[] diff --git a/serviceLog/2025/6/18.txt b/serviceLog/2025/6/18.txt new file mode 100644 index 0000000..8414118 --- /dev/null +++ b/serviceLog/2025/6/18.txt @@ -0,0 +1,22 @@ +[2025-6-18>>>15:29:21]>>>ContestChoiceTopic--showChoiceTopic>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. +[2025-6-18>>>15:29:21]>>>ContestChoiceTopic--showChoiceTopic>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. +[2025-6-18>>>15:32:59]>>>ContestChoiceTopic--showChoiceTopic>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. +[2025-6-18>>>15:33:0]>>>ContestChoiceTopic--showChoiceTopic>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. +[2025-6-18>>>15:38:2]>>>ContestMsg--showContest>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. +[2025-6-18>>>15:38:3]>>>ContestMsg--showContest>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. +[2025-6-18>>>15:46:52]>>>ContestMsg--showContest>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. +[2025-6-18>>>15:46:52]>>>ContestMsg--showContest>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. +[2025-6-18>>>15:47:2]>>>ContestAccount--showAccount>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. +[2025-6-18>>>15:47:2]>>>ContestAccount--showAccount>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. +[2025-6-18>>>15:54:52]>>>ContestAccount--showAccount>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. +[2025-6-18>>>15:54:52]>>>ContestAccount--showAccount>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. +[2025-6-18>>>15:55:6]>>>ContestMsg--showContest>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. +[2025-6-18>>>15:55:6]>>>ContestMsg--showContest>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. +[2025-6-18>>>15:56:5]>>>ContestMsg--showContest>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. +[2025-6-18>>>15:56:6]>>>ContestMsg--showContest>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. +[2025-6-18>>>15:56:23]>>>ContestAccount--showAccount>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. +[2025-6-18>>>15:56:24]>>>ContestAccount--showAccount>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. +[2025-6-18>>>15:56:44]>>>ContestMsg--showContest>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. +[2025-6-18>>>15:56:44]>>>ContestMsg--showContest>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. +[2025-6-18>>>15:56:45]>>>ContestAccount--showAccount>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. +[2025-6-18>>>15:56:46]>>>ContestAccount--showAccount>>>>TypeError: Cannot destructure property 'offset' of 'body' as it is undefined. diff --git a/serviceLog/2025/6/20.txt b/serviceLog/2025/6/20.txt new file mode 100644 index 0000000..238cbc1 --- /dev/null +++ b/serviceLog/2025/6/20.txt @@ -0,0 +1,28 @@ +[2025-6-20>>>14:14:39]>>>ContestChoiceTopic--editChoiceTopic>>>>ReferenceError: password is not defined +[2025-6-20>>>14:29:22]>>>ContestChoiceTopic--editChoiceTopic>>>>ReferenceError: systemMonitoring is not defined +[2025-6-20>>>14:30:5]>>>ContestChoiceTopic--editChoiceTopic>>>>ReferenceError: systemMonitoring is not defined +[2025-6-20>>>15:31:42]>>>ContestChoiceTopic--addChoiceTopic>>>>SequelizeDatabaseError: (conn:429, no: 1406, SQLState: 22001) Data too long for column 'answer' at row 1 +sql: INSERT INTO `choice-topic` (`id`,`topic`,`options_a`,`options_b`,`options_c`,`options_d`,`answer`) VALUES (NULL,'测试','测试','测试','测试','测试','测试'); - parameters:[] +[2025-6-20>>>15:33:0]>>>ContestChoiceTopic--addChoiceTopic>>>>SequelizeDatabaseError: (conn:443, no: 1406, SQLState: 22001) Data too long for column 'answer' at row 1 +sql: INSERT INTO `choice-topic` (`id`,`topic`,`options_a`,`options_b`,`options_c`,`options_d`,`answer`) VALUES (NULL,'测试','测试','测试','测试','测试','1111'); - parameters:[] +[2025-6-20>>>15:37:58]>>>ContestMsg--editContest>>>>ReferenceError: password is not defined +[2025-6-20>>>16:12:52]>>>ContestMsg--addContest>>>>SequelizeDatabaseError: (conn:588, no: 1054, SQLState: 42S22) Unknown column 'NaN' in 'field list' +sql: INSERT INTO `contest` (`id`,`uid`,`contest_name`,`contest_organizers`,`contest_term`,`type`,`status`,`online_start`,`online_end`,`offline_start`,`offline_end`,`contest_start`,`contest_end`,`created_at`) VALUES (NULL,'20250620029077H','测试','测试','1',0,NaN,'2... - parameters:[] +[2025-6-20>>>16:14:36]>>>ContestMsg--addContest>>>>SequelizeDatabaseError: (conn:597, no: 1054, SQLState: 42S22) Unknown column 'NaN' in 'field list' +sql: INSERT INTO `contest` (`id`,`uid`,`contest_name`,`contest_organizers`,`contest_term`,`type`,`status`,`online_start`,`online_end`,`offline_start`,`offline_end`,`contest_start`,`contest_end`,`created_at`) VALUES (NULL,'20250620087044H','测试','测试','1',0,NaN,'2... - parameters:[] +[2025-6-20>>>16:37:52]>>>ContestExamination--editExamination>>>>TypeError: Cannot set properties of undefined (setting 'updated_at') +[2025-6-20>>>16:40:51]>>>ContestExamination--editExamination>>>>TypeError: Cannot set properties of undefined (setting 'updated_at') +[2025-6-20>>>17:31:38]>>>ContestAccount--addAccount>>>>SequelizeForeignKeyConstraintError: (conn:836, no: 1452, SQLState: 23000) Cannot add or update a child row: a foreign key constraint fails (`bdcontest`.`account`, CONSTRAINT `FK_account_contest` FOREIGN KEY (`contest_uid`) REFERENCES `contest` (`uid`)) +sql: INSERT INTO `account` (`id`,`uid`,`salt`,`contest_uid`,`account_name`,`password`,`status`,`created_at`,`login_status`) VALUES (NULL,'20250620268083T','hoylmsK1YAx8eatfCDYgmw==','','测试','c886f9d392fd72d5d978cf3923fc7eccb23cbc2661c63c59b0267ec2bcf7ebe0',0,'2... - parameters:[] +[2025-6-20>>>17:33:1]>>>ContestAccount--addAccount>>>>SequelizeForeignKeyConstraintError: (conn:845, no: 1452, SQLState: 23000) Cannot add or update a child row: a foreign key constraint fails (`bdcontest`.`account`, CONSTRAINT `FK_account_contest` FOREIGN KEY (`contest_uid`) REFERENCES `contest` (`uid`)) +sql: INSERT INTO `account` (`id`,`uid`,`salt`,`contest_uid`,`account_name`,`password`,`status`,`created_at`,`login_status`) VALUES (NULL,'20250620044025T','y0ZaitklaA28uznc9yeYZg==','','测试','8f97e52b05ae54cdfe64e89df517e23371288b23ec9cfac379ee9ff5f8cdc6bd',0,'2... - parameters:[] +[2025-6-20>>>17:37:58]>>>ContestAccount--editAccount>>>>SequelizeDatabaseError: (conn:868, no: 1366, SQLState: 22007) Incorrect integer value: '[object Object]' for column 'status' at row 1 +sql: UPDATE `account` SET `contest_uid`=?,`account_name`=?,`status`=? WHERE `uid` = ? AND `contest_uid` = ? AND `account_name` = ? AND `status` = ? AND `created_at` = ? AND `login_status` = ? - parameters:['20240613698218H','测试','[object Object]','2025062011902... +[2025-6-20>>>17:44:19]>>>ContestAccount--editAccount>>>>SequelizeDatabaseError: (conn:936, no: 1366, SQLState: 22007) Incorrect integer value: '[object Object]' for column 'status' at row 1 +sql: UPDATE `account` SET `contest_uid`=?,`account_name`=?,`status`=? WHERE `uid` = ? AND `contest_uid` = ? AND `account_name` = ? AND `status` = ? AND `created_at` = ? AND `login_status` = ? - parameters:['20240613698218H','测试00','[object Object]','20250620119... +[2025-6-20>>>17:45:34]>>>ContestAccount--editAccount>>>>SequelizeDatabaseError: (conn:939, no: 1366, SQLState: 22007) Incorrect integer value: '[object Object]' for column 'status' at row 1 +sql: UPDATE `account` SET `contest_uid`=?,`account_name`=?,`status`=? WHERE `uid` = ? AND `contest_uid` = ? AND `account_name` = ? AND `status` = ? AND `created_at` = ? AND `login_status` = ? - parameters:['20240613698218H','test','[object Object]','20240613698... +[2025-6-20>>>17:47:52]>>>ContestAccount--editAccount>>>>SequelizeDatabaseError: (conn:941, no: 1366, SQLState: 22007) Incorrect integer value: '[object Object]' for column 'status' at row 1 +sql: UPDATE `account` SET `contest_uid`=?,`account_name`=?,`status`=? WHERE `uid` = ? AND `contest_uid` = ? AND `account_name` = ? AND `status` = ? AND `created_at` = ? AND `login_status` = ? - parameters:['20240613698218H','test','[object Object]','20240613698... +[2025-6-20>>>17:48:53]>>>ContestAccount--editAccount>>>>SequelizeDatabaseError: (conn:945, no: 1366, SQLState: 22007) Incorrect integer value: '[object Object]' for column 'status' at row 1 +sql: UPDATE `account` SET `contest_uid`=?,`account_name`=?,`status`=? WHERE `uid` = ? AND `contest_uid` = ? AND `account_name` = ? AND `status` = ? AND `created_at` = ? AND `login_status` = ? - parameters:['20240613698218H','test','[object Object]','20240613698... diff --git a/serviceLog/2026/3/12.txt b/serviceLog/2026/3/12.txt new file mode 100644 index 0000000..35117d4 --- /dev/null +++ b/serviceLog/2026/3/12.txt @@ -0,0 +1,8 @@ +[2026-3-12>>>15:16:34]>>>BindRecord--showBindRecord>>>>TypeError: Cannot read properties of undefined (reading 'rows') +[2026-3-12>>>15:16:38]>>>BindRecord--showBindRecord>>>>TypeError: Cannot read properties of undefined (reading 'rows') +[2026-3-12>>>15:16:38]>>>BindRecord--showBindRecord>>>>TypeError: Cannot read properties of undefined (reading 'rows') +[2026-3-12>>>15:16:49]>>>BindRecord--showBindRecord>>>>TypeError: Cannot read properties of undefined (reading 'rows') +[2026-3-12>>>15:16:54]>>>BindRecord--showBindRecord>>>>TypeError: Cannot read properties of undefined (reading 'rows') +[2026-3-12>>>15:16:55]>>>BindRecord--showBindRecord>>>>TypeError: Cannot read properties of undefined (reading 'rows') +[2026-3-12>>>15:16:59]>>>BindRecord--showBindRecord>>>>TypeError: Cannot read properties of undefined (reading 'rows') +[2026-3-12>>>15:17:3]>>>BindRecord--showBindRecord>>>>TypeError: Cannot read properties of undefined (reading 'rows') diff --git a/serviceLog/2026/3/13.txt b/serviceLog/2026/3/13.txt new file mode 100644 index 0000000..5229dd4 --- /dev/null +++ b/serviceLog/2026/3/13.txt @@ -0,0 +1,50 @@ +[2026-3-13>>>15:11:1]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>15:11:1]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>15:11:3]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>15:11:4]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>15:11:6]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>15:11:6]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>15:11:11]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>15:11:11]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>15:32:15]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>15:32:15]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>15:32:20]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>15:32:21]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>17:36:29]>>>SNAdmin--showAllocationSNRecord>>>>SequelizeDatabaseError: (conn:713, no: 1054, SQLState: 42S22) Unknown column 'length' in 'field list' +sql: SELECT `user_uid`, `length`, `sn_set` FROM `bind-brecord` AS `bind-brecord`; - parameters:[] +[2026-3-13>>>17:36:33]>>>SNAdmin--showAllocationSNRecord>>>>SequelizeDatabaseError: (conn:713, no: 1054, SQLState: 42S22) Unknown column 'length' in 'field list' +sql: SELECT `user_uid`, `length`, `sn_set` FROM `bind-brecord` AS `bind-brecord`; - parameters:[] +[2026-3-13>>>17:36:33]>>>SNAdmin--showAllocationSNRecord>>>>SequelizeDatabaseError: (conn:718, no: 1054, SQLState: 42S22) Unknown column 'length' in 'field list' +sql: SELECT `user_uid`, `length`, `sn_set` FROM `bind-brecord` AS `bind-brecord`; - parameters:[] +[2026-3-13>>>17:37:10]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>17:37:10]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>17:37:11]>>>BindSNRecord--showBindSNRecord>>>>SequelizeDatabaseError: (conn:720, no: 1146, SQLState: 42S02) Table 'bside.bind-csnrecord' doesn't exist +sql: SELECT `user_uid`, `sn_number`, `created_at` FROM `bind-csnrecord` AS `bind-csnrecord`; - parameters:[] +[2026-3-13>>>17:37:11]>>>BindSNRecord--showBindSNRecord>>>>SequelizeDatabaseError: (conn:722, no: 1146, SQLState: 42S02) Table 'bside.bind-csnrecord' doesn't exist +sql: SELECT `user_uid`, `sn_number`, `created_at` FROM `bind-csnrecord` AS `bind-csnrecord`; - parameters:[] +[2026-3-13>>>17:42:49]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>17:42:49]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>17:42:51]>>>BindSNRecord--showBindSNRecord>>>>SequelizeDatabaseError: (conn:770, no: 1146, SQLState: 42S02) Table 'bside.bind-csnrecord' doesn't exist +sql: SELECT `user_uid`, `sn_number`, `created_at` FROM `bind-csnrecord` AS `bind-csnrecord`; - parameters:[] +[2026-3-13>>>17:42:51]>>>BindSNRecord--showBindSNRecord>>>>SequelizeDatabaseError: (conn:770, no: 1146, SQLState: 42S02) Table 'bside.bind-csnrecord' doesn't exist +sql: SELECT `user_uid`, `sn_number`, `created_at` FROM `bind-csnrecord` AS `bind-csnrecord`; - parameters:[] +[2026-3-13>>>17:45:15]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>17:45:15]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>17:45:16]>>>BindSNRecord--showBindSNRecord>>>>SequelizeDatabaseError: (conn:798, no: 1146, SQLState: 42S02) Table 'bside.bind-csnrecord' doesn't exist +sql: SELECT `user_uid`, `sn_number`, `created_at` FROM `bind-csnrecord` AS `bind-csnrecord`; - parameters:[] +[2026-3-13>>>17:45:16]>>>BindSNRecord--showBindSNRecord>>>>SequelizeDatabaseError: (conn:798, no: 1146, SQLState: 42S02) Table 'bside.bind-csnrecord' doesn't exist +sql: SELECT `user_uid`, `sn_number`, `created_at` FROM `bind-csnrecord` AS `bind-csnrecord`; - parameters:[] +[2026-3-13>>>17:48:21]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>17:48:22]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>17:48:22]>>>BindSNRecord--showBindSNRecord>>>>SequelizeDatabaseError: (conn:804, no: 1146, SQLState: 42S02) Table 'bside.bind-csnrecord' doesn't exist +sql: SELECT `user_uid`, `sn_number`, `created_at` FROM `bind-csnrecord` AS `bind-csnrecord`; - parameters:[] +[2026-3-13>>>17:48:22]>>>BindSNRecord--showBindSNRecord>>>>SequelizeDatabaseError: (conn:804, no: 1146, SQLState: 42S02) Table 'bside.bind-csnrecord' doesn't exist +sql: SELECT `user_uid`, `sn_number`, `created_at` FROM `bind-csnrecord` AS `bind-csnrecord`; - parameters:[] +[2026-3-13>>>17:49:27]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>17:49:27]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>17:50:56]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>17:50:56]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>17:53:9]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>17:53:9]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>17:54:35]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') +[2026-3-13>>>17:54:35]>>>SN--showSN>>>>TypeError: Cannot read properties of undefined (reading 'findAll') diff --git a/serviceLog/2026/3/16.txt b/serviceLog/2026/3/16.txt new file mode 100644 index 0000000..207aa54 --- /dev/null +++ b/serviceLog/2026/3/16.txt @@ -0,0 +1,8 @@ +[2026-3-16>>>11:35:18]>>>SNAdmin--showAllocationSNRecord>>>>SequelizeDatabaseError: (conn:161, no: 1054, SQLState: 42S22) Unknown column 'length' in 'field list' +sql: SELECT `user_uid`, `length`, `sn_set` FROM `bind-bsnrecord` AS `bind-bsnrecord`; - parameters:[] +[2026-3-16>>>11:35:18]>>>SNAdmin--showAllocationSNRecord>>>>SequelizeDatabaseError: (conn:160, no: 1054, SQLState: 42S22) Unknown column 'length' in 'field list' +sql: SELECT `user_uid`, `length`, `sn_set` FROM `bind-bsnrecord` AS `bind-bsnrecord`; - parameters:[] +[2026-3-16>>>11:45:30]>>>SNAdmin--showAllocationSNRecord>>>>SequelizeDatabaseError: (conn:165, no: 1054, SQLState: 42S22) Unknown column 'length' in 'field list' +sql: SELECT `user_uid`, `length`, `sn_set` FROM `bind-bsnrecord` AS `bind-bsnrecord`; - parameters:[] +[2026-3-16>>>11:45:30]>>>SNAdmin--showAllocationSNRecord>>>>SequelizeDatabaseError: (conn:165, no: 1054, SQLState: 42S22) Unknown column 'length' in 'field list' +sql: SELECT `user_uid`, `length`, `sn_set` FROM `bind-bsnrecord` AS `bind-bsnrecord`; - parameters:[] diff --git a/test/app/controller/home.test.js b/test/app/controller/home.test.js new file mode 100644 index 0000000..ea43dbb --- /dev/null +++ b/test/app/controller/home.test.js @@ -0,0 +1,23 @@ +const { strict: assert } = require('node:assert'); +const path = require('node:path'); +const { statSync } = require('node:fs'); +const { app } = require('egg-mock/bootstrap'); + +describe('test/app/controller/home.test.js', () => { + it('should assert', async () => { + const pkg = require('../../../package.json'); + assert(app.config.keys.startsWith(pkg.name)); + }); + + it('should typings exists', async () => { + const typings = path.join(__dirname, '../../../typings'); + assert(statSync(typings)); + }); + + it('should GET /', async () => { + return app.httpRequest() + .get('/') + .expect('hi, egg') + .expect(200); + }); +});