commit 359dff3cad05fdcb7f9c1d8c015289954dba44bb Author: qubiaobiao <3294694717@qq.com> Date: Fri Mar 27 17:54:10 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/README.md b/README.md new file mode 100644 index 0000000..6a02535 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# open-map-assistant + + + +## 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/Admin.js b/app/controller/Admin.js new file mode 100644 index 0000000..9962b08 --- /dev/null +++ b/app/controller/Admin.js @@ -0,0 +1,195 @@ +const Controller = require('../core/base_controller'); + +const fs = require('fs'); + +const fileName = "Admin"; + +class AdminController extends Controller { + // 管理系统新增普通管理员账号信息 + async addAdmin() { + 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('E'); + element.salt = this.encryptRequest(salt); + element.account_name = this.decryptRequest(element.account_name); + element.password = this.shaForm('123456', salt); + element.role = Number(this.decryptRequest(element.role)); + element.status = 0; + element.created_at = new Date(); + element.updated_at = new Date(); + element.login_status = 0; + }); + const result = await ctx.service.admin.addAdmin(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 + "--" + "addAdmin"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统查看普通管理员账号信息 + async showAdmin() { + 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.admin.showAdmin(uid, body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let adminMsg = []; + result.rows.forEach(element => { + adminMsg.push(element.dataValues); + }); + const data = { + adminMsg, + count: result.count + }; + this.setResponse(ctx, 200, '操作成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showAdmin"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统编辑普通管理员账号信息 + async editAdmin() { + 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 { model, updateMsg, requestMsg } = ctx.request.body; + const modelType = this.decryptRequest(model); + const result = await ctx.service.admin.editAdmin(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 + "--" + "editAdmin"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统删除普通管理员账号信息 + async deleteAdmin() { + 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 { model, password, requestMsg } = ctx.request.body; + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.admin.deleteAdmin(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 + "--" + "deleteAdmin"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统导出普通管理员账号信息数据 + async downloadAdminData() { + 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 { form, searchMsg, dataHeaders } = ctx.request.body; + const result = await ctx.service.admin.downloadAdminData(uid, searchMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result.code) { + const file = this.downloadData(form, result.data, dataHeaders); + if (file) { + const { filePath, completeName, buf } = file; + try { + fs.writeFileSync(filePath, Buffer.from(buf)); + const data = { + // 本机服务器地址 + // 'http://127.0.0.1:8020' + // 'http://192.168.31.28:8020' + // 公司服务器地址 + // 'http://123.57.205.46:8020' + // 'http://certadmin.hwasmart.com//bdTrainingExamManager' + fileUrl: 'http://127.0.0.1:8020' + `/public/${completeName}?time=${new Date().getTime()}`, + fileName: completeName, + } + this.setResponse(ctx, 200, '文件已成功写入', "deconstruction", data); + setTimeout(() => { + fs.unlinkSync(filePath); + }, 600000); + } catch (error) { + this.setResponse(ctx, 500, '写入文件时发生错误', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "downloadAdminData"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = AdminController; diff --git a/app/controller/Application.js b/app/controller/Application.js new file mode 100644 index 0000000..d824f48 --- /dev/null +++ b/app/controller/Application.js @@ -0,0 +1,222 @@ +const Controller = require('../core/base_controller'); + +const fs = require('fs'); + +const fileName = "Application"; + +class ApplicationController extends Controller { + // 管理系统新增用户报名信息 + async addApplication() { + 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; + let userMsgObj = { + user_name: [], + identity_card: [] + }; + requestMsg.forEach(item => { + item.user_name = this.decryptRequest(item.user_name); + item.identity_card = this.decryptRequest(item.identity_card); + item.exam_uid = this.decryptRequest(item.exam_uid); + item.source = this.decryptRequest(item.source); + item.status = Number(this.decryptRequest(item.status)); + item.pay_status = Number(this.decryptRequest(item.pay_status)); + item.result = this.decryptRequest(item.result); + userMsgObj.user_name.push(item.user_name); + userMsgObj.identity_card.push(item.identity_card); + }); + const result = await ctx.service.application.addApplication(userMsgObj, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + if (result.code == 400) { + this.setResponse(ctx, 400, '全部操作失败, 请前往导入错误记录页面查看导入错误的数据', "none"); + } else if (result.code == 300) { + this.setResponse(ctx, 300, '部分操作成功, 请前往导入错误记录页面查看导入错误的数据', "none"); + } else if (result.code == 200) { + this.setResponse(ctx, 200, '操作成功', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "addApplication"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统查看用户报名信息 + async showApplication() { + 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.application.showApplication(uid, body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let idCardArr = []; + result.rows.forEach(item => { + idCardArr.push(item.dataValues.examinee.dataValues.identity_card); + }); + const photoResult = await ctx.service.search.checkPhoto(idCardArr); + let applicationMsg = []; + result.rows.forEach(element => { + if (photoResult == "error") { + element.dataValues.userPhotoUrl = '#'; + } + if (photoResult) { + ctx.set('Cache-Control', 'no-cache, no-store, must-revalidate'); + ctx.set("Pragma", "no-cache"); + ctx.set("Expires", "0"); + photoResult.forEach(item => { + if (element.dataValues.examinee.dataValues.identity_card == item.identity_card) { + element.dataValues.userPhotoUrl = item.photoUrl; + } + }); + } + applicationMsg.push(element.dataValues); + }); + const data = { + applicationMsg, + count: result.count + }; + this.setResponse(ctx, 200, '操作成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showApplication"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统编辑用户报名信息 + async editApplication() { + 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 { model, updateMsg, requestMsg } = ctx.request.body; + const modelType = this.decryptRequest(model); + const result = await ctx.service.application.editApplication(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 + "--" + "editApplication"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统删除用户报名信息 + async deleteApplication() { + 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 { model, password, requestMsg } = ctx.request.body; + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.application.deleteApplication(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 + "--" + "deleteApplication"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统导出考生报名信息数据 + async downloadApplicationData() { + 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 { form, searchMsg, dataHeaders } = ctx.request.body; + const result = await ctx.service.application.downloadApplicationData(uid, searchMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result.code) { + const file = this.downloadData(form, result.data, dataHeaders); + if (file) { + const { filePath, completeName, buf } = file; + try { + fs.writeFileSync(filePath, Buffer.from(buf)); + const data = { + // 本机服务器地址 + // 'http://127.0.0.1:8020' + // 'http://192.168.31.28:8020' + // 公司服务器地址 + // 'http://123.57.205.46:8020' + // 'http://certadmin.hwasmart.com//bdTrainingExamManager' + fileUrl: 'http://127.0.0.1:8020' + `/public/${completeName}?time=${new Date().getTime()}`, + fileName: completeName, + } + this.setResponse(ctx, 200, '文件已成功写入', "deconstruction", data); + setTimeout(() => { + fs.unlinkSync(filePath); + }, 600000); + } catch (error) { + this.setResponse(ctx, 500, '写入文件时发生错误', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "downloadApplicationData"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = ApplicationController; diff --git a/app/controller/Audit.js b/app/controller/Audit.js new file mode 100644 index 0000000..811813a --- /dev/null +++ b/app/controller/Audit.js @@ -0,0 +1,71 @@ +const Controller = require('../core/base_controller'); + +const fileName = "Audit"; + +class AuditController extends Controller { + // 管理系统查看用户关键信息变更 + async auditList() { + 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.audit.auditList(uid, body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let auditMsg = []; + result.rows.forEach(element => { + auditMsg.push(element.dataValues); + }); + const data = { + auditMsg: auditMsg, + count: result.count + }; + this.setResponse(ctx, 200, '操作成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "auditList"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统审核用户关键信息变更 + async userMsgAudit() { + 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.audit.userMsgAudit(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 + "--" + "userMsgAudit"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = AuditController; diff --git a/app/controller/Cntev.js b/app/controller/Cntev.js new file mode 100644 index 0000000..a244354 --- /dev/null +++ b/app/controller/Cntev.js @@ -0,0 +1,79 @@ +const Controller = require('../core/base_controller'); + +const fileName = "Cntev"; + +class CntevController extends Controller { + // 核验用户身份证二要素 + async CNTEV() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const finishedList = ctx.request.body.finishedList; + const failedResult = await ctx.service.cntev.siftFailedList(finishedList); + const validateResult = await ctx.service.cntev.validateList(finishedList); + if (failedResult == "error" || validateResult == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + let finishList = []; + if (failedResult && failedResult.length > 0) { + failedResult.forEach(async element => { + const check = await ctx.app.redis.get('db3').get(element.dataValues.identity_card); + if (check == null) { + ctx.curl('http://127.0.0.1:' + 8011 + '/CNTEV', { + dataType: 'json', + contentType: 'application/x-www-form-urlencoded', + method: 'POST', + timeout: 3000, + data: { + user_name: element.dataValues.user_name, + identity_card: element.dataValues.identity_card, + }, + }); + } else { + await ctx.service.cntev.updateCNTEV(element.dataValues.user_name, element.dataValues.identity_card, JSON.parse(check).real_check); + await ctx.app.redis.get('db3').del(element.dataValues.identity_card); + finishList.push(element.dataValues.identity_card); + } + }); + } + if (validateResult && validateResult.length > 0) { + validateResult.forEach(async element => { + const check = await ctx.app.redis.get('db3').get(element.dataValues.identity_card); + if (check == null) { + ctx.curl('http://127.0.0.1:' + 8011 + '/CNTEV', { + dataType: 'json', + contentType: 'application/x-www-form-urlencoded', + method: 'POST', + timeout: 3000, + data: { + user_name: element.dataValues.user_name, + identity_card: element.dataValues.identity_card, + }, + }); + } else { + await ctx.service.cntev.updateCNTEV(element.dataValues.user_name, element.dataValues.identity_card, JSON.parse(check).real_check); + await ctx.app.redis.get('db3').del(element.dataValues.identity_card); + finishList.push(element.dataValues.identity_card); + } + }); + } + if (failedResult && failedResult.length > 0 || validateResult && validateResult.length > 0) { + const data = { finishList }; + this.setResponse(ctx, 303, '核验中', "deconstruction", data); + } else { + this.setResponse(ctx, 200, '核验成功', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "CNTEV"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = CntevController; diff --git a/app/controller/Diff.js b/app/controller/Diff.js new file mode 100644 index 0000000..5da5bf0 --- /dev/null +++ b/app/controller/Diff.js @@ -0,0 +1,79 @@ +const Controller = require('../core/base_controller'); + +const fileName = "Diff"; + +class DiffController extends Controller { + // 比较身份证号 + async diffIdentityCard() { + const { ctx } = this; + try { + const body = ctx.request.body; + const { identity_card, type, data } = body; + const uid = data == 'null' ? null : data.split('?')[0]; + const result = await ctx.service.diff.diffIdentityCard(identity_card, type, uid); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (!result) { + this.setResponse(ctx, 404, '该身份证号已注册', "none"); + } else { + this.setResponse(ctx, 200, '验证通过', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "diffIdentityCard"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 比较邮箱 + async diffEmail() { + const { ctx } = this; + try { + const body = ctx.request.body; + const { email, type, data } = body; + const uid = data == 'null' ? null : data.split('?')[0]; + const result = await ctx.service.diff.diffEmail(email, type, uid); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (!result) { + this.setResponse(ctx, 404, '该邮箱已经注册', "none"); + } else { + this.setResponse(ctx, 200, '验证通过', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "diffEmail"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 比较电话号码 + async diffPhone() { + const { ctx } = this; + try { + const body = ctx.request.body; + const { phone, type, data } = body; + const uid = data == 'null' ? null : data.split('?')[0]; + const result = await ctx.service.diff.diffPhone(phone, type, uid); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (!result) { + this.setResponse(ctx, 404, '该手机号已注册', "none"); + } else { + this.setResponse(ctx, 200, '验证通过', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "diffPhone"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = DiffController; diff --git a/app/controller/Download.js b/app/controller/Download.js new file mode 100644 index 0000000..1a414e5 --- /dev/null +++ b/app/controller/Download.js @@ -0,0 +1,427 @@ +const Controller = require('../core/base_controller'); + +const fs = require('fs'); +const path = require('path'); + +const fileName = "Download"; + +class DownloadController extends Controller { + // 导出小鹅通导入用户 + async importXiaoeTech() { + 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 { form, searchMsg, importForm, dataHeaders } = ctx.request.body; + const result = await ctx.service.download.importXiaoeTech(uid, searchMsg, importForm); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result.code) { + const file = this.downloadData(form, result.data, dataHeaders); + if (file) { + const { filePath, completeName, buf } = file; + try { + fs.writeFileSync(filePath, Buffer.from(buf)); + const data = { + // 本机服务器地址 + // 'http://127.0.0.1:8020' + // 'http://192.168.31.28:8020' + // 公司服务器地址 + // 'http://123.57.205.46:8020' + // 'http://certadmin.hwasmart.com//bdTrainingExamManager' + fileUrl: 'http://127.0.0.1:8020' + `/public/${completeName}?time=${new Date().getTime()}`, + fileName: completeName, + } + this.setResponse(ctx, 200, '文件已成功写入', "deconstruction", data); + setTimeout(() => { + fs.unlinkSync(filePath); + }, 600000); + } catch (error) { + this.setResponse(ctx, 500, '写入文件时发生错误', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "importXiaoeTech"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 导出小鹅通开课学员 + async commencementXiaoeTech() { + 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 { form, searchMsg, importForm, dataHeaders } = ctx.request.body; + const result = await ctx.service.download.commencementXiaoeTech(uid, searchMsg, importForm); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result.code) { + const file = this.downloadData(form, result.data, dataHeaders); + if (file) { + const { filePath, completeName, buf } = file; + try { + fs.writeFileSync(filePath, Buffer.from(buf)); + const data = { + // 本机服务器地址 + // 'http://127.0.0.1:8020' + // 'http://192.168.31.28:8020' + // 公司服务器地址 + // 'http://123.57.205.46:8020' + // 'http://certadmin.hwasmart.com//bdTrainingExamManager' + fileUrl: 'http://127.0.0.1:8020' + `/public/${completeName}?time=${new Date().getTime()}`, + fileName: completeName, + } + this.setResponse(ctx, 200, '文件已成功写入', "deconstruction", data); + setTimeout(() => { + fs.unlinkSync(filePath); + }, 600000); + } catch (error) { + this.setResponse(ctx, 500, '写入文件时发生错误', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "commencementXiaoeTech"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 导出批量报名导入 excel 表 + async importApplicationData() { + 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 { form, searchMsg, importForm, dataHeaders } = ctx.request.body; + const result = await ctx.service.download.importApplicationData(uid, searchMsg, importForm); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result.code) { + const file = this.downloadData(form, result.data, dataHeaders); + if (file) { + const { filePath, completeName, buf } = file; + try { + fs.writeFileSync(filePath, Buffer.from(buf)); + const data = { + // 本机服务器地址 + // 'http://127.0.0.1:8020' + // 'http://192.168.31.28:8020' + // 公司服务器地址 + // 'http://123.57.205.46:8020' + // 'http://certadmin.hwasmart.com//bdTrainingExamManager' + fileUrl: 'http://127.0.0.1:8020' + `/public/${completeName}?time=${new Date().getTime()}`, + fileName: completeName, + } + this.setResponse(ctx, 200, '文件已成功写入', "deconstruction", data); + setTimeout(() => { + fs.unlinkSync(filePath); + }, 600000); + } catch (error) { + this.setResponse(ctx, 500, '写入文件时发生错误', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "importApplicationData"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 导出考试星学员导入 excel 表 + async importExamStars() { + 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 { form, searchMsg, importForm, dataHeaders } = ctx.request.body; + const result = await ctx.service.download.importExamStars(uid, searchMsg, importForm); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result.code) { + const file = this.downloadData(form, result.data, dataHeaders); + if (file) { + const { filePath, completeName, buf } = file; + try { + fs.writeFileSync(filePath, Buffer.from(buf)); + const data = { + // 本机服务器地址 + // 'http://127.0.0.1:8020' + // 'http://192.168.31.28:8020' + // 公司服务器地址 + // 'http://123.57.205.46:8020' + // 'http://certadmin.hwasmart.com//bdTrainingExamManager' + fileUrl: 'http://127.0.0.1:8020' + `/public/${completeName}?time=${new Date().getTime()}`, + fileName: completeName, + } + this.setResponse(ctx, 200, '文件已成功写入', "deconstruction", data); + setTimeout(() => { + fs.unlinkSync(filePath); + }, 600000); + } catch (error) { + this.setResponse(ctx, 500, '写入文件时发生错误', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "importExamStars"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 导出培训证书发放用户导入 excel 表 + async importIssuance() { + 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 { form, searchMsg, importForm, dataHeaders } = ctx.request.body; + const result = await ctx.service.download.importIssuance(uid, searchMsg, importForm); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result.code) { + const file = this.downloadData(form, result.data, dataHeaders); + if (file) { + const { filePath, completeName, buf } = file; + try { + fs.writeFileSync(filePath, Buffer.from(buf)); + const data = { + // 本机服务器地址 + // 'http://127.0.0.1:8020' + // 'http://192.168.31.28:8020' + // 公司服务器地址 + // 'http://123.57.205.46:8020' + // 'http://certadmin.hwasmart.com//bdTrainingExamManager' + fileUrl: 'http://127.0.0.1:8020' + `/public/${completeName}?time=${new Date().getTime()}`, + fileName: completeName, + } + this.setResponse(ctx, 200, '文件已成功写入', "deconstruction", data); + setTimeout(() => { + fs.unlinkSync(filePath); + }, 600000); + } catch (error) { + this.setResponse(ctx, 500, '写入文件时发生错误', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "importIssuance"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 导出培训证书发放用户照片文件夹 + async importUserPhoto() { + 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 { searchMsg } = ctx.request.body; + const result = await ctx.service.download.importUserPhoto(uid, searchMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result.code) { + const directoryPath = path.join(__dirname, '../public/userPhoto'); + const outputZipPath = path.join(__dirname, '../public/userPhoto.zip'); + // const directoryPath = '/disk/a/Download/userPhoto'; + // const outputZipPath = '/disk/a/Download/userPhoto.zip'; + if (!fs.existsSync(directoryPath)) { + fs.mkdirSync(directoryPath); + console.log('文件夹创建成功'); + } else { + console.log('文件夹已存在'); + fs.rmSync(directoryPath, { recursive: true }); + console.log('文件夹已删除'); + fs.mkdirSync(directoryPath); + console.log('文件夹创建成功'); + } + result.data.forEach((element, index) => { + const imagePath = path.join(__dirname.replace(/\bbd-training-exam-manager\b/g, "bd-training-exam"), `../public/userPhoto/${element.identity_card}.jpg`); + // const imagePath = `/disk/a/userPhoto/${element.identity_card}.jpg`; + const newImagePath = path.join(directoryPath, `${element.identity_card}.jpg`); + if (fs.existsSync(imagePath)) { + fs.copyFileSync(imagePath, newImagePath); + console.log('文件复制成功'); + } else { + console.log('文件不存在'); + } + }); + // 压缩用户照片文件夹 + this.zipFolder(directoryPath, outputZipPath); + ctx.set({ + 'Content-Disposition': 'attachment; filename="userPhoto.zip"', + 'Content-Type': 'application/octet-stream', + }); + const data = { + // 本机服务器地址 + // 'http://127.0.0.1:8020' + // 'http://192.168.31.28:8020' + // 公司服务器地址 + // 'http://123.57.205.46:8020' + // 'http://certadmin.hwasmart.com//bdTrainingExamManager' + fileUrl: 'http://127.0.0.1:8020' + `/public/userPhoto.zip?time=${new Date().getTime()}`, + fileName: 'userPhoto.zip', + } + this.setResponse(ctx, 200, '下载用户照片文件夹压缩文件', "deconstruction", data); + setTimeout(() => { + fs.rmSync(directoryPath, { recursive: true }); + fs.unlinkSync(outputZipPath); + }, 600000); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "importUserPhoto"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 上传用户照片 + async uploadUserPhoto() { + const { ctx } = this; + try { + let rdmcode = await this.checkUid(ctx); + if (!rdmcode) { + this.setResponse(ctx, 401, 'token过期或错误', "none"); + return; + } + const { files } = ctx.request; + const uploadDir = path.join(__dirname.replace(/\bbd-training-exam-manager\b/g, "bd-training-exam"), '../public/userPhoto'); // 设置文件保存目录 + // const uploadDir = '/disk/a/userPhoto'; // 设置文件保存目录 + files.forEach(element => { + const { filename, filepath } = element; + const newPath = path.join(uploadDir, filename); // 构造新文件路径 + // 确保上传目录存在 + if (!fs.existsSync(uploadDir)) { + fs.mkdirSync(uploadDir, { recursive: true }); + } + // 使用 copyFileSync 复制文件,而不是 renameSync + fs.copyFileSync(filepath, newPath); + // 删除临时文件 + fs.unlinkSync(filepath); + }); + this.setResponse(ctx, 200, '照片上传结束', "none"); + } catch (error) { + const blockName = fileName + "--" + "uploadUserPhoto"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 导出考试成绩导入 excel 表 + async importGradesData() { + 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 { form, formClone, dataType, passingScore, gradesType, dataHeaders } = ctx.request.body; + const result = await ctx.service.download.importGradesData(uid, formClone, dataType, passingScore, gradesType); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result.code) { + const file = this.downloadData(form, result.data, dataHeaders); + if (file) { + const { filePath, completeName, buf } = file; + try { + fs.writeFileSync(filePath, Buffer.from(buf)); + const data = { + // 本机服务器地址 + // 'http://127.0.0.1:8020' + // 'http://192.168.31.28:8020' + // 公司服务器地址 + // 'http://123.57.205.46:8020' + // 'http://certadmin.hwasmart.com//bdTrainingExamManager' + fileUrl: 'http://127.0.0.1:8020' + `/public/${completeName}?time=${new Date().getTime()}`, + fileName: completeName, + } + this.setResponse(ctx, 200, '文件已成功写入', "deconstruction", data); + setTimeout(() => { + fs.unlinkSync(filePath); + }, 600000); + } catch (error) { + this.setResponse(ctx, 500, '写入文件时发生错误', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "importGradesData"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = DownloadController; diff --git a/app/controller/Exam.js b/app/controller/Exam.js new file mode 100644 index 0000000..5bb52c0 --- /dev/null +++ b/app/controller/Exam.js @@ -0,0 +1,192 @@ +const Controller = require('../core/base_controller'); + +const fs = require('fs'); + +const fileName = "Exam"; + +class ExamController extends Controller { + // 管理系统新增考试信息 + async addExam() { + 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.decryptRequest(element.uid); + element.exam_name = this.decryptRequest(element.exam_name); + element.status = Number(this.decryptRequest(element.status)); + element.application_start = element.application_start; + element.application_end = element.application_end; + element.exam_start = element.exam_start; + element.exam_end = element.exam_end; + }); + const result = await ctx.service.exam.addExam(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 + "--" + "addExam"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统查看考试信息 + async showExam() { + 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.exam.showExam(uid, body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let examMsg = []; + result.rows.forEach(element => { + examMsg.push(element.dataValues); + }); + const data = { + examMsg, + count: result.count + }; + this.setResponse(ctx, 200, '操作成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showExam"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统编辑考试信息 + async editExam() { + 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 { model, updateMsg, requestMsg } = ctx.request.body; + const modelType = this.decryptRequest(model); + const result = await ctx.service.exam.editExam(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 + "--" + "editExam"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统删除考试信息 + async deleteExam() { + 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 { model, password, requestMsg } = ctx.request.body; + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.exam.deleteExam(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 + "--" + "deleteExam"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统导出考试信息数据 + async downloadExamData() { + 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 { form, searchMsg, dataHeaders } = ctx.request.body; + const result = await ctx.service.exam.downloadExamData(uid, searchMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result.code) { + const file = this.downloadData(form, result.data, dataHeaders); + if (file) { + const { filePath, completeName, buf } = file; + try { + fs.writeFileSync(filePath, Buffer.from(buf)); + const data = { + // 本机服务器地址 + // 'http://127.0.0.1:8020' + // 'http://192.168.31.28:8020' + // 公司服务器地址 + // 'http://123.57.205.46:8020' + // 'http://certadmin.hwasmart.com//bdTrainingExamManager' + fileUrl: 'http://127.0.0.1:8020' + `/public/${completeName}?time=${new Date().getTime()}`, + fileName: completeName, + } + this.setResponse(ctx, 200, '文件已成功写入', "deconstruction", data); + setTimeout(() => { + fs.unlinkSync(filePath); + }, 600000); + } catch (error) { + this.setResponse(ctx, 500, '写入文件时发生错误', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "downloadExamData"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = ExamController; diff --git a/app/controller/Find.js b/app/controller/Find.js new file mode 100644 index 0000000..71c8dcf --- /dev/null +++ b/app/controller/Find.js @@ -0,0 +1,121 @@ +const Controller = require('../core/base_controller'); + +const fileName = "Find"; + +class FindController extends Controller { + // 管理系统检索考生姓名 + async findUserName() { + 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.find.findUserName(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 + "--" + "findUserName"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统检索考生身份证号 + async findIdentityCard() { + 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.find.findIdentityCard(uid, body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result.code == 200) { + this.setResponse(ctx, 200, '操作成功', "none"); + } else if (result.code == 303) { + this.setResponse(ctx, 303, '信息不匹配', "none"); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "findIdentityCard"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统检索考试uid + async findExamUid() { + 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.find.findExamUid(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 + "--" + "findExamUid"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统查找指定工作单位 + async findWorkplace() { + 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.find.findWorkplace(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 + "--" + "findWorkplace"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = FindController; diff --git a/app/controller/Grades.js b/app/controller/Grades.js new file mode 100644 index 0000000..9560089 --- /dev/null +++ b/app/controller/Grades.js @@ -0,0 +1,221 @@ +const Controller = require('../core/base_controller'); + +const fs = require('fs'); + +const fileName = "Grades"; + +class GradesController extends Controller { + // 管理系统新增用户考试结果 + async addGrades() { + 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; + let userMsgObj = { + user_name: [], + identity_card: [] + }; + requestMsg.forEach(item => { + item.user_name = this.decryptRequest(item.user_name); + item.identity_card = this.decryptRequest(item.identity_card); + item.exam_uid = this.decryptRequest(item.exam_uid); + item.status = Number(this.decryptRequest(item.status)); + item.grades = this.decryptRequest(item.grades) == 'undefined' ? null : Number(this.decryptRequest(item.grades)); + item.pass_type = Number(this.decryptRequest(item.pass_type)); + userMsgObj.user_name.push(item.user_name); + userMsgObj.identity_card.push(item.identity_card); + }); + const result = await ctx.service.grades.addGrades(userMsgObj, requestMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + if (result.code == 400) { + this.setResponse(ctx, 400, '全部操作失败, 请前往导入错误记录页面查看导入错误的数据', "none"); + } else if (result.code == 300) { + this.setResponse(ctx, 300, '部分操作成功, 请前往导入错误记录页面查看导入错误的数据', "none"); + } else if (result.code == 200) { + this.setResponse(ctx, 200, '操作成功', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "addGrades"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统查看用户考试结果 + async showGrades() { + 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.grades.showGrades(uid, body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let idCardArr = []; + result.rows.forEach(item => { + idCardArr.push(item.dataValues.examinee.dataValues.identity_card); + }); + const photoResult = await ctx.service.search.checkPhoto(idCardArr); + let gradesMsg = []; + result.rows.forEach(element => { + if (photoResult == "error") { + element.dataValues.userPhotoUrl = '#'; + } + if (photoResult) { + ctx.set('Cache-Control', 'no-cache, no-store, must-revalidate'); + ctx.set("Pragma", "no-cache"); + ctx.set("Expires", "0"); + photoResult.forEach(item => { + if (element.dataValues.examinee.dataValues.identity_card == item.identity_card) { + element.dataValues.userPhotoUrl = item.photoUrl; + } + }); + } + gradesMsg.push(element.dataValues); + }); + const data = { + gradesMsg, + count: result.count + }; + this.setResponse(ctx, 200, '操作成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showGrades"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统编辑用户考试结果 + async editGrades() { + 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 { model, updateMsg, requestMsg } = ctx.request.body; + const modelType = this.decryptRequest(model); + const result = await ctx.service.grades.editGrades(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 + "--" + "editGrades"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统删除用户考试结果 + async deleteGrades() { + 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 { model, password, requestMsg } = ctx.request.body; + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.grades.deleteGrades(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 + "--" + "deleteGrades"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统导出考生考试结果数据 + async downloadGradesData() { + 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 { form, searchMsg, dataHeaders } = ctx.request.body; + const result = await ctx.service.grades.downloadGradesData(uid, searchMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result.code) { + const file = this.downloadData(form, result.data, dataHeaders); + if (file) { + const { filePath, completeName, buf } = file; + try { + fs.writeFileSync(filePath, Buffer.from(buf)); + const data = { + // 本机服务器地址 + // 'http://127.0.0.1:8020' + // 'http://192.168.31.28:8020' + // 公司服务器地址 + // 'http://123.57.205.46:8020' + // 'http://certadmin.hwasmart.com//bdTrainingExamManager' + fileUrl: 'http://127.0.0.1:8020' + `/public/${completeName}?time=${new Date().getTime()}`, + fileName: completeName, + } + this.setResponse(ctx, 200, '文件已成功写入', "deconstruction", data); + setTimeout(() => { + fs.unlinkSync(filePath); + }, 600000); + } catch (error) { + this.setResponse(ctx, 500, '写入文件时发生错误', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "downloadGradesData"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = GradesController; diff --git a/app/controller/Importerror.js b/app/controller/Importerror.js new file mode 100644 index 0000000..98c6bb8 --- /dev/null +++ b/app/controller/Importerror.js @@ -0,0 +1,75 @@ +'use strict'; + +const Controller = require('../core/base_controller'); + +const fileName = "Importerror"; + +class ImporterrorController extends Controller { + // 查看导入错误记录 + async showImporterror() { + 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.importerror.showImporterror(body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let importerrorMsg = []; + result.rows.forEach(element => { + importerrorMsg.push(element.dataValues); + }); + const data = { + importerrorMsg, + count: result.count + }; + this.setResponse(ctx, 200, '搜索导入错误记录成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '搜索导入错误记录失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showImporterror"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 删除导入错误记录 + async deleteImporterror() { + 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.importerror.deleteImporterror(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 + "--" + "deleteImporterror"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = ImporterrorController; \ No newline at end of file diff --git a/app/controller/Interlocution.js b/app/controller/Interlocution.js new file mode 100644 index 0000000..9301034 --- /dev/null +++ b/app/controller/Interlocution.js @@ -0,0 +1,192 @@ +const Controller = require('../core/base_controller'); + +const fs = require('fs'); + +const fileName = "Interlocution"; + +class InterlocutionController extends Controller { + // 管理系统新增问答题 + async addInterlocution() { + 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 => { + if (element.difficulty == '简单') { + element.difficulty = 0; + } else if (element.difficulty == '普通') { + element.difficulty = 1; + } else if (element.difficulty == '困难') { + element.difficulty = 2; + } + }); + const result = await ctx.service.interlocution.addInterlocution(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 + "--" + "addInterlocution"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统查看问答题 + async showInterlocution() { + 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.interlocution.showInterlocution(uid, body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let interlocutionMsg = []; + result.rows.forEach(element => { + interlocutionMsg.push(element.dataValues); + }); + const data = { + interlocutionMsg, + count: result.count + }; + this.setResponse(ctx, 200, '操作成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showInterlocution"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统编辑问答题 + async editInterlocution() { + 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 { model, updateMsg, requestMsg } = ctx.request.body; + const modelType = this.decryptRequest(model); + const result = await ctx.service.interlocution.editInterlocution(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 + "--" + "editInterlocution"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统删除问答题 + async deleteInterlocution() { + 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 { model, password, requestMsg } = ctx.request.body; + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.interlocution.deleteInterlocution(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 + "--" + "deleteInterlocution"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统导出问答题数据 + async downloadInterlocutionData() { + 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 { form, searchMsg, dataHeaders } = ctx.request.body; + const result = await ctx.service.interlocution.downloadInterlocutionData(uid, searchMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result.code) { + const file = this.downloadData(form, result.data, dataHeaders); + if (file) { + const { filePath, completeName, buf } = file; + try { + fs.writeFileSync(filePath, Buffer.from(buf)); + const data = { + // 本机服务器地址 + // 'http://127.0.0.1:8020' + // 'http://192.168.31.28:8020' + // 公司服务器地址 + // 'http://123.57.205.46:8020' + // 'http://certadmin.hwasmart.com//bdTrainingExamManager' + fileUrl: 'http://127.0.0.1:8020' + `/public/${completeName}?time=${new Date().getTime()}`, + fileName: completeName, + } + this.setResponse(ctx, 200, '文件已成功写入', "deconstruction", data); + setTimeout(() => { + fs.unlinkSync(filePath); + }, 600000); + } catch (error) { + this.setResponse(ctx, 500, '写入文件时发生错误', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "downloadInterlocutionData"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = InterlocutionController; diff --git a/app/controller/Judgment.js b/app/controller/Judgment.js new file mode 100644 index 0000000..8ca0cf7 --- /dev/null +++ b/app/controller/Judgment.js @@ -0,0 +1,194 @@ +const Controller = require('../core/base_controller'); + +const fs = require('fs'); + +const fileName = "Judgment"; + +class JudgmentController extends Controller { + // 管理系统新增判断题 + async addJudgment() { + 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.answer = element.answer == '正确' ? true : false; + if (element.difficulty == '简单') { + element.difficulty = 0; + } else if (element.difficulty == '普通') { + element.difficulty = 1; + } else if (element.difficulty == '困难') { + element.difficulty = 2; + } + }); + const result = await ctx.service.judgment.addJudgment(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 + "--" + "addJudgment"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统查看判断题 + async showJudgment() { + 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.judgment.showJudgment(uid, body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let judgmentMsg = []; + result.rows.forEach(element => { + judgmentMsg.push(element.dataValues); + }); + const data = { + judgmentMsg, + count: result.count + }; + this.setResponse(ctx, 200, '操作成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showJudgment"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统编辑判断题 + async editJudgment() { + 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 { model, updateMsg, requestMsg } = ctx.request.body; + const modelType = this.decryptRequest(model); + updateMsg.answer = updateMsg.answer == '1' ? true : false; + const result = await ctx.service.judgment.editJudgment(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 + "--" + "editJudgment"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统删除判断题 + async deleteJudgment() { + 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 { model, password, requestMsg } = ctx.request.body; + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.judgment.deleteJudgment(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 + "--" + "deleteJudgment"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统导出判断题数据 + async downloadJudgmentData() { + 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 { form, searchMsg, dataHeaders } = ctx.request.body; + const result = await ctx.service.judgment.downloadJudgmentData(uid, searchMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result.code) { + const file = this.downloadData(form, result.data, dataHeaders); + if (file) { + const { filePath, completeName, buf } = file; + try { + fs.writeFileSync(filePath, Buffer.from(buf)); + const data = { + // 本机服务器地址 + // 'http://127.0.0.1:8020' + // 'http://192.168.31.28:8020' + // 公司服务器地址 + // 'http://123.57.205.46:8020' + // 'http://certadmin.hwasmart.com//bdTrainingExamManager' + fileUrl: 'http://127.0.0.1:8020' + `/public/${completeName}?time=${new Date().getTime()}`, + fileName: completeName, + } + this.setResponse(ctx, 200, '文件已成功写入', "deconstruction", data); + setTimeout(() => { + fs.unlinkSync(filePath); + }, 600000); + } catch (error) { + this.setResponse(ctx, 500, '写入文件时发生错误', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "downloadJudgmentData"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = JudgmentController; diff --git a/app/controller/Monitoring.js b/app/controller/Monitoring.js new file mode 100644 index 0000000..57da8e4 --- /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, + 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/Multiple.js b/app/controller/Multiple.js new file mode 100644 index 0000000..f220d1b --- /dev/null +++ b/app/controller/Multiple.js @@ -0,0 +1,192 @@ +const Controller = require('../core/base_controller'); + +const fs = require('fs'); + +const fileName = "Multiple"; + +class MultipleController extends Controller { + // 管理系统新增多选题 + async addMultiple() { + 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 => { + if (element.difficulty == '简单') { + element.difficulty = 0; + } else if (element.difficulty == '普通') { + element.difficulty = 1; + } else if (element.difficulty == '困难') { + element.difficulty = 2; + } + }); + const result = await ctx.service.multiple.addMultiple(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 + "--" + "addMultiple"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统查看多选题 + async showMultiple() { + 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.multiple.showMultiple(uid, body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let multipleMsg = []; + result.rows.forEach(element => { + multipleMsg.push(element.dataValues); + }); + const data = { + multipleMsg, + count: result.count + }; + this.setResponse(ctx, 200, '操作成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showMultiple"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统编辑多选题 + async editMultiple() { + 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 { model, updateMsg, requestMsg } = ctx.request.body; + const modelType = this.decryptRequest(model); + const result = await ctx.service.multiple.editMultiple(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 + "--" + "editMultiple"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统删除多选题 + async deleteMultiple() { + 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 { model, password, requestMsg } = ctx.request.body; + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.multiple.deleteMultiple(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 + "--" + "deleteMultiple"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统导出多选题数据 + async downloadMultipleData() { + 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 { form, searchMsg, dataHeaders } = ctx.request.body; + const result = await ctx.service.multiple.downloadMultipleData(uid, searchMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result.code) { + const file = this.downloadData(form, result.data, dataHeaders); + if (file) { + const { filePath, completeName, buf } = file; + try { + fs.writeFileSync(filePath, Buffer.from(buf)); + const data = { + // 本机服务器地址 + // 'http://127.0.0.1:8020' + // 'http://192.168.31.28:8020' + // 公司服务器地址 + // 'http://123.57.205.46:8020' + // 'http://certadmin.hwasmart.com//bdTrainingExamManager' + fileUrl: 'http://127.0.0.1:8020' + `/public/${completeName}?time=${new Date().getTime()}`, + fileName: completeName, + } + this.setResponse(ctx, 200, '文件已成功写入', "deconstruction", data); + setTimeout(() => { + fs.unlinkSync(filePath); + }, 600000); + } catch (error) { + this.setResponse(ctx, 500, '写入文件时发生错误', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "downloadMultipleData"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = MultipleController; diff --git a/app/controller/Radio.js b/app/controller/Radio.js new file mode 100644 index 0000000..cfdfc99 --- /dev/null +++ b/app/controller/Radio.js @@ -0,0 +1,192 @@ +const Controller = require('../core/base_controller'); + +const fs = require('fs'); + +const fileName = "Radio"; + +class RadioController extends Controller { + // 管理系统新增单选题 + async addRadio() { + 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 => { + if (element.difficulty == '简单') { + element.difficulty = 0; + } else if (element.difficulty == '普通') { + element.difficulty = 1; + } else if (element.difficulty == '困难') { + element.difficulty = 2; + } + }); + const result = await ctx.service.radio.addRadio(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 + "--" + "addRadio"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统查看单选题 + async showRadio() { + 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.radio.showRadio(uid, body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let radioMsg = []; + result.rows.forEach(element => { + radioMsg.push(element.dataValues); + }); + const data = { + radioMsg, + count: result.count + }; + this.setResponse(ctx, 200, '操作成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showRadio"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统编辑单选题 + async editRadio() { + 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 { model, updateMsg, requestMsg } = ctx.request.body; + const modelType = this.decryptRequest(model); + const result = await ctx.service.radio.editRadio(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 + "--" + "editRadio"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统删除单选题 + async deleteRadio() { + 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 { model, password, requestMsg } = ctx.request.body; + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.radio.deleteRadio(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 + "--" + "deleteRadio"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统导出单选题数据 + async downloadRadioData() { + 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 { form, searchMsg, dataHeaders } = ctx.request.body; + const result = await ctx.service.radio.downloadRadioData(uid, searchMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result.code) { + const file = this.downloadData(form, result.data, dataHeaders); + if (file) { + const { filePath, completeName, buf } = file; + try { + fs.writeFileSync(filePath, Buffer.from(buf)); + const data = { + // 本机服务器地址 + // 'http://127.0.0.1:8020' + // 'http://192.168.31.28:8020' + // 公司服务器地址 + // 'http://123.57.205.46:8020' + // 'http://certadmin.hwasmart.com//bdTrainingExamManager' + fileUrl: 'http://127.0.0.1:8020' + `/public/${completeName}?time=${new Date().getTime()}`, + fileName: completeName, + } + this.setResponse(ctx, 200, '文件已成功写入', "deconstruction", data); + setTimeout(() => { + fs.unlinkSync(filePath); + }, 600000); + } catch (error) { + this.setResponse(ctx, 500, '写入文件时发生错误', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "downloadRadioData"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = RadioController; diff --git a/app/controller/Search.js b/app/controller/Search.js new file mode 100644 index 0000000..90fccd5 --- /dev/null +++ b/app/controller/Search.js @@ -0,0 +1,167 @@ +const Controller = require('../core/base_controller'); + +const fileName = "Search"; + +class SearchController extends Controller { + // 管理系统检索考生姓名 + async searchUserName() { + 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.search.searchUserName(uid, body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let userName = []; + result.forEach(element => { + userName.push({ value: element.dataValues.user_name }); + }); + this.setResponse(ctx, 200, '操作成功', "polymerization", userName); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "searchUserName"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统检索考生身份证号 + async searchIdentityCard() { + 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.search.searchIdentityCard(uid, body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let identityCard = []; + result.forEach(element => { + identityCard.push({ value: element.dataValues.identity_card }); + }); + this.setResponse(ctx, 200, '操作成功', "polymerization", identityCard); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "searchIdentityCard"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统检索考试uid + async searchExamUid() { + 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.search.searchExamUid(uid, body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let examUid = []; + result.forEach(element => { + examUid.push({ value: element.dataValues.uid }); + }); + this.setResponse(ctx, 200, '操作成功', "polymerization", examUid); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "searchExamUid"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统检索工作单位 + async searchWorkplace() { + 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.search.searchWorkplace(uid, body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let workplace = []; + result.forEach(element => { + workplace.push({ value: element.dataValues.workplace }); + }); + this.setResponse(ctx, 200, '操作成功', "polymerization", workplace); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "searchWorkplace"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统检索报名结果说明 + async searchResult() { + 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 results = await ctx.service.search.searchResult(uid, body); + if (results == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (results) { + let result = []; + results.forEach(element => { + result.push({ value: element.dataValues.result }); + }); + this.setResponse(ctx, 200, '操作成功', "polymerization", result); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "searchResult"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = SearchController; diff --git a/app/controller/TopicWhitelist.js b/app/controller/TopicWhitelist.js new file mode 100644 index 0000000..1c48af2 --- /dev/null +++ b/app/controller/TopicWhitelist.js @@ -0,0 +1,215 @@ +const Controller = require('../core/base_controller'); + +const fs = require('fs'); + +const fileName = "TopicWhitelist"; + +class TopicWhitelistController extends Controller { + // 管理系统新增题库白名单 + async addTopicWhitelist() { + 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; + let userMsgObj = { + phone: [], + }; + console.log(requestMsg) + requestMsg.forEach(item => { + item.phone = this.decryptRequest(item.phone); + item.type = Number(this.decryptRequest(item.type)); + if (item.expired_at) { + item.expired_at = this.decryptRequest(item.expired_at); + } else { + item.expired_at = null; + } + userMsgObj.phone.push(item.phone); + }); + const result = await ctx.service.topicWhitelist.addTopicWhitelist(userMsgObj, 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 + "--" + "addTopicWhitelist"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统查看题库白名单 + async showTopicWhitelist() { + 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.topicWhitelist.showTopicWhitelist(uid, body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let idCardArr = []; + result.rows.forEach(item => { + idCardArr.push(item.dataValues.examinee.dataValues.identity_card); + }); + const photoResult = await ctx.service.search.checkPhoto(idCardArr); + let topicWhitelistMsg = []; + result.rows.forEach(element => { + if (photoResult == "error") { + element.dataValues.userPhotoUrl = '#'; + } + if (photoResult) { + ctx.set('Cache-Control', 'no-cache, no-store, must-revalidate'); + ctx.set("Pragma", "no-cache"); + ctx.set("Expires", "0"); + photoResult.forEach(item => { + if (element.dataValues.examinee.dataValues.identity_card == item.identity_card) { + element.dataValues.userPhotoUrl = item.photoUrl; + } + }); + } + topicWhitelistMsg.push(element.dataValues); + }); + const data = { + topicWhitelistMsg, + count: result.count + }; + this.setResponse(ctx, 200, '操作成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showTopicWhitelist"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统编辑题库白名单 + async editTopicWhitelist() { + 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 { model, updateMsg, requestMsg } = ctx.request.body; + const modelType = this.decryptRequest(model); + const result = await ctx.service.topicWhitelist.editTopicWhitelist(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 + "--" + "editTopicWhitelist"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统删除题库白名单 + async deleteTopicWhitelist() { + 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 { model, password, requestMsg } = ctx.request.body; + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.topicWhitelist.deleteTopicWhitelist(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 + "--" + "deleteTopicWhitelist"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统导出题库白名单 + async downloadTopicWhitelistData() { + 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 { form, searchMsg, dataHeaders } = ctx.request.body; + const result = await ctx.service.topicWhitelist.downloadTopicWhitelistData(uid, searchMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result.code) { + const file = this.downloadData(form, result.data, dataHeaders); + if (file) { + const { filePath, completeName, buf } = file; + try { + fs.writeFileSync(filePath, Buffer.from(buf)); + const data = { + // 本机服务器地址 + // 'http://127.0.0.1:8020' + // 'http://192.168.31.28:8020' + // 公司服务器地址 + // 'http://123.57.205.46:8020' + // 'http://certadmin.hwasmart.com//bdTrainingExamManager' + fileUrl: 'http://127.0.0.1:8020' + `/public/${completeName}?time=${new Date().getTime()}`, + fileName: completeName, + } + this.setResponse(ctx, 200, '文件已成功写入', "deconstruction", data); + setTimeout(() => { + fs.unlinkSync(filePath); + }, 600000); + } catch (error) { + this.setResponse(ctx, 500, '写入文件时发生错误', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "downloadTopicWhitelistData"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = TopicWhitelistController; diff --git a/app/controller/User.js b/app/controller/User.js new file mode 100644 index 0000000..c7bad9d --- /dev/null +++ b/app/controller/User.js @@ -0,0 +1,218 @@ +const Controller = require('../core/base_controller'); + +const fs = require('fs'); + +const fileName = "User"; + +class UserController extends Controller { + // 管理系统新增用户账号信息 + async addUser() { + 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('E'); + element.salt = this.encryptRequest(salt); + element.password = this.shaForm(this.decryptRequest(element.identity_card).slice(-6), salt); + element.user_name = this.decryptRequest(element.user_name); + element.identity_card = this.decryptRequest(element.identity_card); + element.real_check = 0; + element.workplace = this.decryptRequest(element.workplace); + element.address = this.decryptRequest(element.address); + element.phone = this.decryptRequest(element.phone); + element.email = this.decryptRequest(element.email); + element.status = 0; + element.created_at = new Date(); + element.updated_at = new Date(); + element.login_status = 0; + }); + const result = await ctx.service.user.addUser(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 + "--" + "addUser"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统查看用户账号信息 + async showUser() { + 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.user.showUser(uid, body); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result) { + let idCardArr = []; + result.rows.forEach(item => { + idCardArr.push(item.dataValues.identity_card); + }); + const photoResult = await ctx.service.search.checkPhoto(idCardArr); + let userMsg = []; + result.rows.forEach(element => { + if (photoResult == "error") { + element.dataValues.userPhotoUrl = '#'; + } + if (photoResult) { + ctx.set('Cache-Control', 'no-cache, no-store, must-revalidate'); + ctx.set("Pragma", "no-cache"); + ctx.set("Expires", "0"); + photoResult.forEach(item => { + if (element.dataValues.identity_card == item.identity_card) { + element.dataValues.userPhotoUrl = item.photoUrl; + } + }); + } + userMsg.push(element.dataValues); + }); + const data = { + userMsg, + count: result.count + }; + this.setResponse(ctx, 200, '操作成功', "deconstruction", data); + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "showUser"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统编辑用户账号信息 + async editUser() { + 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 { model, updateMsg, requestMsg } = ctx.request.body; + const modelType = this.decryptRequest(model); + const result = await ctx.service.user.editUser(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 + "--" + "editUser"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统删除用户账号信息 + async deleteUser() { + 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 { model, password, requestMsg } = ctx.request.body; + const modelType = this.decryptRequest(model); + const deCodePassword = this.decryptRequest(password); + const result = await ctx.service.user.deleteUser(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 + "--" + "deleteUser"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } + + // 管理系统导出用户账号信息数据 + async downloadUserData() { + 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 { form, searchMsg, dataHeaders } = ctx.request.body; + const result = await ctx.service.user.downloadUserData(uid, searchMsg); + if (result == "error") { + this.setResponse(ctx, 500, '服务器错误', "none"); + return; + } + if (result.code) { + const file = this.downloadData(form, result.data, dataHeaders); + if (file) { + const { filePath, completeName, buf } = file; + try { + fs.writeFileSync(filePath, Buffer.from(buf)); + const data = { + // 本机服务器地址 + // 'http://127.0.0.1:8020' + // 'http://192.168.31.28:8020' + // 公司服务器地址 + // 'http://123.57.205.46:8020' + // 'http://certadmin.hwasmart.com//bdTrainingExamManager' + fileUrl: 'http://127.0.0.1:8020' + `/public/${completeName}?time=${new Date().getTime()}`, + fileName: completeName, + } + this.setResponse(ctx, 200, '文件已成功写入', "deconstruction", data); + setTimeout(() => { + fs.unlinkSync(filePath); + }, 600000); + } catch (error) { + this.setResponse(ctx, 500, '写入文件时发生错误', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } else { + this.setResponse(ctx, 404, '操作失败', "none"); + } + } catch (error) { + const blockName = fileName + "--" + "downloadUserData"; + ctx.app.middleware.log('../../controllerLog', blockName + ">>>>" + error); + this.setResponse(ctx, 500, '服务器错误', "none"); + } + } +} + +module.exports = UserController; diff --git a/app/core/base_controller.js b/app/core/base_controller.js new file mode 100644 index 0000000..0aedde3 --- /dev/null +++ b/app/core/base_controller.js @@ -0,0 +1,190 @@ +const { Controller } = require('egg'); + +const sha256 = require("crypto-js/sha256"); + +const CryptoJS = require("crypto-js"); + +const XLSX = require('xlsx'); + +const fs = require('fs'); + +const archiver = require('archiver'); + +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 examManager = await redis.get('db7').get(token); + return examManager ? examManager : false; + }; + + setResponse = (ctx, code, msg, model, data = {}) => { + const modelType = { + "none": { code, msg }, + "deconstruction": { code, msg, ...data }, + "polymerization": { code, msg, data } + } + ctx.body = modelType[model]; + } + + downloadData = (form, data, dataHeaders) => { + let extensionName = ['.xlsx', '.xls', '.csv'], buf; + const { sheetName, fileName, extensionType } = form; + if (extensionName[extensionType] == '.xlsx' || extensionName[extensionType] == '.xls') { + // 使用xlsx库将数据转换为工作表和工作簿 + const ws = XLSX.utils.json_to_sheet(data); + // 动态设置表头 + dataHeaders.forEach((header, index) => { + const cellRef = XLSX.utils.encode_cell({ r: 0, c: index }); // 生成单元格引用,如A1, B1等 + ws[cellRef] = { v: header, t: "s" }; // 设置单元格的值和类型 + }); + // 创建一个新的工作簿并添加工作表 + const wb = XLSX.utils.book_new(); + // 将工作表添加到工作簿中,并指定其名称 + XLSX.utils.book_append_sheet(wb, ws, sheetName); + if (extensionName[extensionType] == '.xlsx') { + // 将工作簿写入字符串(二进制) + buf = XLSX.write(wb, { bookType: 'xlsx', type: 'array' }); + } else if (extensionName[extensionType] == '.xls') { + // 将工作簿写入字符串(二进制) + buf = XLSX.write(wb, { bookType: 'xls', type: 'array' }); + } + } else if (extensionName[extensionType] == '.csv') { + // 将数据转换为CSV格式的字符串 + buf = data.map(row => row.join(',')).join('\n') + '\n'; + } + // 将文件的内容返回给控制器作为响应体发送给客户端 + if (buf) { + const completeName = fileName + extensionName[extensionType]; + const filePath = 'app/public/' + completeName; + // const filePath = '/disk/a/Download/' + completeName; + return { filePath, completeName, buf }; + }; + return false; + }; + + zipFolder = (sourceDir, outputZipPath) => { + // 创建可写流来写入数据 + const output = fs.createWriteStream(outputZipPath); // 将压缩包保存到当前项目的目录下 + const archive = archiver('zip', { zlib: { level: 9 } }); // 设置压缩等级 + + // 建立管道连接 + archive.pipe(output); + + // 压缩目录到压缩包中 + archive.directory(sourceDir + '/', false); + + // 完成压缩 + archive.finalize(); + } +} + +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/Application.js b/app/model/Application.js new file mode 100644 index 0000000..db07c9b --- /dev/null +++ b/app/model/Application.js @@ -0,0 +1,23 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, STRING, DATE } = app.Sequelize; + + const Application = app.model.define('application', { + id: { type: INTEGER(8), primaryKey: true, autoIncrement: true }, + user_uid: CHAR(15), + exam_uid: CHAR(10), + source: STRING(24), + status: INTEGER(3), + pay_status: INTEGER(3), + result: STRING(24), + created_at: DATE, + },{ + freezeTableName: true, + timestamp: true, + createdAt: true, + updatedAt: false, + }); + + return Application; +}; \ No newline at end of file diff --git a/app/model/Audit.js b/app/model/Audit.js new file mode 100644 index 0000000..850bc10 --- /dev/null +++ b/app/model/Audit.js @@ -0,0 +1,21 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, STRING, DATE } = app.Sequelize; + + const Audit = app.model.define('audit', { + id: { type: INTEGER(8), primaryKey: true, autoIncrement: true }, + user_uid: CHAR(15), + identity_card: CHAR(18), + user_name: STRING(6), + status: INTEGER(3), + created_at: DATE, + },{ + freezeTableName: true, + timestamp: true, + createdAt: true, + updatedAt: false, + }); + + return Audit; +}; \ No newline at end of file diff --git a/app/model/Examination.js b/app/model/Examination.js new file mode 100644 index 0000000..aac627a --- /dev/null +++ b/app/model/Examination.js @@ -0,0 +1,23 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, STRING, DATE } = app.Sequelize; + + const Examination = app.model.define('examination', { + id: { type: INTEGER(8), primaryKey: true, autoIncrement: true }, + uid: CHAR(10), + exam_name: STRING(60), + status: INTEGER(3), + application_start: DATE, + application_end: DATE, + exam_start: DATE, + exam_end: DATE, + },{ + freezeTableName: true, + timestamp: true, + createdAt: false, + updatedAt: false, + }); + + return Examination; +}; \ No newline at end of file diff --git a/app/model/Examinee.js b/app/model/Examinee.js new file mode 100644 index 0000000..7a1a495 --- /dev/null +++ b/app/model/Examinee.js @@ -0,0 +1,31 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, STRING, DATE } = app.Sequelize; + + const Examinee = app.model.define('examinee', { + id: { type: INTEGER(8), primaryKey: true, autoIncrement: true }, + uid: CHAR(15), + salt: CHAR(24), + password: CHAR(64), + user_name: STRING(10), + identity_card: CHAR(18), + real_check: INTEGER(3), + workplace: STRING(60), + address: STRING(120), + phone: CHAR(11), + email: STRING(60), + referrers: STRING(60), + status: INTEGER(3), + created_at: DATE, + updated_at: DATE, + login_status: INTEGER(3), + },{ + freezeTableName: true, + timestamp: true, + createdAt: true, + updatedAt: true, + }); + + return Examinee; +}; \ No newline at end of file diff --git a/app/model/Grades.js b/app/model/Grades.js new file mode 100644 index 0000000..72174f4 --- /dev/null +++ b/app/model/Grades.js @@ -0,0 +1,21 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, STRING } = app.Sequelize; + + const Grades = app.model.define('grades', { + id: { type: INTEGER(8), primaryKey: true, autoIncrement: true }, + user_uid: CHAR(15), + exam_uid: CHAR(10), + status: INTEGER(3), + grades: STRING(5), + pass_type: INTEGER(3), + },{ + freezeTableName: true, + timestamp: false, + createdAt: false, + updatedAt: false, + }); + + return Grades; +}; \ No newline at end of file diff --git a/app/model/Importerror.js b/app/model/Importerror.js new file mode 100644 index 0000000..957b6e1 --- /dev/null +++ b/app/model/Importerror.js @@ -0,0 +1,22 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, STRING, DATE } = app.Sequelize; + + const Importerror = app.model.define('importerror', { + id: { type: INTEGER(5), primaryKey: true, autoIncrement: true }, + identity_card: CHAR(18), + user_name: STRING(6), + exam_uid: CHAR(10), + type: INTEGER(3), + status: INTEGER(3), + created_at: DATE, + },{ + freezeTableName: true, + timestamp: true, + createdAt: true, + updatedAt: false, + }); + + return Importerror; +}; \ No newline at end of file diff --git a/app/model/Manager.js b/app/model/Manager.js new file mode 100644 index 0000000..7ab357e --- /dev/null +++ b/app/model/Manager.js @@ -0,0 +1,25 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, STRING, DATE } = app.Sequelize; + + const Manager = app.model.define('manager', { + id: { type: INTEGER(8), primaryKey: true, autoIncrement: true }, + uid: CHAR(15), + salt: CHAR(24), + account_name: STRING(5), + password: CHAR(64), + role: INTEGER(3), + status: INTEGER(3), + created_at: DATE, + updated_at: DATE, + login_status: INTEGER(3), + },{ + freezeTableName: true, + timestamp: true, + createdAt: true, + updatedAt: true, + }); + + return Manager; +}; \ No newline at end of file diff --git a/app/model/Monitoring.js b/app/model/Monitoring.js new file mode 100644 index 0000000..99ff067 --- /dev/null +++ b/app/model/Monitoring.js @@ -0,0 +1,23 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, DATE } = app.Sequelize; + + const Monitoring = app.model.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/model/Whitelist.js b/app/model/Whitelist.js new file mode 100644 index 0000000..71261da --- /dev/null +++ b/app/model/Whitelist.js @@ -0,0 +1,19 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, CHAR, DATE } = app.Sequelize; + + const Whitelist = app.model.define('whitelist', { + id: { type: INTEGER(5), primaryKey: true, autoIncrement: true }, + user_uid: CHAR(15), + type: INTEGER(3), + expired_at: DATE, + },{ + freezeTableName: true, + timestamp: true, + createdAt: false, + updatedAt: false, + }); + + return Whitelist; +}; \ No newline at end of file diff --git a/app/model2/Interlocution.js b/app/model2/Interlocution.js new file mode 100644 index 0000000..516e19e --- /dev/null +++ b/app/model2/Interlocution.js @@ -0,0 +1,19 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, STRING } = app.Sequelize; + + const Interlocution = app.model2.define('interlocution', { + id: { type: INTEGER(5), primaryKey: true, autoIncrement: true }, + stem: STRING(400), + answer: STRING(400), + difficulty: INTEGER(3), + },{ + freezeTableName: true, + timestamp: false, + createdAt: false, + updatedAt: false, + }); + + return Interlocution; +}; \ No newline at end of file diff --git a/app/model2/Judgment.js b/app/model2/Judgment.js new file mode 100644 index 0000000..4c91502 --- /dev/null +++ b/app/model2/Judgment.js @@ -0,0 +1,19 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, STRING } = app.Sequelize; + + const Judgment = app.model2.define('judgment', { + id: { type: INTEGER(5), primaryKey: true, autoIncrement: true }, + stem: STRING(400), + answer: INTEGER(1), + difficulty: INTEGER(3), + },{ + freezeTableName: true, + timestamp: false, + createdAt: false, + updatedAt: false, + }); + + return Judgment; +}; \ No newline at end of file diff --git a/app/model2/Multiple.js b/app/model2/Multiple.js new file mode 100644 index 0000000..12f05c5 --- /dev/null +++ b/app/model2/Multiple.js @@ -0,0 +1,24 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, STRING } = app.Sequelize; + + const Multiple = app.model2.define('multiple', { + id: { type: INTEGER(5), primaryKey: true, autoIncrement: true }, + stem: STRING(400), + options_a: STRING(400), + options_b: STRING(400), + options_c: STRING(400), + options_d: STRING(400), + options_e: STRING(400), + answer: STRING(5), + difficulty: INTEGER(3), + },{ + freezeTableName: true, + timestamp: false, + createdAt: false, + updatedAt: false, + }); + + return Multiple; +}; \ No newline at end of file diff --git a/app/model2/Radio.js b/app/model2/Radio.js new file mode 100644 index 0000000..1517e9e --- /dev/null +++ b/app/model2/Radio.js @@ -0,0 +1,23 @@ +'use strict'; + +module.exports = (app) => { + const { INTEGER, STRING, CHAR } = app.Sequelize; + + const Radio = app.model2.define('radio', { + id: { type: INTEGER(5), primaryKey: true, autoIncrement: true }, + stem: STRING(400), + options_a: STRING(400), + options_b: STRING(400), + options_c: STRING(400), + options_d: STRING(400), + answer: CHAR(1), + difficulty: INTEGER(3), + },{ + freezeTableName: true, + timestamp: false, + createdAt: false, + updatedAt: false, + }); + + return Radio; +}; \ No newline at end of file diff --git a/app/public/userPhoto.zip b/app/public/userPhoto.zip new file mode 100644 index 0000000..4b61363 Binary files /dev/null and b/app/public/userPhoto.zip differ diff --git a/app/public/userPhoto/320103196805082012.jpg b/app/public/userPhoto/320103196805082012.jpg new file mode 100644 index 0000000..205f0a2 Binary files /dev/null and b/app/public/userPhoto/320103196805082012.jpg differ diff --git a/app/public/userPhoto/320125199007232313.jpg b/app/public/userPhoto/320125199007232313.jpg new file mode 100644 index 0000000..c9e4d6a Binary files /dev/null and b/app/public/userPhoto/320125199007232313.jpg differ diff --git a/app/public/userPhoto/320125199801230737.jpg b/app/public/userPhoto/320125199801230737.jpg new file mode 100644 index 0000000..7da251b Binary files /dev/null and b/app/public/userPhoto/320125199801230737.jpg differ diff --git a/app/public/userPhoto/320981198807164734.jpg b/app/public/userPhoto/320981198807164734.jpg new file mode 100644 index 0000000..22f12ef Binary files /dev/null and b/app/public/userPhoto/320981198807164734.jpg differ diff --git a/app/public/userPhoto/320981199912304975.jpg b/app/public/userPhoto/320981199912304975.jpg new file mode 100644 index 0000000..ff0a373 Binary files /dev/null and b/app/public/userPhoto/320981199912304975.jpg differ diff --git a/app/public/userPhoto/32128219810804023X.jpg b/app/public/userPhoto/32128219810804023X.jpg new file mode 100644 index 0000000..0b4702d Binary files /dev/null and b/app/public/userPhoto/32128219810804023X.jpg differ diff --git a/app/public/userPhoto/330104198306103816.jpg b/app/public/userPhoto/330104198306103816.jpg new file mode 100644 index 0000000..10d20c2 Binary files /dev/null and b/app/public/userPhoto/330104198306103816.jpg differ diff --git a/app/public/userPhoto/340221199812160010.jpg b/app/public/userPhoto/340221199812160010.jpg new file mode 100644 index 0000000..9b9fdfa Binary files /dev/null and b/app/public/userPhoto/340221199812160010.jpg differ diff --git a/app/public/userPhoto/341223198801191910.jpg b/app/public/userPhoto/341223198801191910.jpg new file mode 100644 index 0000000..5e4f61b Binary files /dev/null and b/app/public/userPhoto/341223198801191910.jpg differ diff --git a/app/public/userPhoto/342625199710150718.jpg b/app/public/userPhoto/342625199710150718.jpg new file mode 100644 index 0000000..341e14f Binary files /dev/null and b/app/public/userPhoto/342625199710150718.jpg differ diff --git a/app/public/userPhoto/420222198705048711.jpg b/app/public/userPhoto/420222198705048711.jpg new file mode 100644 index 0000000..cf4d89a Binary files /dev/null and b/app/public/userPhoto/420222198705048711.jpg differ diff --git a/app/public/userPhoto/430111197912296032.jpg b/app/public/userPhoto/430111197912296032.jpg new file mode 100644 index 0000000..d43a22f Binary files /dev/null and b/app/public/userPhoto/430111197912296032.jpg differ diff --git a/app/router.js b/app/router.js new file mode 100644 index 0000000..563be20 --- /dev/null +++ b/app/router.js @@ -0,0 +1,178 @@ +/** + * @param {Egg.Application} app - egg application + */ +module.exports = app => { + const { router, controller } = app; + + // 管理系统新增普通管理员账号信息 + router.post("/addAdmin", controller.admin.addAdmin); + // 管理系统查看普通管理员账号信息 + router.post("/showAdmin", controller.admin.showAdmin); + // 管理系统编辑普通管理员账号信息 + router.post("/editAdmin", controller.admin.editAdmin); + // 管理系统删除普通管理员账号信息 + router.post("/deleteAdmin", controller.admin.deleteAdmin); + // 管理系统导出普通管理员账号信息数据 + router.post("/downloadAdminData", controller.admin.downloadAdminData); + + // 管理系统新增考试信息 + router.post("/addExam", controller.exam.addExam); + // 管理系统查看考试信息 + router.post("/showExam", controller.exam.showExam); + // 管理系统编辑考试信息 + router.post("/editExam", controller.exam.editExam); + // 管理系统删除考试信息 + router.post("/deleteExam", controller.exam.deleteExam); + // 管理系统导出考试信息数据 + router.post("/downloadExamData", controller.exam.downloadExamData); + + // 管理系统新增用户账号信息 + router.post("/addUser", controller.user.addUser); + // 管理系统查看用户账号信息 + router.post("/showUser", controller.user.showUser); + // 管理系统编辑用户账号信息 + router.post("/editUser", controller.user.editUser); + // 管理系统删除用户账号信息 + router.post("/deleteUser", controller.user.deleteUser); + // 管理系统导出用户账号信息数据 + router.post("/downloadUserData", controller.user.downloadUserData); + + // 比较身份证号 + router.post("/diffIdentityCard", controller.diff.diffIdentityCard); + // 比较邮箱 + router.post("/diffEmail", controller.diff.diffEmail); + // 比较电话号码 + router.post("/diffPhone", controller.diff.diffPhone); + + // 管理系统查看用户关键信息变更 + router.post("/auditList", controller.audit.auditList); + // 管理系统审核用户关键信息变更 + router.post("/userMsgAudit", controller.audit.userMsgAudit); + + // 管理系统检索考生姓名 + router.post("/searchUserName", controller.search.searchUserName); + // 管理系统检索考生身份证号码 + router.post("/searchIdentityCard", controller.search.searchIdentityCard); + // 管理系统检索考试 uid + router.post("/searchExamUid", controller.search.searchExamUid); + // 管理系统检索工作单位 + router.post("/searchWorkplace", controller.search.searchWorkplace); + // 管理系统检索报名结果说明 + router.post("/searchResult", controller.search.searchResult); + + // 管理系统查找指定考生姓名 + router.post("/findUserName", controller.find.findUserName); + // 管理系统查找指定考生身份证号 + router.post("/findIdentityCard", controller.find.findIdentityCard); + // 管理系统查找指定考试 uid + router.post("/findExamUid", controller.find.findExamUid); + // 管理系统查找指定工作单位 + router.post("/findWorkplace", controller.find.findWorkplace); + + // 管理系统新增考生报名信息 + router.post("/addApplication", controller.application.addApplication); + // 管理系统查看考生报名信息 + router.post("/showApplication", controller.application.showApplication); + // 管理系统编辑考生报名信息 + router.post("/editApplication", controller.application.editApplication); + // 管理系统删除考生报名信息 + router.post("/deleteApplication", controller.application.deleteApplication); + // 管理系统导出考生报名信息数据 + router.post("/downloadApplicationData", controller.application.downloadApplicationData); + + // 管理系统新增考生考试结果 + router.post("/addGrades", controller.grades.addGrades); + // 管理系统查看考生考试结果 + router.post("/showGrades", controller.grades.showGrades); + // 管理系统编辑考生考试结果 + router.post("/editGrades", controller.grades.editGrades); + // 管理系统删除考生考试结果 + router.post("/deleteGrades", controller.grades.deleteGrades); + // 管理系统导出考生考试结果数据 + router.post("/downloadGradesData", controller.grades.downloadGradesData); + + // 查看导入错误记录 + router.post("/showImporterror", controller.importerror.showImporterror); + // 删除导入错误记录 + router.post("/deleteImporterror", controller.importerror.deleteImporterror); + + // 管理系统新增题库白名单 + router.post("/addTopicWhitelist", controller.topicWhitelist.addTopicWhitelist); + // 管理系统查看题库白名单 + router.post("/showTopicWhitelist", controller.topicWhitelist.showTopicWhitelist); + // 管理系统编辑题库白名单 + router.post("/editTopicWhitelist", controller.topicWhitelist.editTopicWhitelist); + // 管理系统删除题库白名单 + router.post("/deleteTopicWhitelist", controller.topicWhitelist.deleteTopicWhitelist); + // 管理系统导出题库白名单 + router.post("/downloadTopicWhitelistData", controller.topicWhitelist.downloadTopicWhitelistData); + + // 管理系统新增问答题 + router.post("/addInterlocution", controller.interlocution.addInterlocution); + // 管理系统查看问答题 + router.post("/showInterlocution", controller.interlocution.showInterlocution); + // 管理系统编辑问答题 + router.post("/editInterlocution", controller.interlocution.editInterlocution); + // 管理系统删除问答题 + router.post("/deleteInterlocution", controller.interlocution.deleteInterlocution); + // 管理系统导出问答题 + router.post("/downloadInterlocutionData", controller.interlocution.downloadInterlocutionData); + + // 管理系统新增选择题 + router.post("/addJudgment", controller.judgment.addJudgment); + // 管理系统查看选择题 + router.post("/showJudgment", controller.judgment.showJudgment); + // 管理系统编辑选择题 + router.post("/editJudgment", controller.judgment.editJudgment); + // 管理系统删除选择题 + router.post("/deleteJudgment", controller.judgment.deleteJudgment); + // 管理系统导出选择题 + router.post("/downloadJudgmentData", controller.judgment.downloadJudgmentData); + + // 管理系统新增多选题 + router.post("/addMultiple", controller.multiple.addMultiple); + // 管理系统查看多选题 + router.post("/showMultiple", controller.multiple.showMultiple); + // 管理系统编辑多选题 + router.post("/editMultiple", controller.multiple.editMultiple); + // 管理系统删除多选题 + router.post("/deleteMultiple", controller.multiple.deleteMultiple); + // 管理系统导出多选题 + router.post("/downloadMultipleData", controller.multiple.downloadMultipleData); + + // 管理系统新增单选题 + router.post("/addRadio", controller.radio.addRadio); + // 管理系统查看单选题 + router.post("/showRadio", controller.radio.showRadio); + // 管理系统编辑单选题 + router.post("/editRadio", controller.radio.editRadio); + // 管理系统删除单选题 + router.post("/deleteRadio", controller.radio.deleteRadio); + // 管理系统导出单选题 + router.post("/downloadRadioData", controller.radio.downloadRadioData); + + // 查看监控记录 + router.post("/showMonitoring", controller.monitoring.showMonitoring); + // 删除监控记录 + router.post("/deleteMonitoring", controller.monitoring.deleteMonitoring); + + // 导出小鹅通导入用户 + router.post("/importXiaoeTech", controller.download.importXiaoeTech); + // 导出小鹅通开课学员 + router.post("/commencementXiaoeTech", controller.download.commencementXiaoeTech); + // 导出批量报名导入 excel 表 + router.post("/importApplicationData", controller.download.importApplicationData); + // 导出考试星学员导入 excel 表 + router.post("/importExamStars", controller.download.importExamStars); + // 导出培训证书发放用户导入 excel 表 + router.post("/importIssuance", controller.download.importIssuance); + // 导出培训证书发放用户照片文件夹 + router.post("/importUserPhoto", controller.download.importUserPhoto); + // 上传用户照片 + router.post("/uploadUserPhoto", controller.download.uploadUserPhoto); + // 导出考试成绩导入 excel 表 + router.post("/importGradesData", controller.download.importGradesData); + + // 核验用户身份证二要素 + router.post("/CNTEV", controller.cntev.CNTEV); +}; diff --git a/app/service/Admin.js b/app/service/Admin.js new file mode 100644 index 0000000..0b47875 --- /dev/null +++ b/app/service/Admin.js @@ -0,0 +1,260 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const moment = require('moment'); + +const fileName = "Admin"; + +class AdminService extends Service { + // 管理系统新增普通管理员账号信息 + async addAdmin(form) { + const { ctx } = this; + try { + const result = await ctx.model.Manager.bulkCreate(form, { ignoreDuplicates: true }); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "addAdmin"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统查看普通管理员账号信息 + async showAdmin(uid, body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['uid', 'account_name', 'role', 'status', 'created_at', 'updated_at', 'login_status'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['uid', 'account_name'], + key = ['role', 'status', 'login_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 (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.model.Manager.findAndCountAll(dbOptions); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showAdmin"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统编辑普通管理员账号信息 + async editAdmin(uid, modelType, updateMsg, requestMsg) { + const { ctx } = this; + try { + const result = await ctx.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.role < 1) return false; + let where = {}; + if (modelType == "single") { + const { uid, account_name, role, status } = requestMsg; + where = { uid, account_name, role, status }; + } else if (modelType == "multiple") { + let uid = [], account_name = [], role = [], status = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + uid.push(element.uid); + account_name.push(element.account_name); + role.push(element.role); + status.push(element.status); + }); + } + where = { uid, account_name, role, status }; + } + updateMsg.updated_at = new Date(); + const resultList = await ctx.model.Manager.update(updateMsg, { where }); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + const blockName = fileName + "--" + "editAdmin"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统删除普通管理员账号信息 + async deleteAdmin(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.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 2) { + 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 < 2) systemMonitoring.status = 2; + await ctx.model.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { uid, account_name, role, status } = requestMsg; + where = { uid, account_name, role, status }; + } else if (modelType == "multiple") { + let uid = [], account_name = [], role = [], status = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + uid.push(element.uid); + account_name.push(element.account_name); + role.push(element.role); + status.push(element.status); + }); + } + where = { uid, account_name, role, status }; + } + const resultList = await ctx.model.Manager.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "deleteAdmin"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统导出普通管理员账号信息数据 + async downloadAdminData(uid, searchMsg) { + const { ctx } = this; + try { + const user = await ctx.model.Manager.findOne({ where: { uid } }); + if (!user || user.dataValues.role < 1) return false; + let { searchOptions, sortOptions } = searchMsg; + let attributes = ['uid', 'account_name', 'role', 'status', 'created_at', 'updated_at', 'login_status'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['uid', 'account_name'], + key = ['role', 'status', 'login_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 (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, where, order }; + const result = await ctx.model.Manager.findAll(dbOptions); + if (result.length == 0) return { code: false }; + let data = []; + const roleOptions = [ + { + value: "9", + label: "系统管理员" + }, + { + value: "0", + label: "临时管理员" + }, + { + value: "1", + label: "普通管理员" + }, + { + value: "2", + label: "高级管理员" + }, + ]; + const statusOptions = [ + { + value: "0", + label: "默认状态" + }, + { + value: "1", + label: "正常使用" + }, + { + value: "2", + label: "已被弃用" + }, + ]; + result.forEach(element => { + roleOptions.forEach((item) => { + if (item.value == element.dataValues["role"]) { + element.dataValues["role"] = item.label; + } + }); + statusOptions.forEach((item) => { + if (item.value == element.dataValues["status"]) { + element.dataValues["status"] = item.label; + } + }); + element.dataValues.created_at = moment + .utc(element.dataValues.created_at) + .add(8, "hours") + .format("YYYY年MM月DD日HH时mm分ss秒"); + element.dataValues.updated_at = moment + .utc(element.dataValues.updated_at) + .add(8, "hours") + .format("YYYY年MM月DD日HH时mm分ss秒"); + delete element.dataValues.login_status; + data.push(element.dataValues); + }); + return { code: true, data }; + } catch (error) { + const blockName = fileName + "--" + "downloadAdminData"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = AdminService; \ No newline at end of file diff --git a/app/service/Application.js b/app/service/Application.js new file mode 100644 index 0000000..fbc18f2 --- /dev/null +++ b/app/service/Application.js @@ -0,0 +1,483 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const moment = require('moment'); + +const fileName = "Application"; + +class ApplicationService extends Service { + // 管理系统新增用户报名信息 + async addApplication(userMsgObj, form) { + const { ctx } = this; + try { + let attributes = ['uid', 'user_name', 'identity_card'], + where = userMsgObj, + dbOptions = { attributes, where }; + const userUid = await ctx.model.Examinee.findAll(dbOptions); + if(userUid.length == 0) { + let errorForm = []; + form.forEach(item => { + errorForm.push({ + user_name: item.user_name, + identity_card: item.identity_card, + exam_uid: item.exam_uid, + type: 0, + status: 0, + created_at: new Date() + }); + }); + await ctx.model.Importerror.bulkCreate(errorForm); + return { code: 400 }; + }; + let errorMark = false; + form.forEach(async item => { + item.user_uid = 'none'; + userUid.forEach(element => { + if (item.user_name == element.dataValues.user_name && item.identity_card == element.dataValues.identity_card) { + item.user_uid = element.dataValues.uid; + } + }); + delete item.user_name; + delete item.identity_card; + if(item.user_uid == 'none') { + let errorForm = { + user_name: item.user_name, + identity_card: item.identity_card, + exam_uid: item.exam_uid, + type: 0, + status: 0, + created_at: new Date() + }; + errorMark = true; + await ctx.model.Importerror.create(errorForm); + } + }); + + const result = await ctx.model.Application.bulkCreate(form, { ignoreDuplicates: true }); + return result.length == 0 ? false : errorMark ? { code: 300, data: result } : { code: 200, data: result }; + } catch (error) { + const blockName = fileName + "--" + "addApplication"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统查看用户报名信息 + async showApplication(uid, body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['user_uid', 'exam_uid', 'source', 'status', 'pay_status', 'result', 'created_at'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['user_uid', 'exam_uid', 'source', 'result'], + key = ['status', 'pay_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']); + } + }); + + let examination = ['exam_name', 'application_start', 'application_end'], + examinationWhere = {}, + examinationOrder = [], + examinationJoinSubstring = [], + examinationSubstring = ['exam_name'], + examinationKey = [], + examinationBetween = ['application_start', 'application_end']; + + examination.forEach(item => { + if (searchOptions[item]) { + if (searchOptions[item] == '*空') { + if (examinationJoinSubstring.includes(item)) { + examinationWhere[item] = null; + } else { + examinationWhere[item] = [null, '']; + } + } else if (examinationSubstring.includes(item)) { + examinationWhere[item] = { [Op.substring]: searchOptions[item] }; + } else if (examinationKey.includes(item)) { + examinationWhere[item] = searchOptions[item]; + } else if (examinationBetween.includes(item)) { + examinationWhere[item] = { [Op.between]: [searchOptions[item][0], searchOptions[item][1]] }; + } + } + if (sortOptions[item] == true) { + examinationOrder.push([item, 'ASC']); + } else if (sortOptions[item] == false) { + examinationOrder.push([item, 'DESC']); + } + }); + + let examinee = ['user_name', 'identity_card', 'workplace', 'phone'], + examineeWhere = {}, + examineeOrder = [], + examineeJoinSubstring = [], + examineeSubstring = ['user_name', 'identity_card', 'workplace', 'phone'], + examineeKey = [], + examineeBetween = []; + + examinee.forEach(item => { + if (searchOptions[item]) { + if (searchOptions[item] == '*空') { + if (examineeJoinSubstring.includes(item)) { + examineeWhere[item] = null; + } else { + examineeWhere[item] = [null, '']; + } + } else if (examineeSubstring.includes(item)) { + examineeWhere[item] = { [Op.substring]: searchOptions[item] }; + } else if (examineeKey.includes(item)) { + examineeWhere[item] = searchOptions[item]; + } else if (examineeBetween.includes(item)) { + examineeWhere[item] = { [Op.between]: [searchOptions[item][0], searchOptions[item][1]] }; + } + } + if (sortOptions[item] == true) { + examineeOrder.push([item, 'ASC']); + } else if (sortOptions[item] == false) { + examineeOrder.push([item, 'DESC']); + } + }); + let include = [ + { + model: ctx.model.Examinee, + attributes: ['user_name', 'identity_card', 'workplace', 'phone'], + where: examineeWhere, + order: examineeOrder + }, + { + model: ctx.model.Examination, + attributes: ['exam_name', 'application_start', 'application_end'], + where: examinationWhere, + order: examinationOrder + } + ]; + ctx.model.Application.belongsTo(ctx.model.Examinee, { foreignKey: 'user_uid', targetKey: 'uid' }); + ctx.model.Application.belongsTo(ctx.model.Examination, { foreignKey: 'exam_uid', targetKey: 'uid' }); + + dbOptions = { attributes, offset, limit, where, order, include }; + const result = await ctx.model.Application.findAndCountAll(dbOptions); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showApplication"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统编辑用户报名信息 + async editApplication(uid, modelType, updateMsg, requestMsg) { + const { ctx } = this; + try { + const result = await ctx.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.role < 1) return false; + let where = {}; + if (modelType == "single") { + const { user_uid, exam_uid, source, status, pay_status, result } = requestMsg; + where = { user_uid, exam_uid, source, status, pay_status, result }; + } else if (modelType == "multiple") { + let user_uid = [], exam_uid = [], source = [], status = [], pay_status = [], result = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + user_uid.push(element.user_uid); + exam_uid.push(element.exam_uid); + source.push(element.source); + status.push(element.status); + pay_status.push(element.pay_status); + result.push(element.result); + }); + } + where = { user_uid, exam_uid, source, status, pay_status, result }; + } + const resultList = await ctx.model.Application.update(updateMsg, { where }); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + const blockName = fileName + "--" + "editApplication"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统删除用户报名信息 + async deleteApplication(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.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 2) { + 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 < 2) systemMonitoring.status = 2; + await ctx.model.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { user_uid, exam_uid, source, status, pay_status, result } = requestMsg; + where = { user_uid, exam_uid, source, status, pay_status, result }; + } else if (modelType == "multiple") { + let user_uid = [], exam_uid = [], source = [], status = [], pay_status = [], result = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + user_uid.push(element.user_uid); + exam_uid.push(element.exam_uid); + source.push(element.source); + status.push(element.status); + pay_status.push(element.pay_status); + result.push(element.result); + }); + } + where = { user_uid, exam_uid, source, status, pay_status, result }; + } + const resultList = await ctx.model.Application.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "deleteApplication"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统导出考生报名信息数据 + async downloadApplicationData(uid, searchMsg) { + const { ctx } = this; + try { + const user = await ctx.model.Manager.findOne({ where: { uid } }); + if (!user || user.dataValues.role < 1) return false; + let { searchOptions, sortOptions } = searchMsg; + let attributes = ['user_uid', 'exam_uid', 'source', 'status', 'pay_status', 'result', 'created_at'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['user_uid', 'exam_uid', 'source', 'result'], + key = ['status', 'pay_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']); + } + }); + let examination = ['exam_name', 'application_start', 'application_end'], + examinationWhere = {}, + examinationOrder = [], + examinationJoinSubstring = [], + examinationSubstring = ['exam_name'], + examinationKey = [], + examinationBetween = ['application_start', 'application_end']; + examination.forEach(item => { + if (searchOptions[item]) { + if (searchOptions[item] == '*空') { + if (examinationJoinSubstring.includes(item)) { + examinationWhere[item] = null; + } else { + examinationWhere[item] = [null, '']; + } + } else if (examinationSubstring.includes(item)) { + examinationWhere[item] = { [Op.substring]: searchOptions[item] }; + } else if (examinationKey.includes(item)) { + examinationWhere[item] = searchOptions[item]; + } else if (examinationBetween.includes(item)) { + examinationWhere[item] = { [Op.between]: [searchOptions[item][0], searchOptions[item][1]] }; + } + } + if (sortOptions[item] == true) { + examinationOrder.push([item, 'ASC']); + } else if (sortOptions[item] == false) { + examinationOrder.push([item, 'DESC']); + } + }); + + let examinee = ['user_name', 'identity_card', 'workplace', 'phone'], + examineeWhere = {}, + examineeOrder = [], + examineeJoinSubstring = [], + examineeSubstring = ['user_name', 'identity_card', 'workplace', 'phone'], + examineeKey = [], + examineeBetween = []; + + examinee.forEach(item => { + if (searchOptions[item]) { + if (searchOptions[item] == '*空') { + if (examineeJoinSubstring.includes(item)) { + examineeWhere[item] = null; + } else { + examineeWhere[item] = [null, '']; + } + } else if (examineeSubstring.includes(item)) { + examineeWhere[item] = { [Op.substring]: searchOptions[item] }; + } else if (examineeKey.includes(item)) { + examineeWhere[item] = searchOptions[item]; + } else if (examineeBetween.includes(item)) { + examineeWhere[item] = { [Op.between]: [searchOptions[item][0], searchOptions[item][1]] }; + } + } + if (sortOptions[item] == true) { + examineeOrder.push([item, 'ASC']); + } else if (sortOptions[item] == false) { + examineeOrder.push([item, 'DESC']); + } + }); + let include = [ + { + model: ctx.model.Examinee, + attributes: ['user_name', 'identity_card', 'workplace', 'phone'], + where: examineeWhere, + order: examineeOrder + }, + { + model: ctx.model.Examination, + attributes: ['exam_name', 'application_start', 'application_end'], + where: examinationWhere, + order: examinationOrder + } + ]; + ctx.model.Application.belongsTo(ctx.model.Examinee, { foreignKey: 'user_uid', targetKey: 'uid' }); + ctx.model.Application.belongsTo(ctx.model.Examination, { foreignKey: 'exam_uid', targetKey: 'uid' }); + dbOptions = { attributes, where, order, include }; + const result = await ctx.model.Application.findAll(dbOptions); + if (result.length == 0) return { code: false }; + let data = []; + const statusOptions = [ + { + value: "0", + label: "审核中" + }, + { + value: "1", + label: "报名成功" + }, + { + value: "2", + label: "报名失败" + }, + { + value: "3", + label: "取消报名" + }, + ]; + const payStatusOptions = [ + { + value: "0", + label: "未缴费" + }, + { + value: "1", + label: "缴费成功" + }, + { + value: "2", + label: "缴费失败" + }, + ]; + result.forEach(element => { + statusOptions.forEach((item) => { + if (item.value == element.dataValues["status"]) { + element.dataValues["status"] = item.label; + } + }); + payStatusOptions.forEach((item) => { + if (item.value == element.dataValues["pay_status"]) { + element.dataValues["pay_status"] = item.label; + } + }); + element.dataValues.user_name = element.dataValues.examinee.dataValues.user_name; + element.dataValues.identity_card = element.dataValues.examinee.dataValues.identity_card; + element.dataValues.exam_name = element.dataValues.examination.dataValues.exam_name; + element.dataValues.created_at = moment + .utc(element.dataValues.created_at) + .add(8, "hours") + .format("YYYY年MM月DD日HH时mm分ss秒"); + element.dataValues.application_start = moment + .utc(element.dataValues.examination.dataValues.application_start) + .add(8, "hours") + .format("YYYY年MM月DD日HH时mm分ss秒"); + element.dataValues.application_end = moment + .utc(element.dataValues.examination.dataValues.application_end) + .add(8, "hours") + .format("YYYY年MM月DD日HH时mm分ss秒"); + delete element.dataValues.examinee; + delete element.dataValues.examination; + let elementClone = { + user_uid: element.dataValues.user_uid, + user_name: element.dataValues.user_name, + identity_card: element.dataValues.identity_card, + exam_uid: element.dataValues.exam_uid, + exam_name: element.dataValues.exam_name, + source: element.dataValues.source, + status: element.dataValues.status, + pay_status: element.dataValues.pay_status, + result: element.dataValues.result, + created_at: element.dataValues.created_at, + application_start: element.dataValues.application_start, + application_end: element.dataValues.application_end, + } + data.push(elementClone); + }); + return { code: true, data }; + } catch (error) { + const blockName = fileName + "--" + "downloadApplicationData"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = ApplicationService; \ No newline at end of file diff --git a/app/service/Audit.js b/app/service/Audit.js new file mode 100644 index 0000000..39a50be --- /dev/null +++ b/app/service/Audit.js @@ -0,0 +1,89 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fileName = "Audit"; + +class AuditService extends Service { + // 管理系统查看用户关键信息变更 + async auditList(uid, body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['uid', 'user_name', 'identity_card', 'real_check', 'workplace', 'address', 'phone', 'email', 'status', 'created_at', 'updated_at', 'login_status'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['uid', 'user_name', 'identity_card', 'workplace', 'address', 'phone', 'email'], + key = ['real_check', 'status', 'login_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 (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 }; + // 默认查询的 status 为 0,管理员可以请求其他状态的审核列表 + // let status = 0; + const result = await ctx.model.Audit.findAndCountAll(dbOptions); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "auditList"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统审核用户关键信息变更 + async userMsgAudit(uid, body) { + const { ctx } = this; + try { + console.log(uid); + console.log(body); + // const result = await ctx.model.Audit.update({ status: 1 }, { where: { status: 0, body } }); + // console.log(result); + // return result[0] == 0 ? false : true; + return true; + } catch (error) { + const blockName = fileName + "--" + "userMsgAudit"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 保存导入考生报名信息和考生成绩时存在错误的数据,方便管理员查找问题 + async importerror(form) { + const { ctx } = this; + try { + await ctx.model.Importerror.bulkCreate(form); + } catch (error) { + const blockName = fileName + "--" + "importerror"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = AuditService; \ No newline at end of file diff --git a/app/service/Cntev.js b/app/service/Cntev.js new file mode 100644 index 0000000..5b7a474 --- /dev/null +++ b/app/service/Cntev.js @@ -0,0 +1,57 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fileName = "Cntev"; + +class CntevService extends Service { + // 筛选核验失败的数据 + async siftFailedList(finishedList) { + const { ctx } = this; + try { + let attributes = ['user_name', 'identity_card', 'real_check'], + where = { identity_card: { [Op.notIn]: finishedList }, real_check: 2 }, + dbOptions = { attributes, where }; + const result = await ctx.model.Examinee.findAll(dbOptions); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "siftFailedList"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 筛选未核验的数据 + async validateList(finishedList) { + const { ctx } = this; + try { + let attributes = ['user_name', 'identity_card', 'real_check'], + where = { identity_card: { [Op.notIn]: finishedList }, real_check: 0 }, + dbOptions = { attributes, where }; + const result = await ctx.model.Examinee.findAll(dbOptions); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "validateList"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 身份证二要素核验状态更新 + async updateCNTEV(user_name, identity_card, real_check) { + const { ctx } = this; + try { + const where = { user_name, identity_card }; + await ctx.model.Examinee.update({ real_check }, { where }); + await ctx.model.Audit.update({ status: real_check }, { where }); + } catch (error) { + const blockName = fileName + "--" + "CNTEV"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = CntevService; \ No newline at end of file diff --git a/app/service/Diff.js b/app/service/Diff.js new file mode 100644 index 0000000..8563087 --- /dev/null +++ b/app/service/Diff.js @@ -0,0 +1,80 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fileName = "Diff"; + +class DiffService extends Service { + // 比较身份证号 + async diffIdentityCard(identity_card, type, uid) { + const { ctx } = this; + try { + let attributes = ['identity_card'], + where = { identity_card }, + dbOptions = { attributes, where }; + const search = await ctx.model.Examinee.findAll(dbOptions); + if (type == 'register') { + return search.length == 0; + } else if (type == 'edit') { + where = { uid }; + dbOptions = { attributes, where }; + const result = await ctx.model.Examinee.findOne(dbOptions); + return result == null ? true : result.dataValues.identity_card == identity_card ? true : search.length == 0; + } + } catch (error) { + const blockName = fileName + "--" + "diffIdentityCard"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 比较邮箱 + async diffEmail(email, type, uid) { + const { ctx } = this; + try { + let attributes = ['email'], + where = { email }, + dbOptions = { attributes, where }; + const search = await ctx.model.Examinee.findAll(dbOptions); + if (type == 'register') { + return search.length == 0; + } else if (type == 'edit') { + where = { uid }; + dbOptions = { attributes, where }; + const result = await ctx.model.Examinee.findOne(dbOptions); + return result == null ? true : result.dataValues.email == email ? true : search.length == 0; + } + } catch (error) { + const blockName = fileName + "--" + "diffEmail"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 比较电话号码 + async diffPhone(phone, type, uid) { + const { ctx } = this; + try { + let attributes = ['phone'], + where = { phone }, + dbOptions = { attributes, where }; + const search = await ctx.model.Examinee.findAll(dbOptions); + if (type == 'register') { + return search.length == 0; + } else if (type == 'edit') { + where = { uid }; + dbOptions = { attributes, where }; + const result = await ctx.model.Examinee.findOne(dbOptions); + return result == null ? true : result.dataValues.phone == phone ? true : search.length == 0; + } + } catch (error) { + const blockName = fileName + "--" + "diffPhone"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = DiffService; \ No newline at end of file diff --git a/app/service/Download.js b/app/service/Download.js new file mode 100644 index 0000000..81d6b61 --- /dev/null +++ b/app/service/Download.js @@ -0,0 +1,493 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fileName = "Download"; + +class DownloadService extends Service { + // 导出小鹅通导入用户 + async importXiaoeTech(uid, searchMsg, importForm) { + const { ctx } = this; + try { + const user = await ctx.model.Manager.findOne({ where: { uid } }); + if (!user || user.dataValues.role < 1) return false; + let { searchOptions, sortOptions } = searchMsg; + let attributes = ['user_uid', 'exam_uid', 'status', 'result'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['exam_uid', 'result'], + key = ['status'], + 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']); + } + }); + let include = [ + { + model: ctx.model.Examinee, + attributes: ['user_name', 'identity_card', 'workplace', 'address', 'phone', 'email'], + } + ]; + ctx.model.Application.belongsTo(ctx.model.Examinee, { foreignKey: 'user_uid', targetKey: 'uid' }); + dbOptions = { attributes, where, order, include }; + const result = await ctx.model.Application.findAll(dbOptions); + if (result.length == 0) return { code: false }; + let data = []; + result.forEach(element => { + let identity_card = element.dataValues.examinee.dataValues.identity_card, + gender = parseInt(identity_card[16], 10) % 2 == 0 ? '女' : '男', + birthday = new Date(identity_card.substring(6, 14).substring(0, 4), identity_card.substring(6, 14).substring(4, 6) - 1, identity_card.substring(6, 14).substring(6, 8)), + age = new Date().getFullYear() - birthday.getFullYear(); + const m = new Date().getMonth() - birthday.getMonth(); + if (m < 0 || (m === 0 && new Date().getDate() < birthday.getDate())) { + age--; + } + data.push({ + phone: element.dataValues.examinee.dataValues.phone, + user_name: element.dataValues.examinee.dataValues.user_name, + remark: "", + gender, + age, + birthday, + province: "", + city: "", + address: element.dataValues.examinee.dataValues.address, + email: element.dataValues.examinee.dataValues.email, + industry: "", + company: element.dataValues.examinee.dataValues.workplace, + position: "", + description: "", + tags: "", + }); + }); + return { code: true, data }; + } catch (error) { + const blockName = fileName + "--" + "importXiaoeTech"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 导出小鹅通开课学员 + async commencementXiaoeTech(uid, searchMsg, importForm) { + const { ctx } = this; + try { + const user = await ctx.model.Manager.findOne({ where: { uid } }); + if (!user || user.dataValues.role < 1) return false; + let { searchOptions, sortOptions } = searchMsg; + let attributes = ['user_uid', 'exam_uid', 'status', 'result'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['exam_uid', 'result'], + key = ['status'], + 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']); + } + }); + let include = [ + { + model: ctx.model.Examinee, + attributes: ['phone'], + } + ]; + ctx.model.Application.belongsTo(ctx.model.Examinee, { foreignKey: 'user_uid', targetKey: 'uid' }); + dbOptions = { attributes, where, order, include }; + const result = await ctx.model.Application.findAll(dbOptions); + if (result.length == 0) return { code: false }; + let data = []; + result.forEach(element => { + data.push({ + phone: element.dataValues.examinee.dataValues.phone, + expired_at: importForm.expired_at.replace(/_/g, ' ').replace(/:/g, ':'), + }); + }); + return { code: true, data }; + } catch (error) { + const blockName = fileName + "--" + "commencementXiaoeTech"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 导出批量报名导入 excel 表 + async importApplicationData(uid, searchMsg, importForm) { + const { ctx } = this; + try { + const user = await ctx.model.Manager.findOne({ where: { uid } }); + if (!user || user.dataValues.role < 1) return false; + let { searchOptions, sortOptions } = searchMsg; + let attributes = ['user_name', 'identity_card', 'workplace', 'created_at'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['workplace'], + key = [], + 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, where, order }; + const result = await ctx.model.Examinee.findAll(dbOptions); + if (result.length == 0) return { code: false }; + let data = []; + result.forEach(element => { + data.push({ + identity_card: element.dataValues.identity_card, + user_name: element.dataValues.user_name, + exam_uid: importForm.exam_uid, + source: importForm.source, + status: "1", + pay_status: "1", + result: importForm.result + }); + }); + return { code: true, data }; + } catch (error) { + const blockName = fileName + "--" + "importApplicationData"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 导出考试星学员导入 excel 表 + async importExamStars(uid, searchMsg, importForm) { + const { ctx } = this; + try { + const user = await ctx.model.Manager.findOne({ where: { uid } }); + if (!user || user.dataValues.role < 1) return false; + let { searchOptions, sortOptions } = searchMsg; + let attributes = ['exam_uid', 'status'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['exam_uid'], + key = ['status'], + 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']); + } + }); + let include = [ + { + model: ctx.model.Examinee, + attributes: ['user_name', 'identity_card'], + } + ]; + ctx.model.Application.belongsTo(ctx.model.Examinee, { foreignKey: 'user_uid', targetKey: 'uid' }); + dbOptions = { attributes, where, order, include }; + const result = await ctx.model.Application.findAll(dbOptions); + if (result.length == 0) return { code: false }; + let data = []; + result.forEach(element => { + data.push({ + account: element.dataValues.examinee.dataValues.identity_card, + password: element.dataValues.examinee.dataValues.identity_card.substr(-6), + name: element.dataValues.examinee.dataValues.user_name, + department: "", + }); + }); + return { code: true, data }; + } catch (error) { + const blockName = fileName + "--" + "importExamStars"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 导出培训证书发放用户导入 excel 表 + async importIssuance(uid, searchMsg, importForm) { + const { ctx } = this; + try { + const user = await ctx.model.Manager.findOne({ where: { uid } }); + if (!user || user.dataValues.role < 1) return false; + let { searchOptions, sortOptions } = searchMsg; + let attributes = ['exam_uid', 'status'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['exam_uid'], + key = ['status'], + 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']); + } + }); + let include = [ + { + model: ctx.model.Examinee, + attributes: ['user_name', 'identity_card', 'workplace', 'address', 'phone'], + } + ]; + ctx.model.Application.belongsTo(ctx.model.Examinee, { foreignKey: 'user_uid', targetKey: 'uid' }); + dbOptions = { attributes, where, order, include }; + const result = await ctx.model.Application.findAll(dbOptions); + if (result.length == 0) return { code: false }; + let data = []; + result.forEach((element, index) => { + data.push({ + id: index + 1, + user_name: element.dataValues.examinee.dataValues.user_name, + identity_card: element.dataValues.examinee.dataValues.identity_card, + workplace: element.dataValues.examinee.dataValues.workplace, + address: element.dataValues.examinee.dataValues.address, + phone: element.dataValues.examinee.dataValues.phone, + start: "", + end: "", + place: "", + way: "", + score: "", + certificate_name: "", + level: "", + }); + }); + return { code: true, data }; + } catch (error) { + const blockName = fileName + "--" + "importIssuance"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 导出培训证书发放用户照片文件夹 + async importUserPhoto(uid, searchMsg) { + const { ctx } = this; + try { + const user = await ctx.model.Manager.findOne({ where: { uid } }); + if (!user || user.dataValues.role < 1) return false; + let { searchOptions, sortOptions } = searchMsg; + let attributes = ['exam_uid', 'status'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['exam_uid'], + key = ['status'], + 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']); + } + }); + let include = [ + { + model: ctx.model.Examinee, + attributes: ['identity_card'], + } + ]; + ctx.model.Application.belongsTo(ctx.model.Examinee, { foreignKey: 'user_uid', targetKey: 'uid' }); + dbOptions = { attributes, where, order, include }; + const result = await ctx.model.Application.findAll(dbOptions); + if (result.length == 0) return { code: false }; + let data = []; + result.forEach(element => { + data.push({ + identity_card: element.dataValues.examinee.dataValues.identity_card, + }); + }); + return { code: true, data }; + } catch (error) { + const blockName = fileName + "--" + "importUserPhoto"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 导出考试成绩导入 excel 表 + async importGradesData(uid, formClone, dataType, passingScore, gradesType) { + const { ctx } = this; + try { + const user = await ctx.model.Manager.findOne({ where: { uid } }); + if (!user || user.dataValues.role < 1) return false; + const data = formClone.map(item => ({ + user_name: item.user_name, + identity_card: item.identity_card, + exam_uid: "", + status: "", + grades: item.grades, + pass_type: "", + })); + const identityCards = data.map(item => item.identity_card); + const userNames = data.map(item => item.user_name); + const examineeUid = await ctx.model.Examinee.findAll({ attributes: ['uid', 'identity_card', 'user_name'], where: { identity_card: identityCards, user_name: userNames } }); + if (examineeUid.length == 0) return { code: false }; + const uidMap = new Map(); + const userUids = []; + examineeUid.forEach(element => { + uidMap.set(`${element.dataValues.identity_card}_${element.dataValues.user_name}`, element.dataValues.uid); + userUids.push(element.dataValues.uid); + }); + data.forEach(item => { + const key = `${item.identity_card}_${item.user_name}`; + if (uidMap.has(key)) { + item.user_uid = uidMap.get(key); + } + }); + const applicationUid = await ctx.model.Application.findAll({ attributes: ['user_uid', 'exam_uid'], where: { user_uid: userUids, status: 1 }, order: [['created_at', 'DESC']], limit: userUids.length }); + if (applicationUid.length == 0) return { code: false }; + const applicationUidMap = new Map(applicationUid.map(item => [item.dataValues.user_uid, item.dataValues.exam_uid])); + data.forEach(item => { + if (applicationUidMap.has(item.user_uid)) { + item.exam_uid = applicationUidMap.get(item.user_uid); + } + }); + const examUids = [...new Set(applicationUid.map(item => item.dataValues.exam_uid))]; + let include = [ + { + model: ctx.model.Examinee, + attributes: ['user_name', 'identity_card'], + }, + ]; + if (gradesType == '0') { + ctx.model.Application.belongsTo(ctx.model.Examinee, { foreignKey: 'user_uid', targetKey: 'uid' }); + const application = await ctx.model.Application.findAll({ attributes: ['user_uid', 'exam_uid'], where: { user_uid: { [Op.notIn]: userUids }, exam_uid: examUids, status: 1 }, include }); + application.forEach(element => { + data.push({ + identity_card: element.dataValues.examinee.dataValues.identity_card, + user_name: element.dataValues.examinee.dataValues.user_name, + user_uid: element.dataValues.user_uid, + exam_uid: element.dataValues.exam_uid, + grades: null, + }); + }); + } + data.forEach(item => { + delete item.user_uid; + item.status = dataType == '0' ? 1 : (item.grades == null ? 0 : 1); + item.pass_type = item.grades == null + ? (dataType == '0' ? 0 : 2) + : (dataType == '1' && item.grades < passingScore ? 0 : 1); + }); + return { code: true, data }; + } catch (error) { + const blockName = fileName + "--" + "importGradesData"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = DownloadService; \ No newline at end of file diff --git a/app/service/Exam.js b/app/service/Exam.js new file mode 100644 index 0000000..615ee6d --- /dev/null +++ b/app/service/Exam.js @@ -0,0 +1,247 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const moment = require('moment'); + +const fileName = "Exam"; + +class ExamService extends Service { + // 管理系统新增考试信息 + async addExam(form) { + const { ctx } = this; + try { + const result = await ctx.model.Examination.bulkCreate(form, { ignoreDuplicates: true }); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "addExam"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统查看考试信息 + async showExam(uid, body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['uid', 'exam_name', 'status', 'application_start', 'application_end', 'exam_start', 'exam_end'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['uid', 'exam_name'], + key = ['status'], + between = ['application_start', 'application_end', 'exam_start', 'exam_end']; + 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.model.Examination.findAndCountAll(dbOptions); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showExam"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统编辑考试信息 + async editExam(uid, modelType, updateMsg, requestMsg) { + const { ctx } = this; + try { + const result = await ctx.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.role < 1) return false; + let where = {}; + if (modelType == "single") { + const { exam_name, status, application_start, application_end, exam_start, exam_end } = requestMsg; + where = { exam_name, status, application_start, application_end, exam_start, exam_end }; + } else if (modelType == "multiple") { + let exam_name = [], status = [], application_start = [], application_end = [], exam_start = [], exam_end = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + exam_name.push(element.exam_name); + status.push(element.status); + application_start.push(element.application_start); + application_end.push(element.application_end); + exam_start.push(element.exam_start); + exam_end.push(element.exam_end); + }); + } + where = { exam_name, status, application_start, application_end, exam_start, exam_end }; + } + const resultList = await ctx.model.Examination.update(updateMsg, { where }); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + const blockName = fileName + "--" + "editExam"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统删除考试信息 + async deleteExam(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.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 2) { + 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 < 2) systemMonitoring.status = 2; + await ctx.model.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { exam_name, status, application_start, application_end, exam_start, exam_end } = requestMsg; + where = { exam_name, status, application_start, application_end, exam_start, exam_end }; + } else if (modelType == "multiple") { + let exam_name = [], status = [], application_start = [], application_end = [], exam_start = [], exam_end = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + exam_name.push(element.exam_name); + status.push(element.status); + application_start.push(element.application_start); + application_end.push(element.application_end); + exam_start.push(element.exam_start); + exam_end.push(element.exam_end); + }); + } + where = { exam_name, status, application_start, application_end, exam_start, exam_end }; + } + const resultList = await ctx.model.Examination.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "deleteExam"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统导出考试信息数据 + async downloadExamData(uid, searchMsg) { + const { ctx } = this; + try { + const user = await ctx.model.Manager.findOne({ where: { uid } }); + if (!user || user.dataValues.role < 1) return false; + let { searchOptions, sortOptions } = searchMsg; + let attributes = ['uid', 'exam_name', 'status', 'application_start', 'application_end', 'exam_start', 'exam_end'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['uid', 'exam_name'], + key = ['status'], + between = ['application_start', 'application_end', 'exam_start', 'exam_end']; + 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, where, order }; + const result = await ctx.model.Examination.findAll(dbOptions); + if (result.length == 0) return { code: false }; + let data = []; + const statusOptions = [ + { + value: "0", + label: "即将进行" + }, + { + value: "1", + label: "正在进行" + }, + { + value: "2", + label: "已经结束" + }, + ]; + result.forEach(element => { + statusOptions.forEach((item) => { + if (item.value == element.dataValues["status"]) { + element.dataValues["status"] = item.label; + } + }); + element.dataValues.application_start = moment + .utc(element.dataValues.application_start) + .add(8, "hours") + .format("YYYY年MM月DD日HH时mm分ss秒"); + element.dataValues.application_end = moment + .utc(element.dataValues.application_end) + .add(8, "hours") + .format("YYYY年MM月DD日HH时mm分ss秒"); + element.dataValues.exam_start = moment + .utc(element.dataValues.exam_start) + .add(8, "hours") + .format("YYYY年MM月DD日HH时mm分ss秒"); + element.dataValues.exam_end = moment + .utc(element.dataValues.exam_end) + .add(8, "hours") + .format("YYYY年MM月DD日HH时mm分ss秒"); + data.push(element.dataValues); + }); + return { code: true, data }; + } catch (error) { + const blockName = fileName + "--" + "downloadExamData"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = ExamService; \ No newline at end of file diff --git a/app/service/Find.js b/app/service/Find.js new file mode 100644 index 0000000..9873350 --- /dev/null +++ b/app/service/Find.js @@ -0,0 +1,82 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fileName = "Find"; + +class FindService extends Service { + // 管理系统检索考生姓名 + async findUserName(uid, body) { + const { ctx } = this; + try { + const result = await ctx.model.Examinee.findOne({ where: { user_name: body.user_name } }); + return result || false; + } catch (error) { + const blockName = fileName + "--" + "findUserName"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统检索考生身份证号 + async findIdentityCard(uid, body) { + const { ctx } = this; + try { + const result = await ctx.model.Examinee.findOne({ where: { identity_card: body.identity_card } }); + if (!result) return { code: 404 }; + const user = await ctx.model.Examinee.findOne({ where: { user_name: body.user_name, identity_card: body.identity_card } }); + if (!user) return { code: 303 }; + return { code: 200 }; + } catch (error) { + const blockName = fileName + "--" + "findIdentityCard"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统检索考生 uid + async findUserUid(identity_card, user_name) { + const { ctx } = this; + try { + let attributes = ['uid'], + where = { identity_card, user_name }, + dbOptions = { attributes, where }; + const result = await ctx.model.Examinee.findOne(dbOptions); + return result || false; + } catch (error) { + const blockName = fileName + "--" + "findUserUid"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统检索考试 uid + async findExamUid(uid, body) { + const { ctx } = this; + try { + const result = await ctx.model.Examination.findOne({ where: { uid: body.exam_uid } }); + return result || false; + } catch (error) { + const blockName = fileName + "--" + "findExamUid"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统查找指定工作单位 + async findWorkplace(uid, body) { + const { ctx } = this; + try { + const result = await ctx.model.Examinee.findOne({ where: { workplace: body.workplace } }); + return result || false; + } catch (error) { + const blockName = fileName + "--" + "findWorkplace"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = FindService; \ No newline at end of file diff --git a/app/service/Grades.js b/app/service/Grades.js new file mode 100644 index 0000000..09ad538 --- /dev/null +++ b/app/service/Grades.js @@ -0,0 +1,468 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const moment = require('moment'); + +const fileName = "Grades"; + +class GradesService extends Service { + // 管理系统新增用户考试结果 + async addGrades(userMsgObj, form) { + const { ctx } = this; + try { + let attributes = ['uid', 'user_name', 'identity_card'], + where = userMsgObj, + dbOptions = { attributes, where }; + const userUid = await ctx.model.Examinee.findAll(dbOptions); + if(userUid.length == 0) { + let errorForm = []; + form.forEach(item => { + errorForm.push({ + user_name: item.user_name, + identity_card: item.identity_card, + exam_uid: item.exam_uid, + type: 1, + status: 0, + created_at: new Date() + }); + }); + await ctx.model.Importerror.bulkCreate(errorForm); + return { code: 400 }; + }; + let errorMark = false; + form.forEach(async item => { + item.user_uid = 'none'; + userUid.forEach(element => { + if (item.user_name == element.dataValues.user_name && item.identity_card == element.dataValues.identity_card) { + item.user_uid = element.dataValues.uid; + } + }); + delete item.user_name; + delete item.identity_card; + if (item.user_uid == 'none') { + let errorForm = { + user_name: item.user_name, + identity_card: item.identity_card, + exam_uid: item.exam_uid, + type: 1, + status: 0, + created_at: new Date() + }; + errorMark = true; + await ctx.model.Importerror.create(errorForm); + } + }); + const result = await ctx.model.Grades.bulkCreate(form, { ignoreDuplicates: true }); + return result.length == 0 ? false : errorMark ? { code: 300, data: result } : { code: 200, data: result }; + } catch (error) { + const blockName = fileName + "--" + "addGrades"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统查看用户考试结果 + async showGrades(uid, body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['user_uid', 'exam_uid', 'status', 'grades', 'pass_type'], + where = {}, order = [], dbOptions, + joinSubstring = ['grades'], + substring = ['user_uid', 'exam_uid'], + key = ['status', 'pass_type'], + 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)) { + where[element] = { [Op.substring]: searchOptions[element] }; + } 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']); + } + }); + + let examination = ['exam_name', 'exam_start', 'exam_end'], + examinationWhere = {}, + examinationOrder = [], + examinationJoinSubstring = [], + examinationSubstring = ['exam_name'], + examinationKey = [], + examinationBetween = ['exam_start', 'exam_end']; + + examination.forEach(item => { + if (searchOptions[item]) { + if (searchOptions[item] == '*空') { + if (examinationJoinSubstring.includes(item)) { + examinationWhere[item] = null; + } else { + examinationWhere[item] = [null, '']; + } + } else if (examinationSubstring.includes(item)) { + examinationWhere[item] = { [Op.substring]: searchOptions[item] }; + } else if (examinationKey.includes(item)) { + examinationWhere[item] = searchOptions[item]; + } else if (examinationBetween.includes(item)) { + examinationWhere[item] = { [Op.between]: [searchOptions[item][0], searchOptions[item][1]] }; + } + } + if (sortOptions[item] == true) { + examinationOrder.push([item, 'ASC']); + } else if (sortOptions[item] == false) { + examinationOrder.push([item, 'DESC']); + } + }); + + let examinee = ['user_name', 'identity_card', 'workplace', 'phone'], + examineeWhere = {}, + examineeOrder = [], + examineeJoinSubstring = [], + examineeSubstring = ['user_name', 'identity_card', 'workplace', 'phone'], + examineeKey = [], + examineeBetween = []; + + examinee.forEach(item => { + if (searchOptions[item]) { + if (searchOptions[item] == '*空') { + if (examineeJoinSubstring.includes(item)) { + examineeWhere[item] = null; + } else { + examineeWhere[item] = [null, '']; + } + } else if (examineeSubstring.includes(item)) { + examineeWhere[item] = { [Op.substring]: searchOptions[item] }; + } else if (examineeKey.includes(item)) { + examineeWhere[item] = searchOptions[item]; + } else if (examineeBetween.includes(item)) { + examineeWhere[item] = { [Op.between]: [searchOptions[item][0], searchOptions[item][1]] }; + } + } + if (sortOptions[item] == true) { + examineeOrder.push([item, 'ASC']); + } else if (sortOptions[item] == false) { + examineeOrder.push([item, 'DESC']); + } + }); + let include = [ + { + model: ctx.model.Examinee, + attributes: ['user_name', 'identity_card', 'workplace', 'phone'], + where: examineeWhere, + order: examineeOrder + }, + { + model: ctx.model.Examination, + attributes: ['exam_name', 'exam_start', 'exam_end'], + where: examinationWhere, + order: examinationOrder + } + ]; + ctx.model.Grades.belongsTo(ctx.model.Examinee, { foreignKey: 'user_uid', targetKey: 'uid' }); + ctx.model.Grades.belongsTo(ctx.model.Examination, { foreignKey: 'exam_uid', targetKey: 'uid' }); + dbOptions = { attributes, offset, limit, where, order, include }; + const result = await ctx.model.Grades.findAndCountAll(dbOptions); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showGrades"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统编辑用户考试结果 + async editGrades(uid, modelType, updateMsg, requestMsg) { + const { ctx } = this; + try { + const result = await ctx.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.role < 1) return false; + let where = {}; + if (modelType == "single") { + const { user_uid, exam_uid, status, grades, pass_type } = requestMsg; + where = { user_uid, exam_uid, status, grades, pass_type }; + } else if (modelType == "multiple") { + let user_uid = [], exam_uid = [], status = [], pass_type = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + user_uid.push(element.user_uid); + exam_uid.push(element.exam_uid); + status.push(element.status); + pass_type.push(element.pass_type); + }); + } + where = { user_uid, exam_uid, status, pass_type }; + } + const resultList = await ctx.model.Grades.update(updateMsg, { where }); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + const blockName = fileName + "--" + "editGrades"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统删除考生考试成绩 + async deleteGrades(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.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 2) { + 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 < 2) systemMonitoring.status = 2; + await ctx.model.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { user_uid, exam_uid, status, grades, pass_type } = requestMsg; + where = { user_uid, exam_uid, status, grades, pass_type }; + } else if (modelType == "multiple") { + let user_uid = [], exam_uid = [], status = [], grades = [], pass_type = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + user_uid.push(element.user_uid); + exam_uid.push(element.exam_uid); + status.push(element.status); + grades.push(element.grades); + pass_type.push(element.pass_type); + }); + } + where = { user_uid, exam_uid, status, grades, pass_type }; + } + const resultList = await ctx.model.Grades.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "deleteGrades"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统导出考生考试结果数据 + async downloadGradesData(uid, searchMsg) { + const { ctx } = this; + try { + const user = await ctx.model.Manager.findOne({ where: { uid } }); + if (!user || user.dataValues.role < 1) return false; + let { searchOptions, sortOptions } = searchMsg; + let attributes = ['user_uid', 'exam_uid', 'status', 'grades', 'pass_type'], + where = {}, order = [], dbOptions, + joinSubstring = ['grades'], + substring = ['user_uid', 'exam_uid'], + key = ['status', 'pass_type'], + 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)) { + where[element] = { [Op.substring]: searchOptions[element] }; + } 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']); + } + }); + + let examination = ['exam_name', 'exam_start', 'exam_end'], + examinationWhere = {}, + examinationOrder = [], + examinationJoinSubstring = [], + examinationSubstring = ['exam_name'], + examinationKey = [], + examinationBetween = ['exam_start', 'exam_end']; + + examination.forEach(item => { + if (searchOptions[item]) { + if (searchOptions[item] == '*空') { + if (examinationJoinSubstring.includes(item)) { + examinationWhere[item] = null; + } else { + examinationWhere[item] = [null, '']; + } + } else if (examinationSubstring.includes(item)) { + examinationWhere[item] = { [Op.substring]: searchOptions[item] }; + } else if (examinationKey.includes(item)) { + examinationWhere[item] = searchOptions[item]; + } else if (examinationBetween.includes(item)) { + examinationWhere[item] = { [Op.between]: [searchOptions[item][0], searchOptions[item][1]] }; + } + } + if (sortOptions[item] == true) { + examinationOrder.push([item, 'ASC']); + } else if (sortOptions[item] == false) { + examinationOrder.push([item, 'DESC']); + } + }); + + let examinee = ['user_name', 'identity_card', 'workplace', 'phone'], + examineeWhere = {}, + examineeOrder = [], + examineeJoinSubstring = [], + examineeSubstring = ['user_name', 'identity_card', 'workplace', 'phone'], + examineeKey = [], + examineeBetween = []; + + examinee.forEach(item => { + if (searchOptions[item]) { + if (searchOptions[item] == '*空') { + if (examineeJoinSubstring.includes(item)) { + examineeWhere[item] = null; + } else { + examineeWhere[item] = [null, '']; + } + } else if (examineeSubstring.includes(item)) { + examineeWhere[item] = { [Op.substring]: searchOptions[item] }; + } else if (examineeKey.includes(item)) { + examineeWhere[item] = searchOptions[item]; + } else if (examineeBetween.includes(item)) { + examineeWhere[item] = { [Op.between]: [searchOptions[item][0], searchOptions[item][1]] }; + } + } + if (sortOptions[item] == true) { + examineeOrder.push([item, 'ASC']); + } else if (sortOptions[item] == false) { + examineeOrder.push([item, 'DESC']); + } + }); + let include = [ + { + model: ctx.model.Examinee, + attributes: ['user_name', 'identity_card', 'workplace', 'phone'], + where: examineeWhere, + order: examineeOrder + }, + { + model: ctx.model.Examination, + attributes: ['exam_name', 'exam_start', 'exam_end'], + where: examinationWhere, + order: examinationOrder + } + ]; + ctx.model.Grades.belongsTo(ctx.model.Examinee, { foreignKey: 'user_uid', targetKey: 'uid' }); + ctx.model.Grades.belongsTo(ctx.model.Examination, { foreignKey: 'exam_uid', targetKey: 'uid' }); + dbOptions = { attributes, where, order, include }; + const result = await ctx.model.Grades.findAll(dbOptions); + if (result.length == 0) return { code: false }; + let data = []; + const statusOptions = [ + { + value: "0", + label: "旷考" + }, + { + value: "1", + label: "正常参与" + }, + { + value: "2", + label: "考试作弊" + }, + ]; + const passTypeOptions = [ + { + value: "0", + label: "成绩不及格" + }, + { + value: "1", + label: "成绩及格" + }, + { + value: "2", + label: "无成绩" + }, + ]; + result.forEach(element => { + statusOptions.forEach((item) => { + if (item.value == element.dataValues["status"]) { + element.dataValues["status"] = item.label; + } + }); + passTypeOptions.forEach((item) => { + if (item.value == element.dataValues["pass_type"]) { + element.dataValues["pass_type"] = item.label; + } + }); + element.dataValues.user_name = element.dataValues.examinee.dataValues.user_name; + element.dataValues.identity_card = element.dataValues.examinee.dataValues.identity_card; + element.dataValues.exam_name = element.dataValues.examination.dataValues.exam_name; + element.dataValues.exam_start = moment + .utc(element.dataValues.examination.dataValues.exam_start) + .add(8, "hours") + .format("YYYY年MM月DD日HH时mm分ss秒"); + element.dataValues.exam_end = moment + .utc(element.dataValues.examination.dataValues.exam_end) + .add(8, "hours") + .format("YYYY年MM月DD日HH时mm分ss秒"); + delete element.dataValues.examinee; + delete element.dataValues.examination; + let elementClone = { + user_uid: element.dataValues.user_uid, + user_name: element.dataValues.user_name, + identity_card: element.dataValues.identity_card, + exam_uid: element.dataValues.exam_uid, + exam_name: element.dataValues.exam_name, + status: element.dataValues.status, + grades: element.dataValues.grades, + pass_type: element.dataValues.pass_type, + exam_start: element.dataValues.exam_start, + exam_end: element.dataValues.exam_end, + } + data.push(elementClone); + }); + return { code: true, data }; + } catch (error) { + const blockName = fileName + "--" + "downloadGradesData"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = GradesService; \ No newline at end of file diff --git a/app/service/Importerror.js b/app/service/Importerror.js new file mode 100644 index 0000000..a40f1ec --- /dev/null +++ b/app/service/Importerror.js @@ -0,0 +1,145 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fileName = "Importerror"; + +class ImporterrorService extends Service { + // 查看导入错误记录 + async showImporterror(body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['user_name', 'identity_card', 'exam_uid', 'type', 'status', 'created_at'], + where = {}, order = [], dbOptions, joinSubstring = [], + substring = ['user_name', 'identity_card', 'exam_uid'], + key = ['type', '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 (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']); + } + }); + + let examination = ['exam_name'], + examinationWhere = {}, + examinationOrder = [], + examinationJoinSubstring = [], + examinationSubstring = ['exam_name'], + examinationKey = [], + examinationBetween = []; + + examination.forEach(item => { + if (searchOptions[item]) { + if (searchOptions[item] == '*空') { + if (examinationJoinSubstring.includes(item)) { + examinationWhere[item] = null; + } else { + examinationWhere[item] = [null, '']; + } + } else if (examinationSubstring.includes(item)) { + examinationWhere[item] = { [Op.substring]: searchOptions[item] }; + } else if (examinationKey.includes(item)) { + examinationWhere[item] = searchOptions[item]; + } else if (examinationBetween.includes(item)) { + examinationWhere[item] = { [Op.between]: [searchOptions[item][0], searchOptions[item][1]] }; + } + } + if (sortOptions[item] == true) { + examinationOrder.push([item, 'ASC']); + } else if (sortOptions[item] == false) { + examinationOrder.push([item, 'DESC']); + } + }); + + let include = [ + { + model: ctx.model.Examination, + attributes: ['exam_name'], + where: examinationWhere, + order: examinationOrder + } + ]; + ctx.model.Importerror.belongsTo(ctx.model.Examination, { foreignKey: 'exam_uid', targetKey: 'uid' }); + dbOptions = { attributes, offset, limit, where, order, include }; + const result = await ctx.model.Importerror.findAndCountAll(dbOptions); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showImporterror"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 删除导入错误记录 + async deleteImporterror(uid, modelType, password, requestMsg) { + const { ctx } = this; + const systemImporterror = { + operate: 2, + operate_msg: '删除导入错误记录', + type: 2, + status: 0, + affect_entries: 0, + user: uid, + created_at: new Date() + }; + try { + const result = await ctx.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 2) { + if (!result) systemImporterror.status = 0; + else if (result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt))) systemImporterror.status = 1; + else if (result.dataValues.role < 2) systemImporterror.status = 2; + await ctx.model.Importerror.create(systemImporterror); + return false; + }; + let where = {}; + if (modelType == "single") { + const { identity_card, exam_uid, created_at } = requestMsg; + where = { identity_card, exam_uid, created_at }; + } else if (modelType == "multiple") { + let identity_card = [], exam_uid = [], created_at = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + identity_card.push(element.identity_card), + exam_uid.push(element.exam_uid), + created_at.push(element.created_at) + }); + } + where = { identity_card, exam_uid, created_at }; + } + const resultList = await ctx.model.Importerror.destroy({ where }); + systemImporterror.status = resultList == 0 ? 3 : 4; + systemImporterror.affect_entries = resultList; + await ctx.model.Importerror.create(systemImporterror); + return resultList == 0 ? false : true; + } catch (error) { + systemImporterror.status = 5; + await ctx.model.Importerror.create(systemImporterror); + const blockName = fileName + "--" + "deleteImporterror"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = ImporterrorService; \ No newline at end of file diff --git a/app/service/Interlocution.js b/app/service/Interlocution.js new file mode 100644 index 0000000..142eb5d --- /dev/null +++ b/app/service/Interlocution.js @@ -0,0 +1,225 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const moment = require('moment'); + +const fileName = "Interlocution"; + +class InterlocutionService extends Service { + // 管理系统新增问答题 + async addInterlocution(form) { + const { ctx } = this; + try { + const result = await ctx.model2.Interlocution.bulkCreate(form, { ignoreDuplicates: true }); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "addInterlocution"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统查看问答题 + async showInterlocution(uid, body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['stem', 'answer', 'difficulty'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['stem', 'answer'], + key = ['difficulty'], + 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.model2.Interlocution.findAndCountAll(dbOptions); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showInterlocution"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统编辑问答题 + async editInterlocution(uid, modelType, updateMsg, requestMsg) { + const { ctx } = this; + try { + const result = await ctx.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.role < 1) return false; + let where = {}; + if (modelType == "single") { + const { stem, answer, difficulty } = requestMsg; + where = { stem, answer, difficulty }; + } else if (modelType == "multiple") { + let stem = [], answer = [], difficulty = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + stem.push(element.stem); + answer.push(element.answer); + difficulty.push(element.difficulty); + }); + } + where = { stem, answer, difficulty }; + } + const resultList = await ctx.model2.Interlocution.update(updateMsg, { where }); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + const blockName = fileName + "--" + "editInterlocution"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统删除问答题 + async deleteInterlocution(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.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 2) { + 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 < 2) systemMonitoring.status = 2; + await ctx.model.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { stem, answer, difficulty } = requestMsg; + where = { stem, answer, difficulty }; + } else if (modelType == "multiple") { + let stem = [], answer = [], difficulty = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + stem.push(element.stem); + answer.push(element.answer); + difficulty.push(element.difficulty); + }); + } + where = { stem, answer, difficulty }; + } + const resultList = await ctx.model2.Interlocution.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "deleteInterlocution"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统导出问答题数据 + async downloadInterlocutionData(uid, searchMsg) { + const { ctx } = this; + try { + const user = await ctx.model.Manager.findOne({ where: { uid } }); + if (!user || user.dataValues.role < 1) return { code: false }; + let { searchOptions, sortOptions } = searchMsg; + let attributes = ['stem', 'answer', 'difficulty'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['stem', 'answer', 'difficulty'], + key = [], + 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, where, order }; + const result = await ctx.model2.Interlocution.findAll(dbOptions); + if (result.length == 0) return { code: false }; + let data = []; + const difficultyOptions = [ + { + value: "0", + label: "简单" + }, + { + value: "1", + label: "普通" + }, + { + value: "2", + label: "困难" + }, + ]; + result.forEach(element => { + difficultyOptions.forEach((item) => { + if (item.value == element.dataValues["difficulty"]) { + element.dataValues["difficulty"] = item.label; + } + }); + data.push(element.dataValues); + }); + return { code: true, data }; + } catch (error) { + const blockName = fileName + "--" + "downloadInterlocutionData"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = InterlocutionService; \ No newline at end of file diff --git a/app/service/Judgment.js b/app/service/Judgment.js new file mode 100644 index 0000000..a942e7e --- /dev/null +++ b/app/service/Judgment.js @@ -0,0 +1,240 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const moment = require('moment'); + +const fileName = "Judgment"; + +class JudgmentService extends Service { + // 管理系统新增判断题 + async addJudgment(form) { + const { ctx } = this; + try { + const result = await ctx.model2.Judgment.bulkCreate(form, { ignoreDuplicates: true }); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "addJudgment"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统查看判断题 + async showJudgment(uid, body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['stem', 'answer', 'difficulty'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['stem'], + key = ['answer', 'difficulty'], + 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.model2.Judgment.findAndCountAll(dbOptions); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showJudgment"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统编辑判断题 + async editJudgment(uid, modelType, updateMsg, requestMsg) { + const { ctx } = this; + try { + const result = await ctx.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.role < 1) return false; + let where = {}; + if (modelType == "single") { + const { stem, answer, difficulty } = requestMsg; + where = { stem, answer, difficulty }; + } else if (modelType == "multiple") { + let stem = [], answer = [], difficulty = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + stem.push(element.stem); + answer.push(element.answer); + difficulty.push(element.difficulty); + }); + } + where = { stem, answer, difficulty }; + } + const resultList = await ctx.model2.Judgment.update(updateMsg, { where }); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + const blockName = fileName + "--" + "editJudgment"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统删除判断题 + async deleteJudgment(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.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 2) { + 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 < 2) systemMonitoring.status = 2; + await ctx.model.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { stem, answer, difficulty } = requestMsg; + where = { stem, answer, difficulty }; + } else if (modelType == "multiple") { + let stem = [], answer = [], difficulty = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + stem.push(element.stem); + answer.push(element.answer); + difficulty.push(element.difficulty); + }); + } + where = { stem, answer, difficulty }; + } + const resultList = await ctx.model2.Judgment.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "deleteJudgment"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统导出判断题数据 + async downloadJudgmentData(uid, searchMsg) { + const { ctx } = this; + try { + const user = await ctx.model.Manager.findOne({ where: { uid } }); + if (!user || user.dataValues.role < 1) return { code: false }; + let { searchOptions, sortOptions } = searchMsg; + let attributes = ['stem', 'answer', 'difficulty'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['stem', 'answer', 'difficulty'], + key = [], + 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, where, order }; + const result = await ctx.model2.Judgment.findAll(dbOptions); + if (result.length == 0) return { code: false }; + let data = []; + const answerOptions = [ + { + value: "0", + label: "错误" + }, + { + value: "1", + label: "正确" + }, + ]; + const difficultyOptions = [ + { + value: "0", + label: "简单" + }, + { + value: "1", + label: "普通" + }, + { + value: "2", + label: "困难" + }, + ]; + result.forEach(element => { + answerOptions.forEach((item) => { + if (item.value == element.dataValues["answer"]) { + element.dataValues["answer"] = item.label; + } + }); + difficultyOptions.forEach((item) => { + if (item.value == element.dataValues["difficulty"]) { + element.dataValues["difficulty"] = item.label; + } + }); + data.push(element.dataValues); + }); + return { code: true, data }; + } catch (error) { + const blockName = fileName + "--" + "downloadJudgmentData"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = JudgmentService; \ No newline at end of file diff --git a/app/service/Monitoring.js b/app/service/Monitoring.js new file mode 100644 index 0000000..d2f2c9f --- /dev/null +++ b/app/service/Monitoring.js @@ -0,0 +1,136 @@ +'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 manager = await ctx.model.Manager.findAll({ attributes: ['uid', 'account_name', 'role'] }); + if (searchOptions.account_name) { + if (searchOptions.account_name == '*空') { + where.user = [null, '']; + } else { + let uidArr = []; + manager.filter(item => { + if (item.dataValues.account_name.includes(searchOptions.account_name)) { + uidArr.push(item.dataValues.uid); + } + }); + where.user = [...uidArr]; + } + } + if (searchOptions.role) { + let uidArr = []; + manager.filter(item => { + if (item.dataValues.role == searchOptions.role) { + uidArr.push(item.dataValues.uid); + } + }); + where.user = [...uidArr]; + } + dbOptions = { attributes, offset, limit, where, order }; + const result = await ctx.model.Monitoring.findAndCountAll(dbOptions); + result.rows.forEach(element => { + element.dataValues.account_name = ''; + element.dataValues.role = ''; + manager.filter(item => { + if (item.dataValues.uid == element.dataValues.user) { + element.dataValues.account_name = item.dataValues.account_name; + element.dataValues.role = item.dataValues.role; + } + }); + }); + 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.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 2) { + 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 < 2) systemMonitoring.status = 2; + await ctx.model.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.model.Monitoring.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model.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/Multiple.js b/app/service/Multiple.js new file mode 100644 index 0000000..8cfd82b --- /dev/null +++ b/app/service/Multiple.js @@ -0,0 +1,235 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const moment = require('moment'); + +const fileName = "Multiple"; + +class MultipleService extends Service { + // 管理系统新增多选题 + async addMultiple(form) { + const { ctx } = this; + try { + const result = await ctx.model2.Multiple.bulkCreate(form, { ignoreDuplicates: true }); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "addMultiple"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统查看多选题 + async showMultiple(uid, body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['stem', 'options_a', 'options_b', 'options_c', 'options_d', 'options_e', 'answer', 'difficulty'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['stem', 'options_a', 'options_b', 'options_c', 'options_d', 'options_e', 'answer'], + key = ['difficulty'], + 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.model2.Multiple.findAndCountAll(dbOptions); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showMultiple"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统编辑多选题 + async editMultiple(uid, modelType, updateMsg, requestMsg) { + const { ctx } = this; + try { + const result = await ctx.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.role < 1) return false; + let where = {}; + if (modelType == "single") { + const { stem, options_a, options_b, options_c, options_d, options_e, answer, difficulty } = requestMsg; + where = { stem, options_a, options_b, options_c, options_d, options_e, answer, difficulty }; + } else if (modelType == "multiple") { + let stem = [], options_a = [], options_b = [], options_c = [], options_d = [], options_e = [], answer = [], difficulty = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + stem.push(element.stem); + options_a.push(element.options_a); + options_b.push(element.options_b); + options_c.push(element.options_c); + options_d.push(element.options_d); + options_e.push(element.options_e); + answer.push(element.answer); + difficulty.push(element.difficulty); + }); + } + where = { stem, options_a, options_b, options_c, options_d, options_e, answer, difficulty }; + } + const resultList = await ctx.model2.Multiple.update(updateMsg, { where }); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + const blockName = fileName + "--" + "editMultiple"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统删除多选题 + async deleteMultiple(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.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 2) { + 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 < 2) systemMonitoring.status = 2; + await ctx.model.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { stem, options_a, options_b, options_c, options_d, options_e, answer, difficulty } = requestMsg; + where = { stem, options_a, options_b, options_c, options_d, options_e, answer, difficulty }; + } else if (modelType == "multiple") { + let stem = [], options_a = [], options_b = [], options_c = [], options_d = [], options_e = [], answer = [], difficulty = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + stem.push(element.stem); + options_a.push(element.options_a); + options_b.push(element.options_b); + options_c.push(element.options_c); + options_d.push(element.options_d); + options_e.push(element.options_e); + answer.push(element.answer); + difficulty.push(element.difficulty); + }); + } + where = { stem, options_a, options_b, options_c, options_d, options_e, answer, difficulty }; + } + const resultList = await ctx.model2.Multiple.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "deleteMultiple"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统导出多选题数据 + async downloadMultipleData(uid, searchMsg) { + const { ctx } = this; + try { + const user = await ctx.model.Manager.findOne({ where: { uid } }); + if (!user || user.dataValues.role < 1) return { code: false }; + let { searchOptions, sortOptions } = searchMsg; + let attributes = ['stem', 'options_a', 'options_b', 'options_c', 'options_d', 'options_e', 'answer', 'difficulty'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['stem', 'options_a', 'options_b', 'options_c', 'options_d', 'options_e', 'answer', 'difficulty'], + key = [], + 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, where, order }; + const result = await ctx.model2.Multiple.findAll(dbOptions); + if (result.length == 0) return { code: false }; + let data = []; + const difficultyOptions = [ + { + value: "0", + label: "简单" + }, + { + value: "1", + label: "普通" + }, + { + value: "2", + label: "困难" + }, + ]; + result.forEach(element => { + difficultyOptions.forEach((item) => { + if (item.value == element.dataValues["difficulty"]) { + element.dataValues["difficulty"] = item.label; + } + }); + data.push(element.dataValues); + }); + return { code: true, data }; + } catch (error) { + const blockName = fileName + "--" + "downloadMultipleData"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = MultipleService; \ No newline at end of file diff --git a/app/service/Radio.js b/app/service/Radio.js new file mode 100644 index 0000000..1d034aa --- /dev/null +++ b/app/service/Radio.js @@ -0,0 +1,233 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const moment = require('moment'); + +const fileName = "Radio"; + +class RadioService extends Service { + // 管理系统新增单选题 + async addRadio(form) { + const { ctx } = this; + try { + const result = await ctx.model2.Radio.bulkCreate(form, { ignoreDuplicates: true }); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "addRadio"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统查看单选题 + async showRadio(uid, body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['stem', 'options_a', 'options_b', 'options_c', 'options_d', 'answer', 'difficulty'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['stem', 'options_a', 'options_b', 'options_c', 'options_d', 'answer'], + key = ['difficulty'], + 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.model2.Radio.findAndCountAll(dbOptions); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showRadio"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统编辑单选题 + async editRadio(uid, modelType, updateMsg, requestMsg) { + const { ctx } = this; + try { + const result = await ctx.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.role < 1) return false; + let where = {}; + if (modelType == "single") { + const { stem, options_a, options_b, options_c, options_d, answer, difficulty } = requestMsg; + where = { stem, options_a, options_b, options_c, options_d, answer, difficulty }; + } else if (modelType == "multiple") { + let stem = [], options_a = [], options_b = [], options_c = [], options_d = [], answer = [], difficulty = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + stem.push(element.stem); + 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); + difficulty.push(element.difficulty); + }); + } + where = { stem, options_a, options_b, options_c, options_d, answer, difficulty }; + } + const resultList = await ctx.model2.Radio.update(updateMsg, { where }); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + const blockName = fileName + "--" + "editRadio"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统删除单选题 + async deleteRadio(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.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 2) { + 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 < 2) systemMonitoring.status = 2; + await ctx.model.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { stem, options_a, options_b, options_c, options_d, answer, difficulty } = requestMsg; + where = { stem, options_a, options_b, options_c, options_d, answer, difficulty }; + } else if (modelType == "multiple") { + let stem = [], options_a = [], options_b = [], options_c = [], options_d = [], answer = [], difficulty = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + stem.push(element.stem); + 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); + difficulty.push(element.difficulty); + }); + } + where = { stem, options_a, options_b, options_c, options_d, answer, difficulty }; + } + const resultList = await ctx.model2.Radio.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "deleteRadio"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统导出单选题数据 + async downloadRadioData(uid, searchMsg) { + const { ctx } = this; + try { + const user = await ctx.model.Manager.findOne({ where: { uid } }); + if (!user || user.dataValues.role < 1) return { code: false }; + let { searchOptions, sortOptions } = searchMsg; + let attributes = ['stem', 'options_a', 'options_b', 'options_c', 'options_d', 'answer', 'difficulty'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['stem', 'options_a', 'options_b', 'options_c', 'options_d', 'answer', 'difficulty'], + key = [], + 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, where, order }; + const result = await ctx.model2.Radio.findAll(dbOptions); + if (result.length == 0) return { code: false }; + let data = []; + const difficultyOptions = [ + { + value: "0", + label: "简单" + }, + { + value: "1", + label: "普通" + }, + { + value: "2", + label: "困难" + }, + ]; + result.forEach(element => { + difficultyOptions.forEach((item) => { + if (item.value == element.dataValues["difficulty"]) { + element.dataValues["difficulty"] = item.label; + } + }); + data.push(element.dataValues); + }); + return { code: true, data }; + } catch (error) { + const blockName = fileName + "--" + "downloadRadioData"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = RadioService; \ No newline at end of file diff --git a/app/service/Search.js b/app/service/Search.js new file mode 100644 index 0000000..9b55b70 --- /dev/null +++ b/app/service/Search.js @@ -0,0 +1,131 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const fs = require('fs'); +const path = require('path'); + +const fileName = "Search"; + +class SearchService extends Service { + // 管理系统检索考生姓名 + async searchUserName(uid, body) { + const { ctx } = this; + try { + const result = await ctx.model.Examinee.findAll({ where: { user_name: { [Op.substring]: body.user_name } } }); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "searchUserName"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统检索考生身份证号 + async searchIdentityCard(uid, body) { + const { ctx } = this; + try { + const result = await ctx.model.Examinee.findAll({ where: { identity_card: { [Op.substring]: body.identity_card } } }); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "searchIdentityCard"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统检索考生 uid + async searchUserUid(identity_card, user_name) { + const { ctx } = this; + try { + let attributes = ['uid'], + where = { identity_card, user_name }, + dbOptions = { attributes, where }; + const result = await ctx.model.Examinee.findOne(dbOptions); + return result || false; + } catch (error) { + const blockName = fileName + "--" + "searchUserUid"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统检索考试 uid + async searchExamUid(uid, body) { + const { ctx } = this; + try { + const result = await ctx.model.Examination.findAll({ where: { uid: { [Op.substring]: body.exam_uid } } }); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "searchExamUid"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统检索工作单位 + async searchWorkplace(uid, body) { + const { ctx } = this; + try { + const result = await ctx.model.Examinee.findAll({ where: { workplace: { [Op.substring]: body.workplace } } }); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "searchWorkplace"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统检索报名结果说明 + async searchResult(uid, body) { + const { ctx } = this; + try { + const result = await ctx.model.Application.findAll({ where: { result: { [Op.substring]: body.result } } }); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "searchResult"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 用户照片是否存在判断 + async checkPhoto(idCardArr) { + const { ctx } = this; + try { + let attributes = ['uid', 'identity_card'], + where = { identity_card: idCardArr }, + dbOptions = { attributes, where }; + const result = await ctx.model.Examinee.findAll(dbOptions); + if (result.length == 0) return false; + let photoUrlArr = []; + result.forEach(element => { + const filePath = path.join(__dirname.replace(/\bbd-training-exam-manager\b/g, "bd-training-exam"), `../public/userPhoto/${element.dataValues.identity_card}.jpg`); + // const filePath = `/disk/a/userPhoto/${element.dataValues.identity_card}.jpg`; + const fileExists = fs.existsSync(filePath); + if (fileExists) { + // 文件存在 + // 本机服务器地址 + // 'http://127.0.0.1:8019' + // 'http://192.168.31.28:8019' + // 公司服务器地址 + // 'http://123.57.205.46:8019' + // 'http://certlogin.hwasmart.com//bdTrainingExam' + photoUrlArr.push({ identity_card: element.dataValues.identity_card, photoUrl: 'http://127.0.0.1:8019' + `/public/userPhoto/${element.dataValues.identity_card}.jpg?time=${new Date().getTime()}` }); + } else { + // 文件不存在 + photoUrlArr.push({ identity_card: element.dataValues.identity_card, photoUrl: '#' }); + } + }); + return photoUrlArr; + } catch (error) { + const blockName = fileName + "--" + "checkPhoto"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = SearchService; \ No newline at end of file diff --git a/app/service/TopicWhitelist.js b/app/service/TopicWhitelist.js new file mode 100644 index 0000000..fcfcb8c --- /dev/null +++ b/app/service/TopicWhitelist.js @@ -0,0 +1,334 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const moment = require('moment'); + +const fileName = "TopicWhitelist"; + +class TopicWhitelistService extends Service { + // 管理系统新增题库白名单 + async addTopicWhitelist(userMsgObj, form) { + const { ctx } = this; + try { + let attributes = ['uid', 'phone'], + where = userMsgObj, + dbOptions = { attributes, where }; + const userUid = await ctx.model.Examinee.findAll(dbOptions); + form.forEach(async item => { + item.user_uid = 'none'; + userUid.forEach(element => { + if (item.phone == element.dataValues.phone) { + item.user_uid = element.dataValues.uid; + } + }); + delete item.phone; + }); + const result = await ctx.model.Whitelist.bulkCreate(form, { ignoreDuplicates: true }); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "addTopicWhitelist"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统查看题库白名单 + async showTopicWhitelist(uid, body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['user_uid', 'type', 'expired_at'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['user_uid', 'user_name', 'identity_card'], + key = ['type'], + between = ['expired_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']); + } + }); + + let examinee = ['user_name', 'identity_card'], + examineeWhere = {}, + examineeOrder = [], + examineeJoinSubstring = [], + examineeSubstring = ['user_name', 'identity_card'], + examineeKey = [], + examineeBetween = []; + + examinee.forEach(item => { + if (searchOptions[item]) { + if (searchOptions[item] == '*空') { + if (examineeJoinSubstring.includes(item)) { + examineeWhere[item] = null; + } else { + examineeWhere[item] = [null, '']; + } + } else if (examineeSubstring.includes(item)) { + examineeWhere[item] = { [Op.substring]: searchOptions[item] }; + } else if (examineeKey.includes(item)) { + examineeWhere[item] = searchOptions[item]; + } else if (examineeBetween.includes(item)) { + examineeWhere[item] = { [Op.between]: [searchOptions[item][0], searchOptions[item][1]] }; + } + } + if (sortOptions[item] == true) { + examineeOrder.push([item, 'ASC']); + } else if (sortOptions[item] == false) { + examineeOrder.push([item, 'DESC']); + } + }); + let include = [ + { + model: ctx.model.Examinee, + attributes: ['user_name', 'identity_card'], + where: examineeWhere, + order: examineeOrder + } + ]; + ctx.model.Whitelist.belongsTo(ctx.model.Examinee, { foreignKey: 'user_uid', targetKey: 'uid' }); + dbOptions = { attributes, offset, limit, where, order, include }; + const result = await ctx.model.Whitelist.findAndCountAll(dbOptions); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showTopicWhitelist"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统编辑题库白名单 + async editTopicWhitelist(uid, modelType, updateMsg, requestMsg) { + const { ctx } = this; + try { + const result = await ctx.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.role < 1) return false; + let where = {}; + if (modelType == "single") { + const { user_uid, type, expired_at } = requestMsg; + where = { user_uid, type, expired_at }; + } else if (modelType == "multiple") { + let user_uid = [], type = [], expired_at = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + user_uid.push(element.user_uid); + type.push(element.type); + expired_at.push(element.expired_at); + }); + } + where = { user_uid, type, expired_at }; + } + updateMsg.type = Number(updateMsg.type); + if (updateMsg.expired_at) { + updateMsg.expired_at = new Date(updateMsg.expired_at); + } else { + updateMsg.expired_at = null; + } + const resultList = await ctx.model.Whitelist.update(updateMsg, { where }); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + const blockName = fileName + "--" + "editTopicWhitelist"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统删除题库白名单 + async deleteTopicWhitelist(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.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 2) { + 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 < 2) systemMonitoring.status = 2; + await ctx.model.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { type, expired_at } = requestMsg; + where = { type, expired_at }; + } else if (modelType == "multiple") { + let type = [], expired_at = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + type.push(element.type); + expired_at.push(element.expired_at); + }); + } + where = { type, expired_at }; + } + const resultList = await ctx.model.Whitelist.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "deleteTopicWhitelist"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统导出题库白名单 + async downloadTopicWhitelistData(uid, searchMsg) { + const { ctx } = this; + try { + const user = await ctx.model.Manager.findOne({ where: { uid } }); + if (!user || user.dataValues.role < 1) return false; + let { searchOptions, sortOptions } = searchMsg; + let attributes = ['user_uid', 'type', 'expired_at'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['user_uid'], + key = ['type'], + between = ['expired_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']); + } + }); + + let examinee = ['user_name', 'identity_card'], + examineeWhere = {}, + examineeOrder = [], + examineeJoinSubstring = [], + examineeSubstring = ['user_name', 'identity_card'], + examineeKey = [], + examineeBetween = []; + + examinee.forEach(item => { + if (searchOptions[item]) { + if (searchOptions[item] == '*空') { + if (examineeJoinSubstring.includes(item)) { + examineeWhere[item] = null; + } else { + examineeWhere[item] = [null, '']; + } + } else if (examineeSubstring.includes(item)) { + examineeWhere[item] = { [Op.substring]: searchOptions[item] }; + } else if (examineeKey.includes(item)) { + examineeWhere[item] = searchOptions[item]; + } else if (examineeBetween.includes(item)) { + examineeWhere[item] = { [Op.between]: [searchOptions[item][0], searchOptions[item][1]] }; + } + } + if (sortOptions[item] == true) { + examineeOrder.push([item, 'ASC']); + } else if (sortOptions[item] == false) { + examineeOrder.push([item, 'DESC']); + } + }); + + let include = [ + { + model: ctx.model.Examinee, + attributes: ['user_name', 'identity_card'], + where: examineeWhere, + order: examineeOrder + } + ]; + ctx.model.Whitelist.belongsTo(ctx.model.Examinee, { foreignKey: 'user_uid', targetKey: 'uid' }); + dbOptions = { attributes, where, order, include }; + const result = await ctx.model.Whitelist.findAll(dbOptions); + if (result.length == 0) return { code: false }; + let data = []; + const typeOptions = [ + { + value: "0", + label: "永久白名单" + }, + { + value: "1", + label: "临时白名单" + }, + ]; + result.forEach(element => { + typeOptions.forEach((item) => { + if (item.value == element.dataValues["type"]) { + element.dataValues["type"] = item.label; + } + }); + element.dataValues.user_name = element.dataValues.examinee.dataValues.user_name; + element.dataValues.identity_card = element.dataValues.examinee.dataValues.identity_card; + element.dataValues.expired_at = moment + .utc(element.dataValues.examination.dataValues.expired_at) + .add(8, "hours") + .format("YYYY年MM月DD日HH时mm分ss秒"); + delete element.dataValues.examinee; + let elementClone = { + user_uid: element.dataValues.user_uid, + user_name: element.dataValues.user_name, + identity_card: element.dataValues.identity_card, + type: element.dataValues.type, + expired_at: element.dataValues.expired_at, + } + data.push(elementClone); + }); + return { code: true, data }; + } catch (error) { + const blockName = fileName + "--" + "downloadTopicWhitelistData"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = TopicWhitelistService; \ No newline at end of file diff --git a/app/service/User.js b/app/service/User.js new file mode 100644 index 0000000..290a07a --- /dev/null +++ b/app/service/User.js @@ -0,0 +1,272 @@ +'use strict'; + +const Service = require('../core/base_service'); + +const { Op } = require('sequelize'); + +const moment = require('moment'); + +const fileName = "User"; + +class UserService extends Service { + // 管理系统新增用户账号信息 + async addUser(form) { + const { ctx } = this; + try { + const result = await ctx.model.Examinee.bulkCreate(form, { ignoreDuplicates: true }); + return result.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "addUser"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统查看用户账号信息 + async showUser(uid, body) { + const { ctx } = this; + try { + let { offset, limit, searchOptions, sortOptions } = body; + offset = (offset - 1) * limit; + let attributes = ['uid', 'user_name', 'identity_card', 'real_check', 'workplace', 'address', 'phone', 'email', 'referrers', 'status', 'created_at', 'updated_at', 'login_status'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['uid', 'user_name', 'identity_card', 'workplace', 'address', 'phone', 'email', 'referrers'], + key = ['real_check', 'status', 'login_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 (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.model.Examinee.findAndCountAll(dbOptions); + return result.rows.length == 0 ? false : result; + } catch (error) { + const blockName = fileName + "--" + "showUser"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统编辑用户账号信息 + async editUser(uid, modelType, updateMsg, requestMsg) { + const { ctx } = this; + try { + const result = await ctx.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.role < 1) return false; + let where = {}; + if (modelType == "single") { + const { uid, user_name, identity_card, real_check, workplace, address, phone, email, status } = requestMsg; + where = { uid, user_name, identity_card, real_check, workplace, address, phone, email, status }; + } else if (modelType == "multiple") { + let uid = [], user_name = [], identity_card = [], real_check = [], workplace = [], address = [], phone = [], email = [], status = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + uid.push(element.uid); + user_name.push(element.user_name); + identity_card.push(element.identity_card); + real_check.push(element.real_check); + workplace.push(element.workplace); + address.push(element.address); + phone.push(element.phone); + email.push(element.email); + status.push(element.status); + }); + } + where = { uid, user_name, identity_card, real_check, workplace, address, phone, email, status }; + } + updateMsg.updated_at = new Date(); + const resultList = await ctx.model.Examinee.update(updateMsg, { where }); + return resultList[0] == 0 ? false : resultList; + } catch (error) { + const blockName = fileName + "--" + "editUser"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统删除用户账号信息 + async deleteUser(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.model.Manager.findOne({ where: { uid } }); + if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt)) || result.dataValues.role < 2) { + 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 < 2) systemMonitoring.status = 2; + await ctx.model.Monitoring.create(systemMonitoring); + return false; + }; + let where = {}; + if (modelType == "single") { + const { uid, user_name, identity_card, real_check, workplace, address, phone, email, status } = requestMsg; + where = { uid, user_name, identity_card, real_check, workplace, address, phone, email, status }; + await ctx.model.Audit.destroy({ where : { user_uid: uid } }); + await ctx.model.Application.destroy({ where : { user_uid: uid } }); + await ctx.model.Grades.destroy({ where: { user_uid: uid } }); + } else if (modelType == "multiple") { + let uid = [], user_name = [], identity_card = [], real_check = [], workplace = [], address = [], phone = [], email = [], status = []; + for (const key in requestMsg) { + requestMsg[key].forEach(element => { + uid.push(element.uid); + user_name.push(element.user_name); + identity_card.push(element.identity_card); + real_check.push(element.real_check); + workplace.push(element.workplace); + address.push(element.address); + phone.push(element.phone); + email.push(element.email); + status.push(element.status); + }); + } + where = { uid, user_name, identity_card, real_check, workplace, address, phone, email, status }; + await ctx.model.Audit.destroy({ where : { user_uid: uid } }); + await ctx.model.Application.destroy({ where : { user_uid: uid } }); + await ctx.model.Grades.destroy({ where: { user_uid: uid } }); + } + const resultList = await ctx.model.Examinee.destroy({ where }); + systemMonitoring.status = resultList == 0 ? 3 : 4; + systemMonitoring.affect_entries = resultList; + await ctx.model.Monitoring.create(systemMonitoring); + return resultList == 0 ? false : true; + } catch (error) { + systemMonitoring.status = 5; + await ctx.model.Monitoring.create(systemMonitoring); + const blockName = fileName + "--" + "deleteUser"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } + + // 管理系统导出用户账号信息数据 + async downloadUserData(uid, searchMsg) { + const { ctx } = this; + try { + const user = await ctx.model.Manager.findOne({ where: { uid } }); + if (!user || user.dataValues.role < 1) return false; + let { searchOptions, sortOptions } = searchMsg; + let attributes = ['uid', 'user_name', 'identity_card', 'real_check', 'workplace', 'address', 'phone', 'email', 'status', 'created_at', 'updated_at', 'login_status'], + where = {}, order = [], dbOptions, + joinSubstring = [], + substring = ['uid', 'user_name', 'identity_card', 'workplace', 'address', 'phone', 'email'], + key = ['real_check', 'status', 'login_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 (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, where, order }; + const result = await ctx.model.Examinee.findAll(dbOptions); + if (result.length == 0) return { code: false }; + let data = []; + const realCheckOptions = [ + { + value: "0", + label: "未核验" + }, + { + value: "1", + label: "核验通过" + }, + { + value: "2", + label: "核验失败" + }, + ]; + const statusOptions = [ + { + value: "0", + label: "默认状态" + }, + { + value: "1", + label: "正常使用" + }, + { + value: "2", + label: "已被封禁" + }, + ]; + result.forEach(element => { + realCheckOptions.forEach((item) => { + if (item.value == element.dataValues["real_check"]) { + element.dataValues["real_check"] = item.label; + } + }); + statusOptions.forEach((item) => { + if (item.value == element.dataValues["status"]) { + element.dataValues["status"] = item.label; + } + }); + element.dataValues.created_at = moment + .utc(element.dataValues.created_at) + .add(8, "hours") + .format("YYYY年MM月DD日HH时mm分ss秒"); + element.dataValues.updated_at = moment + .utc(element.dataValues.updated_at) + .add(8, "hours") + .format("YYYY年MM月DD日HH时mm分ss秒"); + delete element.dataValues.login_status; + data.push(element.dataValues); + }); + return { code: true, data }; + } catch (error) { + const blockName = fileName + "--" + "downloadUserData"; + ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error); + return 'error'; + } + } +} + +module.exports = UserService; \ No newline at end of file diff --git a/config/config.default.js b/config/config.default.js new file mode 100644 index 0000000..7015b14 --- /dev/null +++ b/config/config.default.js @@ -0,0 +1,125 @@ +/* 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.static = { + maxAge: 0, + buffer: false, + }; + + config.multipart = { + mode: 'file', // 使用文件模式保存上传的文件 + whitelist: () => true, // 允许所有文件类型上传 + }; + + config.security = { + csrf:{ + enable:false + }, + }; + + config.redis = { + // 开发/测试环境 + clients: { + db3: { + port: 6379, + host: '127.0.0.1', + password: '74191221', + db: 3 + }, + db7: { + port: 6379, + host: '127.0.0.1', + password: '74191221', + db: 7, + } + } + + // 生产环境 + // clients: { + // db3: { + // port: 6379, + // host: '127.0.0.1', + // password: 'bd3@htcc2023', + // db: 5 + // }, + // db7: { + // port: 6379, + // host: '127.0.0.1', + // password: 'bd3@htcc2023', + // db: 9, + // } + // } + }; + + config.sequelize = { + // 开发/测试环境 + datasources: [ + { + dialect: 'mariadb', + host: 'localhost', + port: 3306, + username: 'root', + password: '74191221', + database: 'bdTrainingExam' + }, + { + dialect: 'mariadb', + host: 'localhost', + port: 3306, + username: 'root', + password: '74191221', + database: 'trainingTopic', + delegate: 'model2', + baseDir: 'model2', + }, + ] + + // 生产环境 + // datasources: [ + // { + // dialect: 'mariadb', + // host: 'localhost', + // port: 3306, + // username: 'bdqh_platform', + // password: '124689@XXxx', + // database: 'bdTrainingExam' + // }, + // { + // dialect: 'mariadb', + // host: 'localhost', + // port: 3306, + // username: 'bdqh_platform', + // password: '124689@XXxx', + // database: 'trainingTopic', + // delegate: 'model2', + // baseDir: 'model2', + // } + // ] + }; + + // add your user config here + const userConfig = { + // myAppName: 'egg', + salt:'bdTrainingExam' + }; + + return { + ...config, + ...userConfig, + }; +}; diff --git a/config/plugin.js b/config/plugin.js new file mode 100644 index 0000000..5a65fbe --- /dev/null +++ b/config/plugin.js @@ -0,0 +1,22 @@ +/** @type Egg.EggPlugin */ +module.exports = { + // had enabled by egg + // static: { + // enable: true, + // } + + redis : { + enable: true, + package: 'egg-redis', + }, + + sequelize : { + enable: true, + package: 'egg-sequelize', + }, + + validate : { + enable: true, + package: 'egg-validate', + }, +}; diff --git a/controllerLog/2025/3/26.txt b/controllerLog/2025/3/26.txt new file mode 100644 index 0000000..23cea87 --- /dev/null +++ b/controllerLog/2025/3/26.txt @@ -0,0 +1,10 @@ +[2025-3-26>>>17:2:35]>>>User--downloadUserData>>>>Error: aoa_to_sheet expects an array of arrays +[2025-3-26>>>17:3:45]>>>User--downloadUserData>>>>Error: aoa_to_sheet expects an array of arrays +[2025-3-26>>>17:22:21]>>>User--downloadUserData>>>>Error: aoa_to_sheet expects an array of arrays +[2025-3-26>>>17:23:51]>>>User--downloadUserData>>>>Error: aoa_to_sheet expects an array of arrays +[2025-3-26>>>17:24:26]>>>User--downloadUserData>>>>TypeError: Cannot read properties of undefined (reading 'utils') +[2025-3-26>>>17:45:53]>>>User--downloadUserData>>>>ReferenceError: fs is not defined +[2025-3-26>>>17:56:3]>>>User--downloadUserData>>>>TypeError [ERR_INVALID_ARG_TYPE]: The "list" argument must be an instance of Array. Received an instance of ArrayBuffer +[2025-3-26>>>17:56:53]>>>User--downloadUserData>>>>TypeError [ERR_INVALID_ARG_TYPE]: The "list" argument must be an instance of Array. Received an instance of ArrayBuffer +[2025-3-26>>>17:57:18]>>>User--downloadUserData>>>>TypeError [ERR_INVALID_ARG_TYPE]: The "list" argument must be an instance of Array. Received an instance of ArrayBuffer +[2025-3-26>>>17:59:21]>>>User--downloadUserData>>>>TypeError [ERR_INVALID_ARG_TYPE]: The "list" argument must be an instance of Array. Received an instance of ArrayBuffer diff --git a/controllerLog/2025/3/27.txt b/controllerLog/2025/3/27.txt new file mode 100644 index 0000000..b5e01c1 --- /dev/null +++ b/controllerLog/2025/3/27.txt @@ -0,0 +1,11 @@ +[2025-3-27>>>9:24:18]>>>User--downloadUserData>>>>TypeError [ERR_INVALID_ARG_TYPE]: The "list" argument must be an instance of Array. Received an instance of ArrayBuffer +[2025-3-27>>>9:32:0]>>>User--downloadUserData>>>>TypeError [ERR_INVALID_ARG_TYPE]: The "list" argument must be an instance of Array. Received an instance of ArrayBuffer +[2025-3-27>>>9:32:43]>>>User--downloadUserData>>>>TypeError [ERR_INVALID_ARG_TYPE]: The "list" argument must be an instance of Array. Received an instance of ArrayBuffer +[2025-3-27>>>9:35:58]>>>User--downloadUserData>>>>TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received an instance of ArrayBuffer +[2025-3-27>>>9:37:48]>>>User--downloadUserData>>>>TypeError [ERR_INVALID_ARG_VALUE]: The argument 'path' must be a string or Uint8Array without null bytes. Received >>9:40:29]>>>User--downloadUserData>>>>TypeError [ERR_INVALID_ARG_VALUE]: The argument 'path' must be a string or Uint8Array without null bytes. Received >>10:13:17]>>>User--downloadUserData>>>>TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of ArrayBuffer +[2025-3-27>>>12:51:21]>>>System--downloadFile>>>>TypeError: dest.on is not a function +[2025-3-27>>>12:51:59]>>>System--downloadFile>>>>TypeError: dest.on is not a function +[2025-3-27>>>16:40:44]>>>Grades--showGrades>>>>TypeError: Cannot read properties of undefined (reading 'user_uid') +[2025-3-27>>>16:40:44]>>>Grades--showGrades>>>>TypeError: Cannot read properties of undefined (reading 'user_uid') diff --git a/controllerLog/2025/3/28.txt b/controllerLog/2025/3/28.txt new file mode 100644 index 0000000..2cfe476 --- /dev/null +++ b/controllerLog/2025/3/28.txt @@ -0,0 +1,2 @@ +[2025-3-28>>>14:52:39]>>>Diff--diffEmail>>>>Error: Malformed UTF-8 data +[2025-3-28>>>15:52:17]>>>Search--searchIdentityCard>>>>TypeError: Cannot create property 'code' on boolean 'true' diff --git a/controllerLog/2025/3/31.txt b/controllerLog/2025/3/31.txt new file mode 100644 index 0000000..6dea10b --- /dev/null +++ b/controllerLog/2025/3/31.txt @@ -0,0 +1 @@ +[2025-3-31>>>10:11:47]>>>Grades--addGrades>>>>ReferenceError: unExistMark is not defined diff --git a/controllerLog/2025/4/17.txt b/controllerLog/2025/4/17.txt new file mode 100644 index 0000000..0ae983a --- /dev/null +++ b/controllerLog/2025/4/17.txt @@ -0,0 +1,9 @@ +[2025-4-17>>>17:26:43]>>>Cntev--CNTEV>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2025-4-17>>>17:27:2]>>>Cntev--CNTEV>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2025-4-17>>>17:28:2]>>>Cntev--CNTEV>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2025-4-17>>>17:28:15]>>>Cntev--CNTEV>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2025-4-17>>>17:28:29]>>>Cntev--CNTEV>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2025-4-17>>>17:29:11]>>>Cntev--CNTEV>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2025-4-17>>>17:29:21]>>>Cntev--CNTEV>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2025-4-17>>>17:29:27]>>>Cntev--CNTEV>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2025-4-17>>>17:30:17]>>>Cntev--CNTEV>>>>TypeError: Cannot read properties of undefined (reading 'length') diff --git a/controllerLog/2025/4/21.txt b/controllerLog/2025/4/21.txt new file mode 100644 index 0000000..8c63e2d --- /dev/null +++ b/controllerLog/2025/4/21.txt @@ -0,0 +1,4 @@ +[2025-4-21>>>11:40:22]>>>TopicWhitelist--addTopicWhitelist>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2025-4-21>>>16:30:43]>>>TopicWhitelist--addTopicWhitelist>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2025-4-21>>>16:32:3]>>>TopicWhitelist--addTopicWhitelist>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') +[2025-4-21>>>16:33:4]>>>TopicWhitelist--addTopicWhitelist>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') diff --git a/controllerLog/2025/4/22.txt b/controllerLog/2025/4/22.txt new file mode 100644 index 0000000..909ea8f --- /dev/null +++ b/controllerLog/2025/4/22.txt @@ -0,0 +1 @@ +[2025-4-22>>>10:38:21]>>>Judgment--editJudgment>>>>TypeError: updateMsg.forEach is not a function diff --git a/controllerLog/2025/4/25.txt b/controllerLog/2025/4/25.txt new file mode 100644 index 0000000..35eb850 --- /dev/null +++ b/controllerLog/2025/4/25.txt @@ -0,0 +1,8 @@ +[2025-4-25>>>14:34:13]>>>Download--importUserPhoto>>>>ReferenceError: zipFolder is not defined +[2025-4-25>>>15:5:40]>>>Download--importUserPhoto>>>>TypeError: Cannot read properties of undefined (reading 'then') +[2025-4-25>>>15:16:57]>>>Download--importUserPhoto>>>>TypeError: Cannot read properties of undefined (reading 'then') +[2025-4-25>>>15:20:29]>>>Download--importUserPhoto>>>>TypeError: Cannot read properties of undefined (reading 'then') +[2025-4-25>>>15:23:48]>>>Download--importUserPhoto>>>>TypeError: Cannot read properties of undefined (reading 'then') +[2025-4-25>>>15:44:57]>>>Download--importUserPhoto>>>>Error: EPERM: operation not permitted, unlink 'D:\bdqh-technology-education-platform\back-end\bd-training-exam-manager\app\public\userPhoto' +[2025-4-25>>>15:48:49]>>>Download--importUserPhoto>>>>Error: ENOTEMPTY: directory not empty, rmdir 'D:\bdqh-technology-education-platform\back-end\bd-training-exam-manager\app\public\userPhoto' +[2025-4-25>>>16:20:58]>>>Download--importUserPhoto>>>>ReferenceError: directoryPath is not defined diff --git a/controllerLog/2025/4/3.txt b/controllerLog/2025/4/3.txt new file mode 100644 index 0000000..953c5d7 --- /dev/null +++ b/controllerLog/2025/4/3.txt @@ -0,0 +1 @@ +[2025-4-3>>>16:31:58]>>>Radio--addRadio>>>>TypeError: ctx.service.admin.addRadio is not a function diff --git a/controllerLog/2025/5/15.txt b/controllerLog/2025/5/15.txt new file mode 100644 index 0000000..939183b --- /dev/null +++ b/controllerLog/2025/5/15.txt @@ -0,0 +1 @@ +[2025-5-15>>>17:50:17]>>>Grades--addGrades>>>>TypeError: Cannot read properties of undefined (reading 'ciphertext') diff --git a/controllerLog/2025/5/16.txt b/controllerLog/2025/5/16.txt new file mode 100644 index 0000000..b53bafa --- /dev/null +++ b/controllerLog/2025/5/16.txt @@ -0,0 +1,6 @@ +[2025-5-16>>>9:55:42]>>>Grades--addGrades>>>>ReferenceError: result is not defined +[2025-5-16>>>9:56:37]>>>Grades--addGrades>>>>ReferenceError: result is not defined +[2025-5-16>>>9:57:3]>>>Grades--addGrades>>>>ReferenceError: result is not defined +[2025-5-16>>>9:57:21]>>>Grades--addGrades>>>>ReferenceError: result is not defined +[2025-5-16>>>9:58:42]>>>Grades--addGrades>>>>ReferenceError: result is not defined +[2025-5-16>>>9:59:53]>>>Grades--addGrades>>>>ReferenceError: result is not defined diff --git a/controllerLog/2025/5/6.txt b/controllerLog/2025/5/6.txt new file mode 100644 index 0000000..cbf7a8d --- /dev/null +++ b/controllerLog/2025/5/6.txt @@ -0,0 +1 @@ +[2025-5-6>>>17:35:12]>>>Download--uploadUserPhoto>>>>TypeError: Cannot read properties of undefined (reading 'forEach') diff --git a/controllerLog/2025/5/7.txt b/controllerLog/2025/5/7.txt new file mode 100644 index 0000000..d454150 --- /dev/null +++ b/controllerLog/2025/5/7.txt @@ -0,0 +1,2 @@ +[2025-5-7>>>10:44:21]>>>Download--uploadUserPhoto>>>>TypeError: Cannot read properties of undefined (reading 'forEach') +[2025-5-7>>>12:0:11]>>>Download--uploadUserPhoto>>>>TypeError: ctx.request.getParameter is not a function 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/npminstall-debug.log b/npminstall-debug.log new file mode 100644 index 0000000..34e03f8 --- /dev/null +++ b/npminstall-debug.log @@ -0,0 +1,210 @@ +{ + root: 'D:\\bdqh-technology-education-platform\\back-end\\bd-training-exam-manager', + registry: 'https://registry.npmmirror.com/', + pkgs: [ + { + name: '@fs-extra/walk', + version: 'latest', + type: 'tag', + alias: undefined, + arg: [Result] + } + ], + production: false, + cacheStrict: false, + cacheDir: 'C:\\Users\\23577\\.npminstall_tarball', + env: { + npm_config_registry: 'https://registry.npmmirror.com/', + npm_config_argv: '{"remain":[],"cooked":["--fix-bug-versions","--china","--userconfig=C:\\\\Users\\\\23577\\\\.cnpmrc","--disturl=https://cdn.npmmirror.com/binaries/node","--registry=https://registry.npmmirror.com/","@fs-extra/walk"],"original":["--fix-bug-versions","--china","--userconfig=C:\\\\Users\\\\23577\\\\.cnpmrc","--disturl=https://cdn.npmmirror.com/binaries/node","--registry=https://registry.npmmirror.com/","@fs-extra/walk"]}', + npm_config_user_agent: 'npminstall/7.11.1 npm/? node/v18.19.1 win32 x64', + npm_config_cache: 'C:\\Users\\23577\\.npminstall_tarball', + NODE: 'D:\\nvm\\nodejs\\node.exe', + npm_node_execpath: 'D:\\nvm\\nodejs\\node.exe', + npm_execpath: 'D:\\nvm\\npm\\node_modules\\cnpm\\node_modules\\npminstall\\bin\\install.js', + npm_config_userconfig: 'C:\\Users\\23577\\.cnpmrc', + npm_config_disturl: 'https://cdn.npmmirror.com/binaries/node', + npm_config_r: 'https://registry.npmmirror.com/', + COREPACK_NPM_REGISTRY: 'https://registry.npmmirror.com', + EDGEDRIVER_CDNURL: 'https://npmmirror.com/mirrors/edgedriver', + NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node', + NVM_NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node', + PHANTOMJS_CDNURL: 'https://cdn.npmmirror.com/binaries/phantomjs', + CHROMEDRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/chromedriver', + OPERADRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/operadriver', + CYPRESS_DOWNLOAD_PATH_TEMPLATE: 'https://cdn.npmmirror.com/binaries/cypress/${version}/${platform}-${arch}/cypress.zip', + ELECTRON_MIRROR: 'https://cdn.npmmirror.com/binaries/electron/', + ELECTRON_BUILDER_BINARIES_MIRROR: 'https://cdn.npmmirror.com/binaries/electron-builder-binaries/', + SASS_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-sass', + SWC_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-swc', + NWJS_URLBASE: 'https://cdn.npmmirror.com/binaries/nwjs/v', + PUPPETEER_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/chrome-for-testing', + PUPPETEER_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing', + PLAYWRIGHT_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/playwright', + SENTRYCLI_CDNURL: 'https://cdn.npmmirror.com/binaries/sentry-cli', + SAUCECTL_INSTALL_BINARY_MIRROR: 'https://cdn.npmmirror.com/binaries/saucectl', + RE2_DOWNLOAD_MIRROR: 'https://cdn.npmmirror.com/binaries/node-re2', + RE2_DOWNLOAD_SKIP_PATH: 'true', + PRISMA_ENGINES_MIRROR: 'https://cdn.npmmirror.com/binaries/prisma', + npm_config_better_sqlite3_binary_host: 'https://cdn.npmmirror.com/binaries/better-sqlite3', + npm_config_keytar_binary_host: 'https://cdn.npmmirror.com/binaries/keytar', + npm_config_sharp_binary_host: 'https://cdn.npmmirror.com/binaries/sharp', + npm_config_sharp_libvips_binary_host: 'https://cdn.npmmirror.com/binaries/sharp-libvips', + npm_config_robotjs_binary_host: 'https://cdn.npmmirror.com/binaries/robotjs', + npm_config_gl_binary_host: 'https://cdn.npmmirror.com/binaries/gl', + npm_rootpath: 'D:\\bdqh-technology-education-platform\\back-end\\bd-training-exam-manager', + INIT_CWD: 'D:\\bdqh-technology-education-platform\\back-end\\bd-training-exam-manager' + }, + binaryMirrors: { + ENVS: { + COREPACK_NPM_REGISTRY: 'https://registry.npmmirror.com', + EDGEDRIVER_CDNURL: 'https://npmmirror.com/mirrors/edgedriver', + NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node', + NVM_NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node', + PHANTOMJS_CDNURL: 'https://cdn.npmmirror.com/binaries/phantomjs', + CHROMEDRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/chromedriver', + OPERADRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/operadriver', + CYPRESS_DOWNLOAD_PATH_TEMPLATE: 'https://cdn.npmmirror.com/binaries/cypress/${version}/${platform}-${arch}/cypress.zip', + ELECTRON_MIRROR: 'https://cdn.npmmirror.com/binaries/electron/', + ELECTRON_BUILDER_BINARIES_MIRROR: 'https://cdn.npmmirror.com/binaries/electron-builder-binaries/', + SASS_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-sass', + SWC_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-swc', + NWJS_URLBASE: 'https://cdn.npmmirror.com/binaries/nwjs/v', + PUPPETEER_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/chrome-for-testing', + PUPPETEER_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing', + PLAYWRIGHT_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/playwright', + SENTRYCLI_CDNURL: 'https://cdn.npmmirror.com/binaries/sentry-cli', + SAUCECTL_INSTALL_BINARY_MIRROR: 'https://cdn.npmmirror.com/binaries/saucectl', + RE2_DOWNLOAD_MIRROR: 'https://cdn.npmmirror.com/binaries/node-re2', + RE2_DOWNLOAD_SKIP_PATH: 'true', + PRISMA_ENGINES_MIRROR: 'https://cdn.npmmirror.com/binaries/prisma', + npm_config_better_sqlite3_binary_host: 'https://cdn.npmmirror.com/binaries/better-sqlite3', + npm_config_keytar_binary_host: 'https://cdn.npmmirror.com/binaries/keytar', + npm_config_sharp_binary_host: 'https://cdn.npmmirror.com/binaries/sharp', + npm_config_sharp_libvips_binary_host: 'https://cdn.npmmirror.com/binaries/sharp-libvips', + npm_config_robotjs_binary_host: 'https://cdn.npmmirror.com/binaries/robotjs', + npm_config_gl_binary_host: 'https://cdn.npmmirror.com/binaries/gl' + }, + '@ali/s2': { host: 'https://cdn.npmmirror.com/binaries/looksgood-s2' }, + sharp: { replaceHostFiles: [Array], replaceHostMap: [Object] }, + '@tensorflow/tfjs-node': { + replaceHostFiles: [Array], + replaceHostRegExpMap: [Object], + replaceHostMap: [Object] + }, + cypress: { + host: 'https://cdn.npmmirror.com/binaries/cypress', + newPlatforms: [Object] + }, + 'utf-8-validate': { + host: 'https://cdn.npmmirror.com/binaries/utf-8-validate/v{version}' + }, + xprofiler: { + remote_path: './xprofiler/v{version}/', + host: 'https://cdn.npmmirror.com/binaries' + }, + leveldown: { host: 'https://cdn.npmmirror.com/binaries/leveldown/v{version}' }, + couchbase: { host: 'https://cdn.npmmirror.com/binaries/couchbase/v{version}' }, + gl: { host: 'https://cdn.npmmirror.com/binaries/gl/v{version}' }, + sqlite3: { + host: 'https://cdn.npmmirror.com/binaries/sqlite3', + remote_path: 'v{version}' + }, + '@journeyapps/sqlcipher': { host: 'https://cdn.npmmirror.com/binaries' }, + grpc: { + host: 'https://cdn.npmmirror.com/binaries', + remote_path: '{name}/v{version}' + }, + 'grpc-tools': { host: 'https://cdn.npmmirror.com/binaries' }, + wrtc: { + host: 'https://cdn.npmmirror.com/binaries', + remote_path: '{name}/v{version}' + }, + fsevents: { host: 'https://cdn.npmmirror.com/binaries/fsevents' }, + nodejieba: { host: 'https://cdn.npmmirror.com/binaries/nodejieba' }, + canvas: { + host: 'https://cdn.npmmirror.com/binaries/canvas', + remote_path: 'v{version}' + }, + 'skia-canvas': { host: 'https://cdn.npmmirror.com/binaries/skia-canvas' }, + 'flow-bin': { + replaceHost: 'https://github.com/facebook/flow/releases/download/v', + host: 'https://cdn.npmmirror.com/binaries/flow/v' + }, + 'jpegtran-bin': { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/jpegtran-bin' + }, + 'cwebp-bin': { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/cwebp-bin' + }, + 'zopflipng-bin': { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/zopflipng-bin' + }, + 'optipng-bin': { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/optipng-bin' + }, + mozjpeg: { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/mozjpeg-bin' + }, + gifsicle: { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/gifsicle-bin' + }, + 'pngquant-bin': { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/pngquant-bin', + replaceHostMap: [Object] + }, + 'pngcrush-bin': { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/pngcrush-bin' + }, + 'jpeg-recompress-bin': { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/jpeg-recompress-bin' + }, + 'advpng-bin': { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/advpng-bin' + }, + 'pngout-bin': { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/pngout-bin' + }, + 'jpegoptim-bin': { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/jpegoptim-bin' + }, + argon2: { host: 'https://cdn.npmmirror.com/binaries/argon2' }, + 'ali-zeromq': { host: 'https://cdn.npmmirror.com/binaries/ali-zeromq' }, + 'ali-usb_ctl': { host: 'https://cdn.npmmirror.com/binaries/ali-usb_ctl' }, + 'gdal-async': { host: 'https://cdn.npmmirror.com/binaries/node-gdal-async' }, + 'libpg-query': { host: 'https://cdn.npmmirror.com/binaries' } + }, + forbiddenLicenses: null, + flatten: false, + proxy: undefined, + prune: false, + disableFallbackStore: false, + workspacesMap: Map(0) {}, + enableWorkspace: false, + workspaceRoot: 'D:\\bdqh-technology-education-platform\\back-end\\bd-training-exam-manager', + isWorkspaceRoot: true, + isWorkspacePackage: false, + offline: false, + strictSSL: false, + ignoreScripts: false, + foregroundScripts: false, + ignoreOptionalDependencies: false, + detail: false, + forceLinkLatest: false, + trace: false, + engineStrict: false, + registryOnly: false, + client: false, + autoFixVersion: [Function: autoFixVersion] +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..f886163 --- /dev/null +++ b/package.json @@ -0,0 +1,52 @@ +{ + "name": "bd-training-exam-manager", + "version": "1.0.0", + "description": "", + "private": true, + "egg": { + "declarations": true + }, + "dependencies": { + "archiver": "^7.0.1", + "bd-training-exam-manager": "file:", + "crypto-js": "^4.2.0", + "egg": "^3.17.5", + "egg-multipart": "^3.5.0", + "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", + "moment": "^2.30.1", + "mysql2": "^3.9.7", + "sequelize": "^6.37.3", + "xlsx": "^0.18.5" + }, + "devDependencies": { + "egg-bin": "6", + "egg-mock": "5", + "eslint": "8", + "eslint-config-egg": "13", + "sequelize-cli": "^6.6.2" + }, + "engines": { + "node": ">=16.0.0" + }, + "scripts": { + "start": "egg-scripts start --daemon --port=8020 --title=egg-server-bd-training-exam-manager", + "stop": "egg-scripts stop --title=egg-server-bd-training-exam-manager", + "dev": "egg-bin dev --port=8020", + "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/2025/3/25.txt b/serviceLog/2025/3/25.txt new file mode 100644 index 0000000..845b48e --- /dev/null +++ b/serviceLog/2025/3/25.txt @@ -0,0 +1,71 @@ +[2025-3-25>>>13:45:16]>>>User--showUser>>>>SequelizeDatabaseError: (conn:589, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>13:45:16]>>>User--showUser>>>>SequelizeDatabaseError: (conn:590, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>13:45:16]>>>User--showUser>>>>SequelizeDatabaseError: (conn:589, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>13:45:17]>>>User--showUser>>>>SequelizeDatabaseError: (conn:590, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:28:36]>>>User--showUser>>>>SequelizeDatabaseError: (conn:591, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:28:37]>>>User--showUser>>>>SequelizeDatabaseError: (conn:592, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:28:37]>>>User--showUser>>>>SequelizeDatabaseError: (conn:591, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:28:38]>>>User--showUser>>>>SequelizeDatabaseError: (conn:592, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:30:43]>>>User--showUser>>>>SequelizeDatabaseError: (conn:596, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:30:44]>>>User--showUser>>>>SequelizeDatabaseError: (conn:595, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:30:44]>>>User--showUser>>>>SequelizeDatabaseError: (conn:596, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:30:44]>>>User--showUser>>>>SequelizeDatabaseError: (conn:595, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:32:7]>>>User--showUser>>>>SequelizeDatabaseError: (conn:599, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:32:7]>>>User--showUser>>>>SequelizeDatabaseError: (conn:600, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:32:7]>>>User--showUser>>>>SequelizeDatabaseError: (conn:599, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:32:7]>>>User--showUser>>>>SequelizeDatabaseError: (conn:600, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:32:12]>>>User--showUser>>>>SequelizeDatabaseError: (conn:599, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:32:13]>>>User--showUser>>>>SequelizeDatabaseError: (conn:600, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:32:13]>>>User--showUser>>>>SequelizeDatabaseError: (conn:599, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:32:13]>>>User--showUser>>>>SequelizeDatabaseError: (conn:600, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:44:46]>>>User--showUser>>>>SequelizeDatabaseError: (conn:604, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:44:47]>>>User--showUser>>>>SequelizeDatabaseError: (conn:603, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:44:47]>>>User--showUser>>>>SequelizeDatabaseError: (conn:604, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:44:47]>>>User--showUser>>>>SequelizeDatabaseError: (conn:603, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:47:53]>>>User--showUser>>>>SequelizeDatabaseError: (conn:608, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:47:54]>>>User--showUser>>>>SequelizeDatabaseError: (conn:607, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:47:54]>>>User--showUser>>>>SequelizeDatabaseError: (conn:608, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>14:47:55]>>>User--showUser>>>>SequelizeDatabaseError: (conn:607, no: 1054, SQLState: 42S22) Unknown column 'role' in 'field list' +sql: SELECT `status`, `role`, `organization`, `user_name`, `phone`, `msg`, `created_at`, `updated_at`, `login_at`, `login_status` FROM `examinee` AS `examinee` ORDER BY `examinee`.`created_at` DESC, `examinee`.`updated_at` DESC LIMIT 0, 10; - parameters:[] +[2025-3-25>>>16:21:7]>>>Application--showApplication>>>>SequelizeEagerLoadingError: examinee is not associated to application! +[2025-3-25>>>16:21:7]>>>Application--showApplication>>>>SequelizeEagerLoadingError: examinee is not associated to application! +[2025-3-25>>>16:21:7]>>>Application--showApplication>>>>SequelizeEagerLoadingError: examinee is not associated to application! +[2025-3-25>>>16:21:7]>>>Application--showApplication>>>>SequelizeEagerLoadingError: examinee is not associated to application! +[2025-3-25>>>16:21:8]>>>Application--showApplication>>>>SequelizeEagerLoadingError: examinee is not associated to application! +[2025-3-25>>>16:21:30]>>>Application--showApplication>>>>SequelizeEagerLoadingError: examinee is not associated to application! +[2025-3-25>>>16:21:31]>>>Application--showApplication>>>>SequelizeEagerLoadingError: examinee is not associated to application! +[2025-3-25>>>16:21:31]>>>Application--showApplication>>>>SequelizeEagerLoadingError: examinee is not associated to application! +[2025-3-25>>>16:21:31]>>>Application--showApplication>>>>SequelizeEagerLoadingError: examinee is not associated to application! +[2025-3-25>>>16:21:31]>>>Application--showApplication>>>>SequelizeEagerLoadingError: examinee is not associated to application! +[2025-3-25>>>16:21:39]>>>Application--showApplication>>>>SequelizeEagerLoadingError: examinee is not associated to application! +[2025-3-25>>>16:21:40]>>>Application--showApplication>>>>SequelizeEagerLoadingError: examinee is not associated to application! +[2025-3-25>>>16:21:40]>>>Application--showApplication>>>>SequelizeEagerLoadingError: examinee is not associated to application! +[2025-3-25>>>16:21:40]>>>Application--showApplication>>>>SequelizeEagerLoadingError: examinee is not associated to application! +[2025-3-25>>>16:21:40]>>>Application--showApplication>>>>SequelizeEagerLoadingError: examinee is not associated to application! diff --git a/serviceLog/2025/3/26.txt b/serviceLog/2025/3/26.txt new file mode 100644 index 0000000..4a42d9b --- /dev/null +++ b/serviceLog/2025/3/26.txt @@ -0,0 +1 @@ +[2025-3-26>>>17:21:39]>>>User--downloadUserData>>>>TypeError: Cannot read properties of undefined (reading 'utc') diff --git a/serviceLog/2025/3/27.txt b/serviceLog/2025/3/27.txt new file mode 100644 index 0000000..0d58003 --- /dev/null +++ b/serviceLog/2025/3/27.txt @@ -0,0 +1,16 @@ +[2025-3-27>>>16:33:29]>>>Grades--showGrades>>>>TypeError: Cannot read properties of undefined (reading 'user_uid') +[2025-3-27>>>16:33:32]>>>Grades--showGrades>>>>TypeError: Cannot read properties of undefined (reading 'user_uid') +[2025-3-27>>>16:33:32]>>>Grades--showGrades>>>>TypeError: Cannot read properties of undefined (reading 'user_uid') +[2025-3-27>>>16:33:48]>>>Grades--showGrades>>>>TypeError: Cannot read properties of undefined (reading 'user_uid') +[2025-3-27>>>16:33:49]>>>Grades--showGrades>>>>TypeError: Cannot read properties of undefined (reading 'user_uid') +[2025-3-27>>>16:36:53]>>>Grades--showGrades>>>>TypeError: Cannot read properties of undefined (reading 'user_uid') +[2025-3-27>>>16:36:53]>>>Grades--showGrades>>>>TypeError: Cannot read properties of undefined (reading 'user_uid') +[2025-3-27>>>16:38:47]>>>Grades--showGrades>>>>TypeError: Cannot read properties of undefined (reading 'user_uid') +[2025-3-27>>>16:38:47]>>>Grades--showGrades>>>>TypeError: Cannot read properties of undefined (reading 'user_uid') +[2025-3-27>>>16:45:32]>>>Grades--showGrades>>>>TypeError: Cannot read properties of undefined (reading 'user_uid') +[2025-3-27>>>16:45:32]>>>Grades--showGrades>>>>TypeError: Cannot read properties of undefined (reading 'user_uid') +[2025-3-27>>>16:46:16]>>>Grades--showGrades>>>>TypeError: Cannot read properties of undefined (reading 'user_uid') +[2025-3-27>>>16:46:17]>>>Grades--showGrades>>>>TypeError: Cannot read properties of undefined (reading 'user_uid') +[2025-3-27>>>16:48:45]>>>Grades--downloadGradesData>>>>ReferenceError: moment is not defined +[2025-3-27>>>16:51:34]>>>Grades--downloadGradesData>>>>ReferenceError: moment is not defined +[2025-3-27>>>16:53:3]>>>Grades--downloadGradesData>>>>ReferenceError: moment is not defined diff --git a/serviceLog/2025/3/28.txt b/serviceLog/2025/3/28.txt new file mode 100644 index 0000000..2322451 --- /dev/null +++ b/serviceLog/2025/3/28.txt @@ -0,0 +1,157 @@ +[2025-3-28>>>15:10:13]>>>Diff--diffIdentityCard>>>>TypeError: Cannot read properties of null (reading 'dataValues') +[2025-3-28>>>15:10:13]>>>Diff--diffPhone>>>>TypeError: Cannot read properties of null (reading 'dataValues') +[2025-3-28>>>15:10:13]>>>Diff--diffEmail>>>>TypeError: Cannot read properties of null (reading 'dataValues') +[2025-3-28>>>15:14:58]>>>Diff--diffIdentityCard>>>>TypeError: Cannot read properties of null (reading 'dataValues') +[2025-3-28>>>15:14:58]>>>Diff--diffPhone>>>>TypeError: Cannot read properties of null (reading 'dataValues') +[2025-3-28>>>15:14:58]>>>Diff--diffEmail>>>>TypeError: Cannot read properties of null (reading 'dataValues') +[2025-3-28>>>15:17:37]>>>User--deleteUser>>>>SequelizeForeignKeyConstraintError: (conn:430, no: 1451, SQLState: 23000) Cannot delete or update a parent row: a foreign key constraint fails (`bdtrainingexam`.`audit`, CONSTRAINT `FK_audit_examinee` FOREIGN KEY (`user_uid`) REFERENCES `examinee` (`uid`)) +sql: DELETE FROM `examinee` WHERE `real_check` IN (1, 1) AND `status` IN (1, 1) - parameters:[] +[2025-3-28>>>15:18:4]>>>User--deleteUser>>>>SequelizeForeignKeyConstraintError: (conn:438, no: 1451, SQLState: 23000) Cannot delete or update a parent row: a foreign key constraint fails (`bdtrainingexam`.`audit`, CONSTRAINT `FK_audit_examinee` FOREIGN KEY (`user_uid`) REFERENCES `examinee` (`uid`)) +sql: DELETE FROM `examinee` WHERE `real_check` IN (1, 1) AND `status` IN (1, 1) - parameters:[] +[2025-3-28>>>15:54:29]>>>Search--searchExamUid>>>>Error: WHERE parameter "uid" has invalid "undefined" value +[2025-3-28>>>15:54:33]>>>Search--searchExamUid>>>>Error: WHERE parameter "uid" has invalid "undefined" value +[2025-3-28>>>15:54:36]>>>Search--searchExamUid>>>>Error: WHERE parameter "uid" has invalid "undefined" value +[2025-3-28>>>15:54:48]>>>Search--searchExamUid>>>>Error: WHERE parameter "uid" has invalid "undefined" value +[2025-3-28>>>15:55:32]>>>Search--searchExamUid>>>>Error: WHERE parameter "uid" has invalid "undefined" value +[2025-3-28>>>15:56:5]>>>Search--searchExamUid>>>>Error: WHERE parameter "uid" has invalid "undefined" value +[2025-3-28>>>16:41:38]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:519, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>16:41:40]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:519, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>16:41:42]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:519, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>16:41:44]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:519, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>16:41:46]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:519, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>16:41:50]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:519, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>16:41:50]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:519, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>16:41:52]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:519, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>16:42:7]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:519, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>16:42:17]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:519, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>16:55:35]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:569, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>16:55:43]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:569, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>16:55:44]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:569, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>16:55:47]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:569, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>16:55:49]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:569, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>16:55:50]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:569, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>16:55:50]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:569, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>16:55:52]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:569, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>16:57:17]>>>Find--findUserName>>>>Error: Support for `{where: 'raw query'}` has been removed. +[2025-3-28>>>16:57:17]>>>Find--findUserName>>>>Error: Support for `{where: 'raw query'}` has been removed. +[2025-3-28>>>16:57:18]>>>Find--findUserName>>>>Error: Support for `{where: 'raw query'}` has been removed. +[2025-3-28>>>16:57:21]>>>Find--findUserName>>>>Error: Support for `{where: 'raw query'}` has been removed. +[2025-3-28>>>16:57:23]>>>Find--findUserName>>>>Error: Support for `{where: 'raw query'}` has been removed. +[2025-3-28>>>16:57:23]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:571, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>16:57:26]>>>Find--findUserName>>>>Error: Support for `{where: 'raw query'}` has been removed. +[2025-3-28>>>16:57:27]>>>Find--findUserName>>>>Error: Support for `{where: 'raw query'}` has been removed. +[2025-3-28>>>16:57:56]>>>Find--findUserName>>>>Error: Support for `{where: 'raw query'}` has been removed. +[2025-3-28>>>16:57:57]>>>Find--findUserName>>>>Error: Support for `{where: 'raw query'}` has been removed. +[2025-3-28>>>16:58:25]>>>Find--findUserName>>>>Error: Support for `{where: 'raw query'}` has been removed. +[2025-3-28>>>16:59:53]>>>Search--searchUserName>>>>SequelizeDatabaseError: (conn:578, no: 1054, SQLState: 42S22) Unknown column 'gender' in 'field list' +sql: SELECT `id`, `uid`, `salt`, `password`, `identity_card`, `user_name`, `real_check`, `gender`, `age`, `email`, `phone`, `address`, `workplace`, `status`, `created_at`, `updated_at`, `login_status`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FR... - parameters:[] +[2025-3-28>>>16:59:53]>>>Find--findUserName>>>>Error: Support for `{where: 'raw query'}` has been removed. +[2025-3-28>>>16:59:58]>>>Search--searchUserName>>>>SequelizeDatabaseError: (conn:580, no: 1054, SQLState: 42S22) Unknown column 'gender' in 'field list' +sql: SELECT `id`, `uid`, `salt`, `password`, `identity_card`, `user_name`, `real_check`, `gender`, `age`, `email`, `phone`, `address`, `workplace`, `status`, `created_at`, `updated_at`, `login_status`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FR... - parameters:[] +[2025-3-28>>>16:59:58]>>>Find--findUserName>>>>Error: Support for `{where: 'raw query'}` has been removed. +[2025-3-28>>>17:2:34]>>>User--deleteUser>>>>SequelizeForeignKeyConstraintError: (conn:583, no: 1451, SQLState: 23000) Cannot delete or update a parent row: a foreign key constraint fails (`bdtrainingexam`.`audit`, CONSTRAINT `FK_audit_examinee` FOREIGN KEY (`user_uid`) REFERENCES `examinee` (`uid`)) +sql: DELETE FROM `examinee` WHERE `real_check` IN (1, 1) AND `status` IN (1, 1) - parameters:[] +[2025-3-28>>>17:4:14]>>>User--deleteUser>>>>SequelizeForeignKeyConstraintError: (conn:585, no: 1451, SQLState: 23000) Cannot delete or update a parent row: a foreign key constraint fails (`bdtrainingexam`.`audit`, CONSTRAINT `FK_audit_examinee` FOREIGN KEY (`user_uid`) REFERENCES `examinee` (`uid`)) +sql: DELETE FROM `examinee` WHERE `real_check` IN (1, 1) AND `status` IN (1, 1) - parameters:[] +[2025-3-28>>>17:10:59]>>>User--deleteUser>>>>SequelizeForeignKeyConstraintError: (conn:606, no: 1451, SQLState: 23000) Cannot delete or update a parent row: a foreign key constraint fails (`bdtrainingexam`.`application`, CONSTRAINT `FK_application_examinee` FOREIGN KEY (`user_uid`) REFERENCES `examinee` (`uid`)) +sql: DELETE FROM `examinee` WHERE `user_name` = 'test2' AND `identity_card` = '142327200010180622' AND `real_check` = 0 AND `workplace` = '2' AND `address` = '2' AND `phone` = '18428284949' AND `email` = '132465789@qq.com' AND `status` = 0 - parameters:[] +[2025-3-28>>>17:11:59]>>>User--deleteUser>>>>SequelizeForeignKeyConstraintError: (conn:607, no: 1451, SQLState: 23000) Cannot delete or update a parent row: a foreign key constraint fails (`bdtrainingexam`.`application`, CONSTRAINT `FK_application_examinee` FOREIGN KEY (`user_uid`) REFERENCES `examinee` (`uid`)) +sql: DELETE FROM `examinee` WHERE `user_name` = 'test2' AND `identity_card` = '142327200010180622' AND `real_check` = 0 AND `workplace` = '2' AND `address` = '2' AND `phone` = '18428284949' AND `email` = '132465789@qq.com' AND `status` = 0 - parameters:[] +[2025-3-28>>>17:12:54]>>>User--deleteUser>>>>SequelizeForeignKeyConstraintError: (conn:611, no: 1451, SQLState: 23000) Cannot delete or update a parent row: a foreign key constraint fails (`bdtrainingexam`.`application`, CONSTRAINT `FK_application_examinee` FOREIGN KEY (`user_uid`) REFERENCES `examinee` (`uid`)) +sql: DELETE FROM `examinee` WHERE `user_name` = 'test2' AND `identity_card` = '142327200010180622' AND `real_check` = 0 AND `workplace` = '2' AND `address` = '2' AND `phone` = '18428284949' AND `email` = '132465789@qq.com' AND `status` = 0 - parameters:[] +[2025-3-28>>>17:13:15]>>>User--deleteUser>>>>SequelizeForeignKeyConstraintError: (conn:613, no: 1451, SQLState: 23000) Cannot delete or update a parent row: a foreign key constraint fails (`bdtrainingexam`.`application`, CONSTRAINT `FK_application_examinee` FOREIGN KEY (`user_uid`) REFERENCES `examinee` (`uid`)) +sql: DELETE FROM `examinee` WHERE `user_name` = 'test2' AND `identity_card` = '142327200010180622' AND `real_check` = 0 AND `workplace` = '2' AND `address` = '2' AND `phone` = '18428284949' AND `email` = '132465789@qq.com' AND `status` = 0 - parameters:[] +[2025-3-28>>>17:14:43]>>>User--deleteUser>>>>ReferenceError: Cannot access 'uid' before initialization +[2025-3-28>>>17:15:31]>>>Search--searchUserName>>>>SequelizeDatabaseError: (conn:619, no: 1054, SQLState: 42S22) Unknown column 'gender' in 'field list' +sql: SELECT `id`, `uid`, `salt`, `password`, `identity_card`, `user_name`, `real_check`, `gender`, `age`, `email`, `phone`, `address`, `workplace`, `status`, `created_at`, `updated_at`, `login_status`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FR... - parameters:[] +[2025-3-28>>>17:15:33]>>>Search--searchUserName>>>>SequelizeDatabaseError: (conn:619, no: 1054, SQLState: 42S22) Unknown column 'gender' in 'field list' +sql: SELECT `id`, `uid`, `salt`, `password`, `identity_card`, `user_name`, `real_check`, `gender`, `age`, `email`, `phone`, `address`, `workplace`, `status`, `created_at`, `updated_at`, `login_status`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FR... - parameters:[] +[2025-3-28>>>17:15:34]>>>Search--searchUserName>>>>SequelizeDatabaseError: (conn:619, no: 1054, SQLState: 42S22) Unknown column 'gender' in 'field list' +sql: SELECT `id`, `uid`, `salt`, `password`, `identity_card`, `user_name`, `real_check`, `gender`, `age`, `email`, `phone`, `address`, `workplace`, `status`, `created_at`, `updated_at`, `login_status`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FR... - parameters:[] +[2025-3-28>>>17:15:34]>>>Search--searchUserName>>>>SequelizeDatabaseError: (conn:619, no: 1054, SQLState: 42S22) Unknown column 'gender' in 'field list' +sql: SELECT `id`, `uid`, `salt`, `password`, `identity_card`, `user_name`, `real_check`, `gender`, `age`, `email`, `phone`, `address`, `workplace`, `status`, `created_at`, `updated_at`, `login_status`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FR... - parameters:[] +[2025-3-28>>>17:15:35]>>>Search--searchUserName>>>>SequelizeDatabaseError: (conn:619, no: 1054, SQLState: 42S22) Unknown column 'gender' in 'field list' +sql: SELECT `id`, `uid`, `salt`, `password`, `identity_card`, `user_name`, `real_check`, `gender`, `age`, `email`, `phone`, `address`, `workplace`, `status`, `created_at`, `updated_at`, `login_status`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FR... - parameters:[] +[2025-3-28>>>17:15:36]>>>Search--searchUserName>>>>SequelizeDatabaseError: (conn:619, no: 1054, SQLState: 42S22) Unknown column 'gender' in 'field list' +sql: SELECT `id`, `uid`, `salt`, `password`, `identity_card`, `user_name`, `real_check`, `gender`, `age`, `email`, `phone`, `address`, `workplace`, `status`, `created_at`, `updated_at`, `login_status`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FR... - parameters:[] +[2025-3-28>>>17:15:38]>>>Find--findUserName>>>>Error: Support for `{where: 'raw query'}` has been removed. +[2025-3-28>>>17:15:39]>>>Search--searchUserName>>>>SequelizeDatabaseError: (conn:619, no: 1054, SQLState: 42S22) Unknown column 'gender' in 'field list' +sql: SELECT `id`, `uid`, `salt`, `password`, `identity_card`, `user_name`, `real_check`, `gender`, `age`, `email`, `phone`, `address`, `workplace`, `status`, `created_at`, `updated_at`, `login_status`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FR... - parameters:[] +[2025-3-28>>>17:15:41]>>>Search--searchUserName>>>>SequelizeDatabaseError: (conn:619, no: 1054, SQLState: 42S22) Unknown column 'gender' in 'field list' +sql: SELECT `id`, `uid`, `salt`, `password`, `identity_card`, `user_name`, `real_check`, `gender`, `age`, `email`, `phone`, `address`, `workplace`, `status`, `created_at`, `updated_at`, `login_status`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FR... - parameters:[] +[2025-3-28>>>17:17:9]>>>Search--searchUserName>>>>SequelizeDatabaseError: (conn:621, no: 1054, SQLState: 42S22) Unknown column 'gender' in 'field list' +sql: SELECT `id`, `uid`, `salt`, `password`, `identity_card`, `user_name`, `real_check`, `gender`, `age`, `email`, `phone`, `address`, `workplace`, `status`, `created_at`, `updated_at`, `login_status`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FR... - parameters:[] +[2025-3-28>>>17:17:11]>>>Search--searchUserName>>>>SequelizeDatabaseError: (conn:621, no: 1054, SQLState: 42S22) Unknown column 'gender' in 'field list' +sql: SELECT `id`, `uid`, `salt`, `password`, `identity_card`, `user_name`, `real_check`, `gender`, `age`, `email`, `phone`, `address`, `workplace`, `status`, `created_at`, `updated_at`, `login_status`, `created_at` AS `createdAt`, `updated_at` AS `updatedAt` FR... - parameters:[] +[2025-3-28>>>17:17:12]>>>Find--findUserName>>>>Error: Support for `{where: 'raw query'}` has been removed. +[2025-3-28>>>17:19:11]>>>Find--findUserName>>>>Error: Support for `{where: 'raw query'}` has been removed. +[2025-3-28>>>17:19:15]>>>Find--findUserName>>>>Error: Support for `{where: 'raw query'}` has been removed. +[2025-3-28>>>17:19:15]>>>Find--findUserName>>>>Error: Support for `{where: 'raw query'}` has been removed. +[2025-3-28>>>17:19:17]>>>Find--findUserName>>>>Error: Support for `{where: 'raw query'}` has been removed. +[2025-3-28>>>17:19:23]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:656, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>17:19:24]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:656, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>17:19:25]>>>Find--findExamUid>>>>Error: WHERE parameter "uid" has invalid "undefined" value +[2025-3-28>>>17:19:25]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:656, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>17:19:26]>>>Find--findExamUid>>>>Error: WHERE parameter "uid" has invalid "undefined" value +[2025-3-28>>>17:21:22]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:659, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>17:21:23]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:659, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>17:21:26]>>>Find--findExamUid>>>>Error: WHERE parameter "uid" has invalid "undefined" value +[2025-3-28>>>17:21:27]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:659, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>17:21:28]>>>Find--findExamUid>>>>Error: WHERE parameter "uid" has invalid "undefined" value +[2025-3-28>>>17:22:9]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:661, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>17:22:12]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:661, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>17:22:16]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:661, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>17:22:16]>>>Find--findExamUid>>>>Error: WHERE parameter "uid" has invalid "undefined" value +[2025-3-28>>>17:22:18]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:661, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%undefined%'; - parameters:[] +[2025-3-28>>>17:22:19]>>>Find--findExamUid>>>>Error: WHERE parameter "uid" has invalid "undefined" value +[2025-3-28>>>17:22:54]>>>Search--searchExamUid>>>>SequelizeDatabaseError: (conn:664, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%B%'; - parameters:[] +[2025-3-28>>>17:22:55]>>>Find--findExamUid>>>>Error: WHERE parameter "uid" has invalid "undefined" value +[2025-3-28>>>17:22:59]>>>Find--findExamUid>>>>Error: WHERE parameter "uid" has invalid "undefined" value +[2025-3-28>>>17:23:48]>>>Find--findExamUid>>>>Error: WHERE parameter "uid" has invalid "undefined" value +[2025-3-28>>>17:24:9]>>>Find--findExamUid>>>>Error: WHERE parameter "uid" has invalid "undefined" value +[2025-3-28>>>17:24:32]>>>Find--findExamUid>>>>Error: WHERE parameter "uid" has invalid "undefined" value +[2025-3-28>>>17:25:51]>>>Find--findExamUid>>>>Error: WHERE parameter "uid" has invalid "undefined" value +[2025-3-28>>>17:26:24]>>>Find--findExamUid>>>>Error: WHERE parameter "uid" has invalid "undefined" value +[2025-3-28>>>17:27:27]>>>Find--findUserName>>>>Error: Support for `{where: 'raw query'}` has been removed. +[2025-3-28>>>17:27:47]>>>Find--findUserName>>>>Error: Support for `{where: 'raw query'}` has been removed. +[2025-3-28>>>17:27:50]>>>Find--findExamUid>>>>Error: WHERE parameter "uid" has invalid "undefined" value +[2025-3-28>>>17:27:52]>>>Find--findExamUid>>>>Error: WHERE parameter "uid" has invalid "undefined" value +[2025-3-28>>>17:29:25]>>>Find--findUserName>>>>Error: Support for `{where: 'raw query'}` has been removed. +[2025-3-28>>>17:30:49]>>>Find--findExamUid>>>>SequelizeDatabaseError: (conn:687, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` = 'BDA2504261' LIMIT 1; - parameters:[] +[2025-3-28>>>17:30:51]>>>Find--findExamUid>>>>SequelizeDatabaseError: (conn:687, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` = 'BDA2504261' LIMIT 1; - parameters:[] +[2025-3-28>>>17:31:20]>>>Find--findExamUid>>>>SequelizeDatabaseError: (conn:689, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` = 'BDA2504261' LIMIT 1; - parameters:[] +[2025-3-28>>>17:31:58]>>>Find--findExamUid>>>>SequelizeDatabaseError: (conn:694, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` = 'BDA2504261' LIMIT 1; - parameters:[] diff --git a/serviceLog/2025/3/31.txt b/serviceLog/2025/3/31.txt new file mode 100644 index 0000000..dd01489 --- /dev/null +++ b/serviceLog/2025/3/31.txt @@ -0,0 +1,4 @@ +[2025-3-31>>>10:24:20]>>>Application--addApplication>>>>SequelizeDatabaseError: (conn:161, no: 1364, SQLState: HY000) Field 'status' doesn't have a default value +sql: INSERT INTO `importerror` (`id`,`identity_card`,`user_name`,`exam_uid`,`type`,`created_at`) VALUES (NULL,'142327200010180610','屈彪彪0','BDA2504261',0,'2025-03-31 02:24:20.333'),(NULL,'142327200010180611','屈彪彪1','BDA2504271',0,'2025-03-31 02:24:20.333'); - parameters:[] +[2025-3-31>>>10:25:38]>>>Application--addApplication>>>>SequelizeDatabaseError: (conn:164, no: 1364, SQLState: HY000) Field 'status' doesn't have a default value +sql: INSERT INTO `importerror` (`id`,`identity_card`,`user_name`,`exam_uid`,`type`,`created_at`) VALUES (NULL,'142327200010180610','屈彪彪0','BDA2504261',0,'2025-03-31 02:25:38.721'),(NULL,'142327200010180611','屈彪彪1','BDA2504271',0,'2025-03-31 02:25:38.721'); - parameters:[] diff --git a/serviceLog/2025/4/11.txt b/serviceLog/2025/4/11.txt new file mode 100644 index 0000000..2198a3e --- /dev/null +++ b/serviceLog/2025/4/11.txt @@ -0,0 +1,35 @@ +[2025-4-11>>>17:0:4]>>>Importerror--showImporterror>>>>SequelizeDatabaseError: (conn:51, no: 1054, SQLState: 42S22) Unknown column 'exam_name' in 'field list' +sql: SELECT `user_name`, `identity_card`, `exam_uid`, `exam_name`, `type`, `status`, `created_at` FROM `importerror` AS `importerror` ORDER BY `importerror`.`created_at` DESC LIMIT 0, 10; - parameters:[] +[2025-4-11>>>17:0:5]>>>Importerror--showImporterror>>>>SequelizeDatabaseError: (conn:53, no: 1054, SQLState: 42S22) Unknown column 'exam_name' in 'field list' +sql: SELECT `user_name`, `identity_card`, `exam_uid`, `exam_name`, `type`, `status`, `created_at` FROM `importerror` AS `importerror` ORDER BY `importerror`.`created_at` DESC LIMIT 0, 10; - parameters:[] +[2025-4-11>>>17:1:32]>>>Importerror--showImporterror>>>>SequelizeDatabaseError: (conn:60, no: 1054, SQLState: 42S22) Unknown column 'exam_name' in 'field list' +sql: SELECT `user_name`, `identity_card`, `exam_uid`, `exam_name`, `type`, `status`, `created_at` FROM `importerror` AS `importerror` ORDER BY `importerror`.`created_at` DESC LIMIT 0, 10; - parameters:[] +[2025-4-11>>>17:1:32]>>>Importerror--showImporterror>>>>SequelizeDatabaseError: (conn:61, no: 1054, SQLState: 42S22) Unknown column 'exam_name' in 'field list' +sql: SELECT `user_name`, `identity_card`, `exam_uid`, `exam_name`, `type`, `status`, `created_at` FROM `importerror` AS `importerror` ORDER BY `importerror`.`created_at` DESC LIMIT 0, 10; - parameters:[] +[2025-4-11>>>17:3:41]>>>Importerror--showImporterror>>>>SequelizeDatabaseError: (conn:99, no: 1054, SQLState: 42S22) Unknown column 'exam_name' in 'field list' +sql: SELECT `user_name`, `identity_card`, `exam_uid`, `exam_name`, `type`, `status`, `created_at` FROM `importerror` AS `importerror` ORDER BY `importerror`.`created_at` DESC LIMIT 0, 10; - parameters:[] +[2025-4-11>>>17:3:41]>>>Importerror--showImporterror>>>>SequelizeDatabaseError: (conn:98, no: 1054, SQLState: 42S22) Unknown column 'exam_name' in 'field list' +sql: SELECT `user_name`, `identity_card`, `exam_uid`, `exam_name`, `type`, `status`, `created_at` FROM `importerror` AS `importerror` ORDER BY `importerror`.`created_at` DESC LIMIT 0, 10; - parameters:[] +[2025-4-11>>>17:4:26]>>>Importerror--showImporterror>>>>SequelizeDatabaseError: (conn:105, no: 1054, SQLState: 42S22) Unknown column 'exam_name' in 'field list' +sql: SELECT `user_name`, `identity_card`, `exam_uid`, `exam_name`, `type`, `status`, `created_at` FROM `importerror` AS `importerror` ORDER BY `importerror`.`created_at` DESC LIMIT 0, 10; - parameters:[] +[2025-4-11>>>17:4:26]>>>Importerror--showImporterror>>>>SequelizeDatabaseError: (conn:105, no: 1054, SQLState: 42S22) Unknown column 'exam_name' in 'field list' +sql: SELECT `user_name`, `identity_card`, `exam_uid`, `exam_name`, `type`, `status`, `created_at` FROM `importerror` AS `importerror` ORDER BY `importerror`.`created_at` DESC LIMIT 0, 10; - parameters:[] +[2025-4-11>>>17:6:33]>>>Importerror--showImporterror>>>>SequelizeDatabaseError: (conn:109, no: 1054, SQLState: 42S22) Unknown column 'exam_name' in 'field list' +sql: SELECT `user_name`, `identity_card`, `exam_uid`, `exam_name`, `type`, `status`, `created_at` FROM `importerror` AS `importerror` ORDER BY `importerror`.`created_at` DESC LIMIT 0, 10; - parameters:[] +[2025-4-11>>>17:6:33]>>>Importerror--showImporterror>>>>SequelizeDatabaseError: (conn:108, no: 1054, SQLState: 42S22) Unknown column 'exam_name' in 'field list' +sql: SELECT `user_name`, `identity_card`, `exam_uid`, `exam_name`, `type`, `status`, `created_at` FROM `importerror` AS `importerror` ORDER BY `importerror`.`created_at` DESC LIMIT 0, 10; - parameters:[] +[2025-4-11>>>17:10:10]>>>Importerror--showImporterror>>>>SequelizeEagerLoadingError: examination is not associated to importerror! +[2025-4-11>>>17:10:10]>>>Importerror--showImporterror>>>>SequelizeEagerLoadingError: examination is not associated to importerror! +[2025-4-11>>>17:10:11]>>>Importerror--showImporterror>>>>SequelizeEagerLoadingError: examination is not associated to importerror! +[2025-4-11>>>17:10:16]>>>Importerror--showImporterror>>>>SequelizeEagerLoadingError: examination is not associated to importerror! +[2025-4-11>>>17:10:16]>>>Importerror--showImporterror>>>>SequelizeEagerLoadingError: examination is not associated to importerror! +[2025-4-11>>>17:10:17]>>>Importerror--showImporterror>>>>SequelizeEagerLoadingError: examination is not associated to importerror! +[2025-4-11>>>17:11:35]>>>Importerror--showImporterror>>>>SequelizeEagerLoadingError: examination is not associated to importerror! +[2025-4-11>>>17:11:36]>>>Importerror--showImporterror>>>>SequelizeEagerLoadingError: examination is not associated to importerror! +[2025-4-11>>>17:11:36]>>>Importerror--showImporterror>>>>SequelizeEagerLoadingError: examination is not associated to importerror! +[2025-4-11>>>17:11:40]>>>Importerror--showImporterror>>>>SequelizeEagerLoadingError: examination is not associated to importerror! +[2025-4-11>>>17:11:40]>>>Importerror--showImporterror>>>>SequelizeEagerLoadingError: examination is not associated to importerror! +[2025-4-11>>>17:11:41]>>>Importerror--showImporterror>>>>SequelizeEagerLoadingError: examination is not associated to importerror! +[2025-4-11>>>17:12:0]>>>Importerror--showImporterror>>>>SequelizeEagerLoadingError: examination is not associated to importerror! +[2025-4-11>>>17:12:0]>>>Importerror--showImporterror>>>>SequelizeEagerLoadingError: examination is not associated to importerror! +[2025-4-11>>>17:12:0]>>>Importerror--showImporterror>>>>SequelizeEagerLoadingError: examination is not associated to importerror! diff --git a/serviceLog/2025/4/17.txt b/serviceLog/2025/4/17.txt new file mode 100644 index 0000000..461ead5 --- /dev/null +++ b/serviceLog/2025/4/17.txt @@ -0,0 +1,14 @@ +[2025-4-17>>>17:22:35]>>>Cntev--validateList>>>>ReferenceError: dbOptions is not defined +d +[2025-4-17>>>17:23:29]>>>Cntev--siftFailedList>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2025-4-17>>>17:23:29]>>>Cntev--validateList>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2025-4-17>>>17:24:43]>>>Cntev--siftFailedList>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2025-4-17>>>17:24:43]>>>Cntev--validateList>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2025-4-17>>>17:25:6]>>>Cntev--siftFailedList>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2025-4-17>>>17:25:6]>>>Cntev--validateList>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2025-4-17>>>17:25:23]>>>Cntev--siftFailedList>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2025-4-17>>>17:25:23]>>>Cntev--validateList>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2025-4-17>>>17:26:18]>>>Cntev--siftFailedList>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2025-4-17>>>17:26:18]>>>Cntev--validateList>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2025-4-17>>>17:32:58]>>>Cntev--siftFailedList>>>>TypeError: Cannot read properties of undefined (reading 'length') +[2025-4-17>>>17:32:58]>>>Cntev--validateList>>>>TypeError: Cannot read properties of undefined (reading 'length') diff --git a/serviceLog/2025/4/21.txt b/serviceLog/2025/4/21.txt new file mode 100644 index 0000000..49fb75e --- /dev/null +++ b/serviceLog/2025/4/21.txt @@ -0,0 +1,6 @@ +[2025-4-21>>>15:36:47]>>>TopicWhitelist--addTopicWhitelist>>>>SequelizeDatabaseError: (conn:156, no: 1054, SQLState: 42S22) Unknown column 'user_uid' in 'field list' +sql: SELECT `user_uid`, `type`, `expired_at` FROM `examinee` AS `examinee` WHERE `examinee`.`phone` IN ('18435854949'); - parameters:[] +[2025-4-21>>>16:15:35]>>>TopicWhitelist--editTopicWhitelist>>>>SequelizeDatabaseError: (conn:265, no: 1292, SQLState: 22007) Incorrect datetime value: 'Invalid date' for column 'expired_at' at row 1 +sql: UPDATE `whitelist` SET `type`=?,`expired_at`=? WHERE `user_uid` = ? AND `type` = ? AND `expired_at` = ? - parameters:[0,'Invalid date','20250312837014E',1,'2025-04-21 08:15:15.000'] +[2025-4-21>>>16:22:37]>>>TopicWhitelist--editTopicWhitelist>>>>SequelizeDatabaseError: (conn:270, no: 1292, SQLState: 22007) Incorrect datetime value: 'Invalid date' for column 'expired_at' at row 1 +sql: UPDATE `whitelist` SET `type`=?,`expired_at`=? WHERE `user_uid` = ? AND `type` = ? AND `expired_at` = ? - parameters:[0,'Invalid date','20250312837014E',1,'2025-04-21 08:15:15.000'] diff --git a/serviceLog/2025/4/23.txt b/serviceLog/2025/4/23.txt new file mode 100644 index 0000000..d02f87f --- /dev/null +++ b/serviceLog/2025/4/23.txt @@ -0,0 +1,26 @@ +[2025-4-23>>>16:52:34]>>>Search--searchResult>>>>SequelizeDatabaseError: (conn:485, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%%'; - parameters:[] +[2025-4-23>>>16:52:36]>>>Search--searchResult>>>>SequelizeDatabaseError: (conn:485, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%cs%'; - parameters:[] +[2025-4-23>>>16:52:37]>>>Search--searchResult>>>>SequelizeDatabaseError: (conn:485, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%%'; - parameters:[] +[2025-4-23>>>16:52:38]>>>Search--searchResult>>>>SequelizeDatabaseError: (conn:485, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%cs%'; - parameters:[] +[2025-4-23>>>16:52:39]>>>Search--searchResult>>>>SequelizeDatabaseError: (conn:485, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%%'; - parameters:[] +[2025-4-23>>>16:52:41]>>>Search--searchResult>>>>SequelizeDatabaseError: (conn:485, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%测试%'; - parameters:[] +[2025-4-23>>>16:52:55]>>>Search--searchResult>>>>SequelizeDatabaseError: (conn:486, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%%'; - parameters:[] +[2025-4-23>>>16:52:57]>>>Search--searchResult>>>>SequelizeDatabaseError: (conn:486, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%1%'; - parameters:[] +[2025-4-23>>>16:53:1]>>>Download--importXiaoeTech>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2025-4-23>>>16:54:4]>>>Search--searchResult>>>>SequelizeDatabaseError: (conn:489, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%%'; - parameters:[] +[2025-4-23>>>16:54:5]>>>Search--searchResult>>>>SequelizeDatabaseError: (conn:489, no: 1054, SQLState: 42S22) Unknown column 'application.uid' in 'where clause' +sql: SELECT `id`, `user_uid`, `exam_uid`, `source`, `status`, `pay_status`, `result`, `created_at`, `created_at` AS `createdAt` FROM `application` AS `application` WHERE `application`.`uid` LIKE '%1%'; - parameters:[] +[2025-4-23>>>16:54:10]>>>Download--importXiaoeTech>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2025-4-23>>>17:1:55]>>>Download--importXiaoeTech>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2025-4-23>>>17:2:56]>>>Download--importXiaoeTech>>>>TypeError: Cannot read properties of undefined (reading 'examinee') +[2025-4-23>>>17:3:18]>>>Download--importXiaoeTech>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2025-4-23>>>17:4:2]>>>Download--importXiaoeTech>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') diff --git a/serviceLog/2025/4/24.txt b/serviceLog/2025/4/24.txt new file mode 100644 index 0000000..db61df7 --- /dev/null +++ b/serviceLog/2025/4/24.txt @@ -0,0 +1,407 @@ +[2025-4-24>>>16:4:36]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:36]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:36]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:36]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:36]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:36]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:36]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:36]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:36]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:36]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:36]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:46]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:46]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:46]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:46]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:46]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:46]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:46]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:46]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:46]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:46]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:46]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:46]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:46]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:46]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:46]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:46]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:46]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:46]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:46]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:4:46]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:22]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:22]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:22]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:22]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:22]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:22]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:22]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:22]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:22]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:22]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:23]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:23]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:23]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:23]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:23]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:23]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:23]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:23]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:23]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:23]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:30]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:30]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:30]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:30]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:30]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:30]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:30]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:30]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:30]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:5:30]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:15]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:15]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:15]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:15]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:15]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:15]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:15]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:15]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:15]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:15]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:16]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:16]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:16]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:16]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:16]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:16]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:16]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:16]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:16]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:16]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:6:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:33]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:33]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:33]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:33]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:33]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:33]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:33]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:33]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:33]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:33]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:34]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:34]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:34]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:34]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:34]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:34]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:34]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:34]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:34]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:34]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:51]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:51]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:51]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:51]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:51]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:51]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:51]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:51]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:51]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:51]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:51]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:51]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:51]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:51]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:51]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:51]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:51]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:51]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:51]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:7:51]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:8:6]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:8:6]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:8:6]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:8:6]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:8:6]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:8:6]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:8:6]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:8:6]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:8:6]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:8:6]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:8:7]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:8:7]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:8:7]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:8:7]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:8:7]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:8:7]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:8:7]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:8:7]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:8:7]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:8:7]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:0]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:0]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:0]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:0]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:0]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:0]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:0]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:0]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:0]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:0]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:0]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:0]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:0]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:0]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:0]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:0]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:0]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:0]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:0]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:0]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:7]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:7]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:7]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:7]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:7]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:7]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:7]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:7]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:7]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:7]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:8]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:8]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:8]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:8]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:8]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:8]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:8]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:8]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:8]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:8]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:11]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:11]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:11]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:11]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:11]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:11]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:11]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:11]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:11]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:11]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:12]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:12]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:12]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:12]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:12]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:12]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:12]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:12]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:12]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:12]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:30]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:30]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:30]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:30]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:30]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:30]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:30]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:30]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:30]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:30]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:31]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:31]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:31]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:31]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:31]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:31]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:31]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:31]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:31]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:31]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:9:45]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:11:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:11:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:11:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:11:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:11:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:11:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:11:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:11:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:11:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:11:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:11:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:11:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:11:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:11:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:11:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:11:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:11:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:11:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:11:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:11:29]>>>Search--checkPhoto>>>>ReferenceError: path is not defined +[2025-4-24>>>16:12:15]>>>Search--checkPhoto>>>>ReferenceError: uid is not defined +[2025-4-24>>>16:12:15]>>>Search--checkPhoto>>>>ReferenceError: uid is not defined +[2025-4-24>>>16:12:15]>>>Search--checkPhoto>>>>ReferenceError: uid is not defined +[2025-4-24>>>16:12:15]>>>Search--checkPhoto>>>>ReferenceError: uid is not defined +[2025-4-24>>>16:12:15]>>>Search--checkPhoto>>>>ReferenceError: uid is not defined +[2025-4-24>>>16:12:15]>>>Search--checkPhoto>>>>ReferenceError: uid is not defined +[2025-4-24>>>16:12:15]>>>Search--checkPhoto>>>>ReferenceError: uid is not defined +[2025-4-24>>>16:12:15]>>>Search--checkPhoto>>>>ReferenceError: uid is not defined +[2025-4-24>>>16:12:15]>>>Search--checkPhoto>>>>ReferenceError: uid is not defined +[2025-4-24>>>16:12:15]>>>Search--checkPhoto>>>>ReferenceError: uid is not defined +[2025-4-24>>>16:12:16]>>>Search--checkPhoto>>>>ReferenceError: uid is not defined +[2025-4-24>>>16:12:16]>>>Search--checkPhoto>>>>ReferenceError: uid is not defined +[2025-4-24>>>16:12:16]>>>Search--checkPhoto>>>>ReferenceError: uid is not defined +[2025-4-24>>>16:12:16]>>>Search--checkPhoto>>>>ReferenceError: uid is not defined +[2025-4-24>>>16:12:16]>>>Search--checkPhoto>>>>ReferenceError: uid is not defined +[2025-4-24>>>16:12:16]>>>Search--checkPhoto>>>>ReferenceError: uid is not defined +[2025-4-24>>>16:12:16]>>>Search--checkPhoto>>>>ReferenceError: uid is not defined +[2025-4-24>>>16:12:16]>>>Search--checkPhoto>>>>ReferenceError: uid is not defined +[2025-4-24>>>16:12:16]>>>Search--checkPhoto>>>>ReferenceError: uid is not defined +[2025-4-24>>>16:12:16]>>>Search--checkPhoto>>>>ReferenceError: uid is not defined +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:29:31]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:6]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:6]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:6]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:6]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:6]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:6]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:6]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:6]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:6]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:6]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:6]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:6]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:6]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:6]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:6]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:6]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:7]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:7]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:7]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:7]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:7]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:7]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:7]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:7]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:7]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:7]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:7]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:7]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:7]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:7]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:7]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:31:7]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value +[2025-4-24>>>16:32:22]>>>Search--checkPhoto>>>>Error: WHERE parameter "identity_card" has invalid "undefined" value diff --git a/serviceLog/2025/4/25.txt b/serviceLog/2025/4/25.txt new file mode 100644 index 0000000..f4091d1 --- /dev/null +++ b/serviceLog/2025/4/25.txt @@ -0,0 +1 @@ +[2025-4-25>>>16:19:56]>>>Download--importUserPhoto>>>>ReferenceError: path is not defined diff --git a/serviceLog/2025/5/14.txt b/serviceLog/2025/5/14.txt new file mode 100644 index 0000000..7bfbb0c --- /dev/null +++ b/serviceLog/2025/5/14.txt @@ -0,0 +1 @@ +[2025-5-14>>>15:21:3]>>>Download--importGradesData>>>>ReferenceError: searchMsg is not defined diff --git a/serviceLog/2025/5/15.txt b/serviceLog/2025/5/15.txt new file mode 100644 index 0000000..e7c4a28 --- /dev/null +++ b/serviceLog/2025/5/15.txt @@ -0,0 +1,25 @@ +[2025-5-15>>>17:32:55]>>>Download--importGradesData>>>>TypeError: Cannot read properties of undefined (reading 'dataValues') +[2025-5-15>>>17:41:15]>>>Grades--addGrades>>>>SequelizeDatabaseError: (conn:263, no: 1054, SQLState: 42S22) Unknown column 'NaN' in 'field list' +sql: INSERT IGNORE INTO `grades` (`id`,`user_uid`,`exam_uid`,`status`,`grades`,`pass_type`) VALUES (NULL,'20250415024025E','BDA2504262',1,89,1),(NULL,'20250415020025E','BDA2504261',1,103,1),(NULL,'20250415016007E','BDA2504261',1,NaN,0),(NULL,'20250415019073E','... - parameters:[] +[2025-5-15>>>17:47:29]>>>Grades--addGrades>>>>SequelizeDatabaseError: (conn:266, no: 1054, SQLState: 42S22) Unknown column 'NaN' in 'field list' +sql: INSERT IGNORE INTO `grades` (`id`,`user_uid`,`exam_uid`,`status`,`grades`,`pass_type`) VALUES (NULL,'20250415024025E','BDA2504262',1,89,1),(NULL,'20250415020025E','BDA2504261',1,103,1),(NULL,'20250415016007E','BDA2504261',1,NaN,0),(NULL,'20250415019073E','... - parameters:[] +[2025-5-15>>>17:53:16]>>>Grades--addGrades>>>>SequelizeDatabaseError: (conn:284, no: 1054, SQLState: 42S22) Unknown column 'NaN' in 'field list' +sql: INSERT IGNORE INTO `grades` (`id`,`user_uid`,`exam_uid`,`status`,`grades`,`pass_type`) VALUES (NULL,'20250415024025E','BDA2504262',1,89,1),(NULL,'20250415020025E','BDA2504261',1,103,1),(NULL,'20250415016007E','BDA2504261',1,NaN,0),(NULL,'20250415019073E','... - parameters:[] +[2025-5-15>>>17:53:50]>>>Grades--addGrades>>>>SequelizeDatabaseError: (conn:287, no: 1054, SQLState: 42S22) Unknown column 'NaN' in 'field list' +sql: INSERT IGNORE INTO `grades` (`id`,`user_uid`,`exam_uid`,`status`,`grades`,`pass_type`) VALUES (NULL,'20250415024025E','BDA2504262',1,89,1),(NULL,'20250415020025E','BDA2504261',1,103,1),(NULL,'20250415016007E','BDA2504261',1,NaN,0),(NULL,'20250415019073E','... - parameters:[] +[2025-5-15>>>17:55:26]>>>Grades--addGrades>>>>SequelizeDatabaseError: (conn:293, no: 1054, SQLState: 42S22) Unknown column 'NaN' in 'field list' +sql: INSERT IGNORE INTO `grades` (`id`,`user_uid`,`exam_uid`,`status`,`grades`,`pass_type`) VALUES (NULL,'20250415024025E','BDA2504262',1,89,1),(NULL,'20250415020025E','BDA2504261',1,103,1),(NULL,'20250415016007E','BDA2504261',1,NaN,0),(NULL,'20250415019073E','... - parameters:[] +[2025-5-15>>>17:55:49]>>>Grades--addGrades>>>>SequelizeDatabaseError: (conn:297, no: 1054, SQLState: 42S22) Unknown column 'NaN' in 'field list' +sql: INSERT IGNORE INTO `grades` (`id`,`user_uid`,`exam_uid`,`status`,`grades`,`pass_type`) VALUES (NULL,'20250415024025E','BDA2504262',1,89,1),(NULL,'20250415020025E','BDA2504261',1,103,1),(NULL,'20250415016007E','BDA2504261',1,NaN,0),(NULL,'20250415019073E','... - parameters:[] +[2025-5-15>>>17:56:45]>>>Grades--addGrades>>>>SequelizeDatabaseError: (conn:302, no: 1054, SQLState: 42S22) Unknown column 'NaN' in 'field list' +sql: INSERT IGNORE INTO `grades` (`id`,`user_uid`,`exam_uid`,`status`,`grades`,`pass_type`) VALUES (NULL,'20250415024025E','BDA2504262',1,89,1),(NULL,'20250415020025E','BDA2504261',1,103,1),(NULL,'20250415016007E','BDA2504261',1,NaN,0),(NULL,'20250415019073E','... - parameters:[] +[2025-5-15>>>17:57:23]>>>Grades--addGrades>>>>SequelizeDatabaseError: (conn:305, no: 1054, SQLState: 42S22) Unknown column 'NaN' in 'field list' +sql: INSERT IGNORE INTO `grades` (`id`,`user_uid`,`exam_uid`,`status`,`grades`,`pass_type`) VALUES (NULL,'20250415024025E','BDA2504262',1,89,1),(NULL,'20250415020025E','BDA2504261',1,103,1),(NULL,'20250415016007E','BDA2504261',1,NaN,0),(NULL,'20250415019073E','... - parameters:[] +[2025-5-15>>>17:58:0]>>>Grades--addGrades>>>>SequelizeDatabaseError: (conn:310, no: 1054, SQLState: 42S22) Unknown column 'NaN' in 'field list' +sql: INSERT IGNORE INTO `grades` (`id`,`user_uid`,`exam_uid`,`status`,`grades`,`pass_type`) VALUES (NULL,'20250415024025E','BDA2504262',1,89,1),(NULL,'20250415020025E','BDA2504261',1,103,1),(NULL,'20250415016007E','BDA2504261',1,NaN,0),(NULL,'20250415019073E','... - parameters:[] +[2025-5-15>>>17:58:24]>>>Grades--addGrades>>>>SequelizeDatabaseError: (conn:313, no: 1054, SQLState: 42S22) Unknown column 'NaN' in 'field list' +sql: INSERT IGNORE INTO `grades` (`id`,`user_uid`,`exam_uid`,`status`,`grades`,`pass_type`) VALUES (NULL,'20250415024025E','BDA2504262',1,89,1),(NULL,'20250415020025E','BDA2504261',1,103,1),(NULL,'20250415016007E','BDA2504261',1,NaN,0),(NULL,'20250415019073E','... - parameters:[] +[2025-5-15>>>17:58:48]>>>Grades--addGrades>>>>SequelizeDatabaseError: (conn:318, no: 1054, SQLState: 42S22) Unknown column 'NaN' in 'field list' +sql: INSERT IGNORE INTO `grades` (`id`,`user_uid`,`exam_uid`,`status`,`grades`,`pass_type`) VALUES (NULL,'20250415024025E','BDA2504262',1,89,1),(NULL,'20250415020025E','BDA2504261',1,103,1),(NULL,'20250415016007E','BDA2504261',1,NaN,0),(NULL,'20250415019073E','... - parameters:[] +[2025-5-15>>>17:59:8]>>>Grades--addGrades>>>>SequelizeDatabaseError: (conn:322, no: 1054, SQLState: 42S22) Unknown column 'NaN' in 'field list' +sql: INSERT IGNORE INTO `grades` (`id`,`user_uid`,`exam_uid`,`status`,`grades`,`pass_type`) VALUES (NULL,'20250415024025E','BDA2504262',1,89,1),(NULL,'20250415020025E','BDA2504261',1,103,1),(NULL,'20250415016007E','BDA2504261',1,NaN,0),(NULL,'20250415019073E','... - parameters:[] diff --git a/serviceLog/2025/5/16.txt b/serviceLog/2025/5/16.txt new file mode 100644 index 0000000..0de0a88 --- /dev/null +++ b/serviceLog/2025/5/16.txt @@ -0,0 +1,8 @@ +[2025-5-16>>>11:1:29]>>>Grades--editGrades>>>>SequelizeDatabaseError: (conn:153, no: 1366, SQLState: 22007) Incorrect integer value: '正常参加' for column 'status' at row 2 +sql: UPDATE `grades` SET `status`=?,`grades`=?,`pass_type`=? WHERE `user_uid` = ? AND `exam_uid` = ? AND `status` = ? AND `grades` = ? AND `pass_type` = ? - parameters:['正常参加','90','成绩及格','20250415024025E','BDA2504262',1,'89',1] +[2025-5-16>>>11:46:31]>>>Application--editApplication>>>>SequelizeDatabaseError: (conn:243, no: 1366, SQLState: 22007) Incorrect integer value: '取消报名' for column 'status' at row 1 +sql: UPDATE `application` SET `exam_uid`=?,`source`=?,`status`=?,`pay_status`=?,`result`=? WHERE `user_uid` = ? AND `exam_uid` = ? AND `source` = ? AND `status` = ? AND `pay_status` = ? AND `result` = ? - parameters:['BDA2504272','测试','取消报名','未缴费','测试','2025031... +[2025-5-16>>>11:47:6]>>>Application--editApplication>>>>SequelizeDatabaseError: (conn:245, no: 1366, SQLState: 22007) Incorrect integer value: '取消报名' for column 'status' at row 1 +sql: UPDATE `application` SET `exam_uid`=?,`source`=?,`status`=?,`pay_status`=?,`result`=? WHERE `user_uid` = ? AND `exam_uid` = ? AND `source` = ? AND `status` = ? AND `pay_status` = ? AND `result` = ? - parameters:['BDA2504272','测试','取消报名','未缴费','测试','2025031... +[2025-5-16>>>11:48:32]>>>Application--editApplication>>>>SequelizeDatabaseError: (conn:259, no: 1366, SQLState: 22007) Incorrect integer value: '报名成功' for column 'status' at row 1 +sql: UPDATE `application` SET `exam_uid`=?,`source`=?,`status`=?,`pay_status`=?,`result`=? WHERE `user_uid` = ? AND `exam_uid` = ? AND `source` = ? AND `status` = ? AND `pay_status` = ? AND `result` = ? - parameters:['BDA2504272','测试','报名成功','缴费成功','测试','202503... diff --git a/serviceLog/2025/5/28.txt b/serviceLog/2025/5/28.txt new file mode 100644 index 0000000..2bbf6c9 --- /dev/null +++ b/serviceLog/2025/5/28.txt @@ -0,0 +1,2 @@ +[2025-5-28>>>15:39:36]>>>Download--importUserPhoto>>>>ReferenceError: path is not defined +[2025-5-28>>>15:40:56]>>>Download--importUserPhoto>>>>ReferenceError: path is not defined 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); + }); +});