lsc 2 years ago
parent
commit
7d49a527f6
1 changed files with 13 additions and 3 deletions
  1. 13 3
      pbl.js

+ 13 - 3
pbl.js

@@ -447,7 +447,7 @@ router.route('/addCourseWorksTeacher').all((req, res, next) => {
 //上传文件
 router.route('/addCourseWorks2').all((req, res, next) => {
     var json = queryString(req.url);
-    getmysql(req, res, "addCourseWorks", json['uid'], json['cid'], json['stage'], json['task'], json['tool'], json['content'], json['type']);
+    postmysql(req, res, "addCourseWorks", json['uid'], json['cid'], json['stage'], json['task'], json['tool'], json['content'], json['type']);
 });
 //上传文件
 router.route('/addCourseWorks3').all((req, res, next) => {
@@ -457,8 +457,7 @@ router.route('/addCourseWorks3').all((req, res, next) => {
 
 //上传文件
 router.route('/addCourseWorks4').all((req, res, next) => {
-    var json = queryString(req.url);
-    getmysql(req, res, "addCourseWorks3", json['uid'], json['cid'], json['stage'], json['task'], json['tool'], json['content'], json['type'], json['atool'], json['text']);
+    postmysql3(req, res, "addCourseWorks3");
 });
 //修改课程权限(学生是否能查看所有作业)
 router.route('/updateCourseSLook').all((req, res, next) => {
@@ -2158,6 +2157,17 @@ postmysql2 = function(req, res, functionname) {
     }
 }
 
+//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 || [];