|
@@ -53,6 +53,34 @@ router.route('/a').all((req, res, next) => {
|
|
|
// })
|
|
|
// })
|
|
|
|
|
|
+//测试接口
|
|
|
+router.post('/testApi', function(req, res, next) {
|
|
|
+ // 创建向后端服务器的请求
|
|
|
+ const options = {
|
|
|
+ hostname: 'http://127.0.0.1',
|
|
|
+ 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 = {
|
|
@@ -115,15 +143,21 @@ router.get("/SelectNotificationDetail", (req, res) => {
|
|
|
})
|
|
|
|
|
|
//qgt 获取所有的学院 有用
|
|
|
-router.get("/SelectAllDepartment", (req, res) => {
|
|
|
+router.post("/SelectAllDepartment", (req, res) => {
|
|
|
let data = GetData(req);
|
|
|
const str = req.headers.cookie ? req.headers.cookie : '';
|
|
|
const getUserid = getUid(str);
|
|
|
- if (data['uid'] == getUserid) {
|
|
|
- QMysql(req, res, "select_AllDepartment");
|
|
|
- } else {
|
|
|
- res.end(JSON.stringify({ a: "身份认证失败!" }));
|
|
|
- }
|
|
|
+ mysql.usselect([_mysqlLabor[0], _mysqlLabor[1], 'selectUserIdentity', getUserid], (ret3) => {
|
|
|
+ if (ret3[0][0].type == 0) {
|
|
|
+ if (data['uid'] == getUserid) {
|
|
|
+ QMysql(req, res, "select_AllDepartment");
|
|
|
+ } else {
|
|
|
+ res.end(JSON.stringify({ a: "身份认证失败!" }));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ res.end(JSON.stringify({ a: "权限不足!" }));
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
// //qgt 获取所有的分类
|
|
@@ -360,15 +394,21 @@ router.post("/UpdateFirmFileState", (req, res) => {
|
|
|
// })
|
|
|
|
|
|
//qgt 获取已经结项的项目 有用
|
|
|
-router.get('/GetProjectIsConclusion', (req, res) => {
|
|
|
+router.post('/GetProjectIsConclusion', (req, res) => {
|
|
|
let data = GetData(req);
|
|
|
const str = req.headers.cookie ? req.headers.cookie : '';
|
|
|
const getUserid = getUid(str);
|
|
|
- if (data['uid'] == getUserid) {
|
|
|
- QMysql(req, res, "select_ProjectIsConclusion");
|
|
|
- } else {
|
|
|
- res.end(JSON.stringify({ a: "身份认证失败!" }));
|
|
|
- }
|
|
|
+ mysql.usselect([_mysqlLabor[0], _mysqlLabor[1], 'selectUserIdentity', getUserid], (ret3) => {
|
|
|
+ if (ret3[0][0].type == 0) {
|
|
|
+ if (data['uid'] == getUserid) {
|
|
|
+ QMysql(req, res, "select_ProjectIsConclusion");
|
|
|
+ } else {
|
|
|
+ res.end(JSON.stringify({ a: "身份认证失败!" }));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ res.end(JSON.stringify({ a: "权限不足!" }));
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
//qgt 获取已经结项的项目详细 有用
|