12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103 |
- // ROUTES FOR OUR API
- // =============================================================================
- var express = require('express');
- var md5 = require("./md5.min.js");
- // import md5 from "./md5.min.js"
- var bcrypt = require('bcryptjs');
- var router = express.Router(); // get an instance of the express Router
- var http = require('http');
- var qs = require('qs');
- const querystring = require('querystring');
- var mysql = require('./mysql');
- // const _mysqlLabor = ["10.3.16.226", "ssti_cm"]; //本地双创數據庫信息
- // const _mysqlLabor = ["127.0.0.1", "ssti_cm"]; //本地双创數據庫信息
- // const _mysqlLabor = ["172.16.12.5", "pbl"]; //双创數據庫信
- const _mysqlLabor = ["10.16.30.130", "ssti_cm"]; //真实双创數據庫信息
- // const _mysqlLabor = ["43.139.158.220", "ssti_cm"]; // 袁一鸣服务器数据库
- var crypto = require('crypto');
- var https = require('https');
- //統壹處理區域
- router.use(async function(req, res, next) {
- await asynnext(req, res, next);
- //// make sure we go to the next routes and don't stop here
- //res.end("");
- });
- /**
- * @des 參數解釋同上
- */
- function asynnext(req, res, next) {
- //異步處理
- return new Promise(async(resolve, reject) => {
- next();
- //resolve(true);aa
- });
- }
- /*測試*/
- router.route('/a').all((req, res, next) => {
- var json = GetData(req);
- getmysql(req, res, "a");
- });
- //qgt 查看数据库是否有此人
- // router.use((req,res,next)=>{
- // const uid = GetData(req)['uid'];
- // let p = [_mysqlLabor[0], _mysqlLabor[1], 'select_UserByUserId',uid];
- // mysql.usselect(p,function(result){
- // if(result[0].length==1){
- // next();
- // }else{
- // res.Back(1,"用户不存在",GetData(req))
- // }
- // })
- // })
- //测试接口
- // router.post('/testApi', function(req, res, next) {
- // // 创建向后端服务器的请求
- // const options = {
- // hostname: 'cxcy.ssti.net.cn',
- // port: 80,
- // path: "/sso/api",
- // method: req.method,
- // headers: req.headers
- // };
- // const backendReq = http.request(options, (backendRes) => {
- // // 将后端服务器的响应转发给前端
- // res.writeHead(backendRes.statusCode, backendRes.headers);
- // backendRes.pipe(res);
- // });
- // // 将前端请求的数据转发给后端
- // req.pipe(backendReq);
- // // 处理后端请求的错误
- // backendReq.on('error', (error) => {
- // console.error('Error:', error);
- // res.statusCode = 500;
- // res.end('Internal Server Error');
- // });
- // })
- //消息与任务接口
- router.post('/getTest', function(req, res, next) {
- const options = {
- hostname: 'apis.ssti.net.cn',
- port: 80,
- path: '/taskcenterapp/sys/taskCenter/taskReceive/pushTask.do',
- method: 'POST',
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'appId': '36dd21cde3b2f30a',
- 'accessToken': '463e95bdad1a9506bd1b271194f89383'
- }
- };
- const req1 = http.request(options, (item) => {
- console.log(`statusCode: ${item.statusCode}`);
- item.on('data', (data) => {
- console.log(data.toString());
- res.end(JSON.stringify(data.toString()));
- });
- });
- req1.on('error', (error) => {
- console.error(error);
- });
- const bodyData = qs.stringify({ appId: "36dd21cde3b2f30a", taskInfo: req.body[0].taskInfo });
- req1.write(bodyData);
- req1.end();
- // request({
- // url:"http://apis.ssti.net.cn:80/taskcenterapp/sys/taskCenter/taskReceive/pushTask.do",
- // method:"POST",
- // encoding:null,
- // header:{
- // 'appId':'36dd21cde3b2f30a',
- // 'accessToken':'463e95bdad1a9506bd1b271194f89383'
- // },
- // data:{}
- // }),function(error,response,body){
- // console.log(error,response,body);
- // }
- })
- //qgt 新增全站通知 有用
- router.post("/CreateNewNotification", (req, res) => {
- QMysql(req, res, "insert_New")
- })
- //qgt 获取全站通知 有用
- router.get('/SelectNotification', (req, res) => {
- QMysql(req, res, 'select_NewByTitle')
- })
- //qgt 删除通知 有用
- router.post("/DeleteNotification", (req, res) => {
- QMysql(req, res, "update_NewStatusById");
- })
- //qgt 获取消息通知详细 有用
- router.get("/SelectNotificationDetail", (req, res) => {
- QMysql(req, res, "select_NewDetailById");
- })
- //qgt 获取所有的学院 有用
- router.post("/SelectAllDepartment", (req, res) => {
- let data = GetData(req);
- const str = req.headers.cookie ? req.headers.cookie : '';
- const getUserid = getUid(str);
- mysql.usselect([_mysqlLabor[0], _mysqlLabor[1], 'selectUserIdentity', data['uid']], (ret3) => {
- if (ret3[0][0].type == 0 || ret3[0][0].type == 1 || ret3[0][0].type == 2 || ret3[0][0].type == 3 || ret3[0][0].type == 4 || ret3[0][0].type == 5 || ret3[0][0].type == 6) {
- if (md5(data['uid']) == getUserid) {
- QMysql(req, res, "select_AllDepartment");
- } else {
- res.end(JSON.stringify({ a: "身份认证失败!" }));
- }
- } else {
- res.end(JSON.stringify({ a: "权限不足!" }));
- }
- })
- })
- //zyc 获取所有的用户 有用
- router.post("/selectAllUser", (req, res) => {
- let data = GetData(req);
- const str = req.headers.cookie ? req.headers.cookie : '';
- const getUserid = getUid(str);
- mysql.usselect([_mysqlLabor[0], _mysqlLabor[1], 'selectUserIdentity', data['uid']], (ret3) => {
- if (ret3[0][0].type == 0) {
- if (md5(data['uid']) == getUserid) {
- QMysql(req, res, "selectAllUser");
- } else {
- res.end(JSON.stringify({ a: "身份认证失败!" }));
- }
- } else {
- res.end(JSON.stringify({ a: "权限不足!" }));
- }
- })
- })
- //zyc 分配项目给用户 有用
- router.post("/updateProjectLookTeacher", (req, res) => {
- let data = GetData(req);
- const str = req.headers.cookie ? req.headers.cookie : '';
- const getUserid = getUid(str);
- mysql.usselect([_mysqlLabor[0], _mysqlLabor[1], 'selectUserIdentity', data['uid']], (ret3) => {
- if (ret3[0][0].type == 0) {
- if (md5(data['uid']) == getUserid) {
- QMysql(req, res, "updateProjectLookTeacher");
- } else {
- res.end(JSON.stringify({ a: "身份认证失败!" }));
- }
- } else {
- res.end(JSON.stringify({ a: "权限不足!" }));
- }
- })
- })
- //zyc 分配项目给用户 有用
- router.post("/updateProjectLookTeacher", (req, res) => {
- let data = GetData(req);
- const str = req.headers.cookie ? req.headers.cookie : '';
- const getUserid = getUid(str);
- mysql.usselect([_mysqlLabor[0], _mysqlLabor[1], 'selectUserIdentity', data['uid']], (ret3) => {
- if (ret3[0][0].type == 0) {
- if (md5(data['uid']) == getUserid) {
- QMysql(req, res, "updateProjectLookTeacher");
- } else {
- res.end(JSON.stringify({ a: "身份认证失败!" }));
- }
- } else {
- res.end(JSON.stringify({ a: "权限不足!" }));
- }
- })
- })
- // //qgt 获取所有的分类
- // router.get("/SelectAllType", (req, res) => {
- // QMysql(req, res, "select_AllType")
- // })
- // //qgt 添加项目申请
- // router.post("/CreateProject", (req, res) => {
- // QMysql(req, res, "insert_project");
- // })
- //qgt 项目立项申请获取数据 有用
- router.get("/SelectAllProject", (req, res) => {
- let data = GetData(req);
- const str = req.headers.cookie ? req.headers.cookie : '';
- const getUserid = getUid(str);
- if (md5(data['uid']) == getUserid) {
- QMysql(req, res, "select_AllProject");
- } else {
- res.end(JSON.stringify({ a: "身份认证失败!" }));
- }
- })
- // //qgt 获取立项申请的基础信息
- // router.get('/GetProjectBase', (req, res) => {
- // QMysql(req, res, "select_ProjectBaseById");
- // })
- // //qgt 获取项目详细信息
- // router.get('/GetProjectDetailMessage', (req, res) => {
- // QMysql(req, res, "select_ProjectMessageById")
- // })
- //qgt 删除项目详细信息 有用
- router.post('/DeleteProject', (req, res) => {
- const data = GetData(req);
- mysql.usselect([_mysqlLabor[0], _mysqlLabor[1], 'update_ProjectDeleteById', md5(data['uid']), data['pid'], 1], result => res.end(JSON.stringify(result)));
- })
- // //qgt 项目立项申请提交审核
- // router.post("/ApproveProject", (req, res) => {
- // const data = GetData(req);
- // mysql.usselect([_mysqlLabor[0], _mysqlLabor[1], 'update_ProjectIsupload', md5(data['uid']), data['pid'], 1], result => res.end(JSON.stringify(result)));
- // })
- //qgt 修改项目立项申请基础信息
- // router.post('/UpdateProjectBase', (req, res) => {
- // QMysql(req, res, "update_ProjectBase");
- // })
- // //qgt 修改项目立项申请详细信息
- // router.post("/UpdateProjectDetail", (req, res) => {
- // QMysql(req, res, 'update_ProjectDetail');
- // })
- //qgt 获取所有项目名称和ID 有用
- router.get("/GetAllProjectName", (req, res) => {
- let data = GetData(req);
- const str = req.headers.cookie ? req.headers.cookie : '';
- const getUserid = getUid(str);
- if (md5(data['uid']) == getUserid) {
- QMysql(req, res, 'select_AllProjectName');
- } else {
- res.end(JSON.stringify({ a: "身份认证失败!" }));
- }
- })
- // //qgt 创建创客活动
- // router.post('/CreateActivity', (req, res) => {
- // QMysql(req, res, "insert_Activity")
- // })
- //qgt 获取所有的创客活动 有用
- router.get('/GetAllActivity', (req, res) => {
- let data = GetData(req);
- const str = req.headers.cookie ? req.headers.cookie : '';
- const getUserid = getUid(str);
- if (md5(data['uid']) == getUserid) {
- QMysql(req, res, "select_AllActivity")
- } else {
- res.end(JSON.stringify({ a: "身份认证失败!" }));
- }
- })
- // //qgt 获取创客活动详细
- // router.get("/GetActivityDetail", (req, res) => {
- // QMysql(req, res, "select_ActivityDetail");
- // })
- // //qgt 修改活动管理
- // router.post("/UpdateActivity", (req, res) => {
- // QMysql(req, res, "update_Activity");
- // })
- //qgt 修改活动管理状态 有用
- router.post("/UpdateActivityState", (req, res) => {
- QMysql(req, res, "update_ActivityState");
- })
- //qgt 活动管理上传报告 有用
- router.post("/UploadActivityFile", (req, res) => {
- QMysql(req, res, "update_ActivityReportFile")
- })
- //yym 项目管理结项上传报告 有用
- router.post("/UploadProjectManageFile", (req, res) => {
- QMysql(req, res, "update_ProjectManageFile")
- })
- //yym 项目管理-进度详情-项目结题附件-获取项目结题附件 有用
- router.get("/SelectProjectManageFile", (req, res) => {
- QMysql(req, res, "select_ProjectManageFile")
- })
- //yym 项目管理-进度详情-项目附件-获取项目附件
- // router.get("/SelectProjectFile", (req, res) => {
- // QMysql(req, res, "select_ProjectFile")
- // })
- //yym 项目管理-进度详情-项目结题附件-上传项目结题附件 有用
- router.post("/AddProjectManageFile", (req, res) => {
- QMysql(req, res, "update_EndProjectFile")
- })
- //yym 项目管理-资金申报明细-获取资金申报明细
- // router.get("/SelectFundDetail", (req, res) => {
- // QMysql(req, res, "select_FundDetail")
- // })
- // yym 项目结项-获取项目结项首页渲染数据
- // router.get("/SelectSettlement", (req, res) => {
- // QMysql(req, res, "select_Settlement")
- // })
- // yym 项目结项-结项评语
- // router.post("/UpdateSettlementRemark", (req, res) => {
- // QMysql(req, res, "update_SettlementRemark")
- // })
- // yym 项目结项-获取结项评语数据
- // router.get("/SelectSettlementRemark", (req, res) => {
- // QMysql(req, res, "select_SettlementRemark")
- // })
- // yym 项目结项-确定完结项目
- // router.post("/UpdateSettlementIsUpload", (req, res) => {
- // QMysql(req, res, "update_SettlementIsUpload")
- // })
- // qgt 项目结项-确定完结项目 有用
- router.post('/UpdateSettlementEndProject', (req, res) => {
- QMysql(req, res, "update_SettlementEndProject");
- })
- // yym 项目结项-修改项目结项 有用(暑假新修改暂时无用)
- // router.post("/UpdateAmendFinish", (req, res) => {
- // QMysql(req, res, "update_amendFinish")
- // })
- // yym 项目资金使用管理-创客资金申请
- // router.post("/insertMakerFund", (req, res) => {
- // QMysql(req, res, "Insert_MakerFund")
- // })
- // yym 项目资金使用管理-获取渲染首页页面数据
- // router.get("/SelectMakerFund", (req, res) => {
- // QMysql(req, res, "select_MakerFund")
- // })
- // yym 项目资金使用管理-资金申请详情页面修改
- // router.post("/UpdateMakerFund", (req, res) => {
- // QMysql(req, res, "update_MakerFund")
- // })
- // yym 项目资金使用管理-审核按钮 有用
- router.post("/UpdateMakerFundState", (req, res) => {
- QMysql(req, res, "update_MakerFundState")
- })
- // yym 项目资金使用管理-创客资金申请详情项目名称下拉框
- // router.get("/SelectMakerFundDetailSelects", (req, res) => {
- // QMysql(req, res, "select_MakerFundDetailSelects")
- // })
- // yym 项目结项-项目基本内容-基础信息修改
- // router.post("/UpdateSettlementDetail", (req, res) => {
- // QMysql(req, res, "update_settlementDetail")
- // })
- //qgt 通过项目ID获取所有的活动附件
- // router.get("/GetActivityFileByProjectId", (req, res) => {
- // QMysql(req, res, "select_AllActivityFileByProjectId")
- // })
- //qgt 创业公司上传文件 有用
- router.post("/UploadFirmFile", (req, res) => {
- QMysql(req, res, "insert_startups")
- })
- //qgt 获取创业公司上传的文件 有用
- router.get("/GetFirmFile", (req, res) => {
- QMysql(req, res, "select_startupsByTitle");
- })
- //qgt 修改创业公司文件的状态 有用
- router.post("/UpdateFirmFileState", (req, res) => {
- QMysql(req, res, "update_startupsState");
- })
- //zyc 创业孵化基地资料归档创建公司 有用
- router.post("/insertAeimFiles", (req, res) => {
- QMysql(req, res, "insert_aeimFiles")
- })
- //zyc 获取创业孵化基地资料归档上传的文件 有用
- router.post("/selectAeimFileList", (req, res) => {
- QMysql(req, res, "select_aeimFileList");
- })
- //zyc 修改创业孵化基地资料归档文件的状态 有用
- router.post("/updateAeimFilesState", (req, res) => {
- QMysql(req, res, "update_aeimFilesState");
- })
- //zyc 创业孵化基地资料归档查询文件 有用
- router.post("/selectAeimAllFile", (req, res) => {
- QMysql(req, res, "select_aeimAllFile");
- })
- //zyc 创业孵化基地资料归档上传文件 有用
- router.post("/updateAeimFiles", (req, res) => {
- QMysql(req, res, "update_aeimFiles");
- })
- //qgt 获取已经结项的
- // router.get("/GetProjectIsEndProject", (req, res) => {
- // QMysql(req, res, "select_ProjectIsEndProject");
- // })
- //qgt 通过ID获取已经结项项目的数据
- // router.get("/GetProjectEndByID", (req, res) => {
- // QMysql(req, res, "select_ProjectEndBaseById")
- // })
- //qgt 通过ID修改学生学分
- // router.post("/UpdateStudentScore", (req, res) => {
- // QMysql(req, res, "update_ProjectStudentScore");
- // })
- //qgt 获取项目下所有活动的预算
- // router.get('/GetAllActivityMoneyByProjectId', (req, res) => {
- // QMysql(req, res, "select_ActivityAllMoneyByProjectId")
- // })
- //qgt 获取已经结项的项目 有用
- router.post('/GetProjectIsConclusion', (req, res) => {
- let data = GetData(req);
- const str = req.headers.cookie ? req.headers.cookie : '';
- const getUserid = getUid(str);
- mysql.usselect([_mysqlLabor[0], _mysqlLabor[1], 'selectUserIdentity', data['uid']], (ret3) => {
- if (ret3[0][0].type == 0 || ret3[0][0].type == 1 || ret3[0][0].type == 2 || ret3[0][0].type == 3 || ret3[0][0].type == 4 || ret3[0][0].type == 5 || ret3[0][0].type == 6) {
- if (md5(data['uid']) == getUserid) {
- QMysql(req, res, "select_ProjectIsConclusion");
- } else {
- res.end(JSON.stringify({ a: "身份认证失败!" }));
- }
- } else {
- res.end(JSON.stringify({ a: "权限不足!" }));
- }
- })
- })
- //qgt 获取代办公文的列表数据
- router.post('/getProjectByCommission', (req, res) => {
- let data = GetData(req);
- const str = req.headers.cookie ? req.headers.cookie : '';
- const getUserid = getUid(str);
- mysql.usselect([_mysqlLabor[0], _mysqlLabor[1], 'selectUserIdentity', data['uid']], (ret3) => {
- if (ret3[0][0].type == 0 || ret3[0][0].type == 1 || ret3[0][0].type == 2 || ret3[0][0].type == 3 || ret3[0][0].type == 4 || ret3[0][0].type == 5 || ret3[0][0].type == 6) {
- if (md5(data['uid']) == getUserid) {
- QMysql(req, res, "select_ProjectByCommission");
- } else {
- res.end(JSON.stringify({ a: "身份认证失败!" }));
- }
- } else {
- res.end(JSON.stringify({ a: "权限不足!" }));
- }
- })
- })
- //qgt 获取已经结项的项目详细 有用
- router.get("/GetProjectDetailIsConclusion", (req, res) => {
- QMysql(req, res, "select_ProjectResultDetail");
- })
- //qgt 获取项目下所有未完结的活动和资金 有用
- router.get("/GetActivityNoReportByPId", (req, res) => {
- QMysql(req, res, "select_ActivityNoReportById")
- })
- //qgt 修改结题文件 有用
- router.post('/updateEndAllFile', (req, res) => {
- QMysql(req, res, 'update_EndAllFile')
- })
- //qgt 修改结题文件 有用
- router.post('/updateProjectAllFile', (req, res) => {
- QMysql(req, res, 'update_ProjectAllFile')
- })
- //qgt 修改结题文件 有用
- router.post('/updateOtherAllFile', (req, res) => {
- QMysql(req, res, 'update_OtherAllFile')
- })
- //qgt 添加项目申请特色创客空间建设项目申报
- // router.post('/InsertProjectMakerSpace', (req, res) => {
- // QMysql(req, res, 'insert_project_MakerSpace')
- // })
- // //qgt 查询特色创客空间建设项目的基础信息
- // router.get("/SelectProjectMakerSpace", (req, res) => {
- // QMysql(req, res, 'select_projectApplyDetail_MakerSpace')
- // })
- // //qgt 修改特色创客空间建设项目的基础信息
- // router.post('/UpdateProjectMakerSpaceBase', (req, res) => {
- // QMysql(req, res, 'update_projectBase_MakerSpace')
- // })
- // //qgt 获取特色创客空间建设项目的详细信息
- // router.get("/SelectProjectChapterMakerSpace", (req, res) => {
- // QMysql(req, res, "select_projectChapters_MakerSpace")
- // })
- // //qgt 修改特色创客空间建设项目的详细信息
- // router.post("/UpdateProjectChaptersMakerSpace", (req, res) => {
- // QMysql(req, res, "update_projectCharters_MakerSpace")
- // })
- // //yym 添加项目申请学生创客项目申报
- // router.post('/InsertProjectStudent', (req, res) => {
- // QMysql(req, res, 'insert_project_student')
- // })
- // //yym 添加项目申请学生创客项目申报
- // router.get('/SelectProjectApplyDetailStudent', (req, res) => {
- // QMysql(req, res, 'Select_ProjectApplyDetail_Student')
- // })
- // //yym 修改项目立项申请-项目基本内容-学生项目基本内容修改
- // router.post('/updateProjectApplyDetailStudent', (req, res) => {
- // QMysql(req, res, 'update_ProjectApplyDetail_Student')
- // })
- // //yym 修改项目立项申请-项目基本内容-学生项目详情修改
- // router.post('/updateProjectApplication2Student', (req, res) => {
- // QMysql(req, res, 'update_ProjectApplication2_Student')
- // })
- //yym 获取成果展示学生创业项目数据 有用
- router.get("/SelectResultDetailStudent", (req, res) => {
- QMysql(req, res, "select_resultDetail_student");
- })
- // //qgt 获取项目的详细和资金申请
- // router.get("/SelectProjectWordMakerSpace", (req, res) => {
- // QMysql(req, res, 'select_projectWord_MakerSpace');
- // })
- //yym 获取学生项目的详细和资金申请 有用
- router.get("/SelectProjectWordMakerStudent", (req, res) => {
- QMysql(req, res, 'select_projectWord_makerStudent');
- })
- // //qgt 获取活动的文档信息
- // router.get("/SelectActivityWord", (req, res) => {
- // QMysql(req, res, 'select_Activity_Word');
- // })
- //qgt 查询项目管理的所有项目 有用
- router.get("/SelectAllProjectManagement", (req, res) => {
- QMysql(req, res, 'select_AllProjectManagement');
- })
- //qgt 查询项目结项的所有项目 有用
- router.get('/SelectAllProjectSettlement', (req, res) => {
- QMysql(req, res, 'select_AllProjectSettlement')
- })
- //yym 项目立项申请-驳回项目立项申请 有用
- router.post("/updateIsupload", (req, res) => {
- QMysql(req, res, 'update_Isupload');
- })
- //qgt //获取最后创建的项目编号 有用
- router.get('/getProjectNo', (req, res) => {
- QMysql(req, res, 'select_LastProjectNo')
- })
- //qgt //获取最后创建的活动编号 有用
- router.get('/getActivityNo', (req, res) => {
- QMysql(req, res, 'select_LastActvityNo');
- })
- //qgt //获取最后创建的项目编号 有用
- router.get('/getFundNo', (req, res) => {
- QMysql(req, res, 'select_LastFundNo')
- })
- //qgt 特色空间建设项目申请Word 有用
- router.post('/MakerSpaceWordApply', (req, res) => {
- QMysql(req, res, 'insert_Project_MakerSpaceWord');
- })
- //qgt 获取特色空间建设项目表格数据 有用
- router.get("/getMakerSpaceWordData", (req, res) => {
- QMysql(req, res, 'select_projectMakerSpaceWord')
- })
- //qgt 修改特色空间建设项目表格数据 有用
- router.post('/updateMakerSpaceWordData', (req, res) => {
- QMysql(req, res, 'update_projectMakerSpaceWord')
- })
- //yym 学生创客项目申请Word 新有用
- router.post('/studentProjectWordApply', (req, res) => {
- QMysql(req, res, 'insert_Project_studentProject');
- })
- //yym 项目立项申请-查看详情-获取学生创客项目申请Word数据 新有用
- router.get('/studentProjectData', (req, res) => {
- QMysql(req, res, 'select_Project_studentProjectData');
- })
- //yym 项目立项申请-查看详情-更新学生创客项目申请Word数据 新
- router.post('/updateStudentProjectData', (req, res) => {
- QMysql(req, res, 'update_Project_studentProjectData');
- })
- // qgt 获取项目的总经费和关联活动的预算 有用
- router.get('/getProjectFund', (req, res) => {
- QMysql(req, res, 'select_project_activityFund');
- })
- //qgt 添加活动申请word 有用
- router.post("/ActivityApply", (req, res) => {
- QMysql(req, res, 'insert_activityWord')
- })
- //qgt 获取活动申请word数据 有用
- router.get("/getActivityWordData", (req, res) => {
- QMysql(req, res, 'select_activityWord')
- })
- //qgt 修改活动word数据 有用
- router.post('/UpdateActivityWordData', (req, res) => {
- QMysql(req, res, 'update_activityWord')
- })
- //yym 事后汇总-活动创客项目-获取资金数据 新有用
- router.get('/selectMarkerFundData', (req, res) => {
- QMysql(req, res, 'select_MarkerFundData');
- })
- // yym 项目资金使用管理-下拉框获取 有用
- router.get("/SelectMakerFundSelects", (req, res) => {
- let data = GetData(req);
- const str = req.headers.cookie ? req.headers.cookie : '';
- const getUserid = getUid(str);
- if (md5(data['uid']) == getUserid) {
- QMysql(req, res, "select_MakerFundSelects")
- } else {
- res.end(JSON.stringify({ a: "身份认证失败!" }));
- }
- })
- // yym 项目资金使用管理-提交资金申请 有用
- router.post("/insertFundApply", (req, res) => {
- QMysql(req, res, "insert_fundApply")
- })
- // yym 事后汇总-获取所有资金申请 有用
- router.get("/selectAllFundApply", (req, res) => {
- let data = GetData(req);
- const str = req.headers.cookie ? req.headers.cookie : '';
- const getUserid = getUid(str);
- if (md5(data['uid']) == getUserid) {
- QMysql(req, res, "select_AllFundApply")
- } else {
- res.end(JSON.stringify({ a: "身份认证失败!" }));
- }
- })
- // yym 事后汇总-查看详情-获取活动资金详细 有用
- router.get("/selectActivityFundDetail", (req, res) => {
- QMysql(req, res, "select_activity_fundDetail")
- })
- // yym 事后汇总-查看详情-更新数据 有用
- router.post("/updateActivityFundDetail", (req, res) => {
- QMysql(req, res, "update_activity_fundDetail")
- })
- //qgt 通过活动ID获取未完结的资金 有用
- router.get("/getNoEndFundByActivity", (req, res) => {
- QMysql(req, res, 'select_fundNoEndByActivity')
- })
- //qgt 通过项目ID获取该项目下所有活动下所有的资金实际使用情况 有用
- router.get('/getProjectActivityFundIsUseDetail', (req, res) => {
- QMysql(req, res, 'select_projectIsUseFundDetail')
- })
- //qgt 通过项目ID获取该项目下所有活动下所有的资金列表 有用
- router.get('/getProjectActivityAllFund', (req, res) => {
- QMysql(req, res, 'select_projectActivityAllFund')
- })
- //qgt 获取数据监测数据
- router.get('/getEchartsData', (req, res) => {
- QMysql(req, res, 'select_EchartsData')
- })
- //qgt 查询数据库状态
- router.get('/getSystemState', (req, res) => {
- let data = GetData(req);
- const str = req.headers.cookie ? req.headers.cookie : '';
- const getUserid = getUid(str);
- if (md5(data['uid']) == getUserid) {
- QMysql(req, res, 'select_systemState')
- } else {
- res.end(JSON.stringify({ a: "身份认证失败!" }));
- }
- })
- //qgt 修改数据库状态
- router.post('/setSystemState', (req, res) => {
- QMysql(req, res, 'update_systemState')
- })
- //qgt 项目截止快到期了给与通知。30天、7天、3天分别给与提示提醒
- router.get("/SelectProjectEndData", (req, res) => {
- let data = GetData(req);
- const str = req.headers.cookie ? req.headers.cookie : '';
- const getUserid = getUid(str);
- if (md5(data['uid']) == getUserid) {
- QMysql(req, res, 'select_PlanEndProject')
- } else {
- res.end(JSON.stringify({ a: "身份认证失败!" }));
- }
- })
- //zyc 获取个人常用语
- router.get("/selectPhrases", (req, res) => {
- QMysql(req, res, 'selectPhrases')
- })
- //zyc 插入个人常用语
- router.get("/insertPhrases", (req, res) => {
- QMysql(req, res, 'insertPhrases')
- })
- //zyc 插入该代办公文签批意见
- router.post("/insertSign", (req, res) => {
- QMysql(req, res, "insertSign")
- })
- //zyc 获取该代办公文签批意见
- router.get("/selectSign", (req, res) => {
- QMysql(req, res, 'selectSign')
- })
- //yym 项目管理-进度详情-项目附件-获取专家审核结果附件
- router.get("/SelectProjectFile", (req, res) => {
- QMysql(req, res, "select_ProjectFile")
- })
- //zyc 项目管理-进度详情-项目附件-获取其他附件
- router.get("/selectOtherFile", (req, res) => {
- QMysql(req, res, "select_OtherFile")
- })
- // yym 项目管理-进度详情-项目附件-上传专家审核结果附件
- router.post("/AddProjectFile", (req, res) => {
- QMysql(req, res, "update_ProjectFile")
- })
- // zyc 项目管理-进度详情-项目附件-上传其他附件
- router.post("/AddOtherFile", (req, res) => {
- QMysql(req, res, "update_OtherFile")
- })
- // yym 项目管理-进度详情-项目附件-上传项目附件
- router.get("/getClosingstatementData", (req, res) => {
- QMysql(req, res, "select_ClosingstatementData")
- })
- // yym 项目管理-提交结项书
- router.post("/updateClosingstatementData", (req, res) => {
- QMysql(req, res, "update_ClosingstatementData")
- })
- // yym 项目管理-修改结项书
- router.get("/selectAmendFinish", (req, res) => {
- QMysql(req, res, "select_AmendFinish")
- })
- //yym 项目结项-获取项目结项书基础数据
- router.get("/getProjectBookData", (req, res) => {
- QMysql(req, res, "select_ProjectBookData")
- })
- //qgt 项目立项管理-项目详细-修改专家意见
- router.post("/updateProjectOpinion",(req,res)=>{
- QMysql(req, res, "update_ProjectOpinion")
- })
- //qgt 项目立项管理-项目申请-获取草稿
- router.get('/getDraft',(req,res)=>{
- QMysql(req, res, "select_draft")
- })
- //qgt 项目立项管理-项目申请-保存草稿
- router.post('/saveDraft',(req,res)=>{
- QMysql(req, res, "save_draft")
- })
- //qgt 项目立项管理-项目申请-删除草稿
- router.post('/delDraft',(req,res)=>{
- QMysql(req, res, "del_draft")
- })
- function getUid(str) {
- const variables = str.split(";");
- const values = {}
- for (var i = 0; i < variables.length; i++) {
- const noSpace = variables[i].trim(); // 去变量两端的空格
- const [key, value] = noSpace.split("="); //将变量分割成健和值
- values[key] = value;
- }
- // return values['vue_admin_template_token']
- return Buffer.from(values['vue_admin_template_token'], 'base64').toString('utf-8');
- }
- //qgt 用户登录后获取数据,如果数据库没有这个人则添加数据
- router.post('/userLogin', (req, res) => {
- let data = GetData(req);
- const str = req.headers.cookie ? req.headers.cookie : '';
- const getUserid = getUid(str);
- if (md5(data['id']) == getUserid) {
- //查询用户的数据
- mysql.usselect([_mysqlLabor[0], _mysqlLabor[1], 'select_UserByUserId', data['id']], function(ret) {
- if (ret[0].length == 0) { //数据库没有这个人的数据,查询学生表或者老师表获取数据
- mysql.usselect([_mysqlLabor[0], _mysqlLabor[1], 'select_UserMessageById', data['id']], (ret2) => {
- let userData = {};
- // console.log(ret2);
- if (ret2[0].length) {
- userData = ret2[0][0];
- userData['type'] = 2
- } //学生数据
- else if (ret2[1].length) {
- userData = ret2[1][0]
- userData['zymc'] = '';
- userData['type'] = 1; //老师数据
- };
- // console.log(userData);
- // console.log();
- let bm = '';
- if (userData['type'] == 1) bm = userData['bm'] //因为老师部门和学生专业不一样,所以要判断用户类型进行填充user中的bm
- if (userData['type'] == 2) bm = userData['xy']
- //数据库用户表添加用户
- mysql.usselect([_mysqlLabor[0], _mysqlLabor[1], 'insert_User', userData['id'], userData['xm'], userData['type'], bm, userData['zymc']], (ret3) => {
- console.log(ret3);
- if (ret3 == 1) {
- res.end(JSON.stringify({ userid: userData['id'] }))
- } else {
- res.end('ERROR')
- }
- })
- })
- } else {
- //数据库有数据
- res.end(JSON.stringify({...ret[0][0] }));
- }
- });
- } else {
- res.end(JSON.stringify({ a: "身份认证失败!" }));
- }
- })
- //zyc 用户登录后获取数据,如果数据库没有这个人则添加数据(防止修改uid能直接获取到其他老师信息)
- router.post('/userLogin2', (req, res) => {
- let data = GetData(req);
- //查询用户的数据
- mysql.usselect([_mysqlLabor[0], _mysqlLabor[1], 'select_UserByUserId1', data['id']], function(ret) {
- res.end(JSON.stringify(ret[0][0]));
- });
- })
- GetData = function(req) {
- var a = req.url.split("?");
- var json = querystring.parse(a[1])
- if (Object.keys(json).length != 0) {
- return json
- } else if (req.body) {
- return req.body
- } else if (req.body.mode) {
- return req.body.mode;
- }
- }
- //存储过程处理
- QMysql = function(req, res, functionName) {
- if (GetData(req)) {
- p = Object.values(GetData(req));
- // console.log(p);
- p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionName);
- //執行存儲過程
- mysql.usselect(p, function(ret) { res.end(JSON.stringify(ret)); });
- } else {
- res.end("未获取参数")
- }
- }
- //post存儲過程處理
- // PostMysql = function(req, res, functionName) {
- // //mode的處理
- // if (GetData(req)) {
- // p = Object.values(GetData(req));
- // p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionName);
- // //執行存儲過程
- // mysql.usselect(p, function(ret) { res.end(JSON.stringify(ret)); });
- // }else{
- // res.end("未获取参数")
- // }
- // }
- // GetMysql = function(req,res,functionName){
- // if(GetData(req)){
- // p = Object.values(GetData(req));
- // p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionName);
- // mysql.usselect(p, function(ret) { res.end(JSON.stringify(ret)); });
- // }else{
- // res.end("未获取参数")
- // }
- // }
- //post存儲過程處理
- // postmysql = function(req, res, functionname) {
- // //mode的處理
- // if (req.body[0]) {
- // p = Object.values(req.body[0]);
- // p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
- // //執行存儲過程
- // mysql.usselect(p, function(ret) { res.end(JSON.stringify(ret)); });
- // }
- // }
- //post存儲過程處理
- postmysql2 = function(req, res, functionname) {
- //mode的處理
- if (req.body) {
- p = Object.values(req.body)[0].split(",");
- p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
- //執行存儲過程
- mysql.usselect(p, function(ret) { res.end(JSON.stringify(ret)); });
- }
- }
- // router.route('/selectStudentCourseDetail').all((req, res, next) => { //学生
- // var json = queryString(req.url);
- // getmysql(req, res, "selectStudentCourseDetail", json['courseId']);
- // });
- // router.route('/addWorks').all((req, res, next) => {
- // postmysql(req, res, "add_works");
- // });
- //post存儲過程處理
- postmysql3 = function(req, res, functionname) {
- //mode的處理
- if (req.body) {
- p = Object.values(req.body);
- p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
- //執行存儲過程
- mysql.usselect(p, function(ret) { res.end(JSON.stringify(ret)); });
- }
- }
- //get獲取數據庫信息
- getmysql = function(req, res, functionname, ...p) {
- p = p || [];
- p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
- //執行存儲過程
- mysql.usselect(p, function(ret) { res.end(JSON.stringify(ret)); }); //
- }
- //post存储过程处理
- userpostmysql = function(req, res, functionname) {
- //mode的处理
- if (req.body.mode) {
- p = req.body.mode.split(",");
- p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
- //执行存储过程
- mysql.usselect(p, function(ret) { res.end(JSON.stringify(ret)); });
- }
- }
- //get获取数据库信息
- usergetmysql = function(req, res, functionname, ...p) {
- p = p || [];
- p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
- //执行存储过程
- mysql.usselect(p, function(ret) { res.end(JSON.stringify(ret)); }); //
- }
- // //获取请求数据
- // function GetData(req){
- // if(req.body['uid']==null){
- // return req.query
- // }else{
- // return req.body
- // }
- // // return req.query | req.body;
- // // if(req.method =='POST'){
- // // return req.body;
- // // }else if(req.method =="GET"){
- // // return req.query;
- // // }
- // }
- //获取当前时间
- // function getNowDate() {
- // let date = new Date();
- // let year = date.getFullYear(); //年
- // let month = date.getMonth() + 1; //月
- // let day = date.getDate(); //日
- // let hour = date.getHours(); //时
- // let minutes = date.getMinutes(); //分
- // let seconds = date.getSeconds(); //秒
- // if (month > 1 && month <= 9) month = "0" + month;
- // if (day > 0 && day <= 9) day = "0" + day;
- // if (hour > 0 && hour < 9) hour = "0" + hour;
- // if (minutes > 0 && minutes <= 9) minutes = "0" + minutes;
- // if (seconds > 0 && seconds < 9) seconds = "0" + seconds;
- // return `${year}-${month}-${day} ${hour}:${minutes}:${seconds}`;
- // }
- module.exports = router;
|