|
@@ -12,7 +12,7 @@ const _mysqluser = ["172.16.12.5", "cocorobouser"]; //edu數據庫信息
|
|
var crypto = require('crypto');
|
|
var crypto = require('crypto');
|
|
|
|
|
|
//統壹處理區域
|
|
//統壹處理區域
|
|
-router.use(async function(req, res, next) {
|
|
|
|
|
|
+router.use(async function (req, res, next) {
|
|
await asynnext(req, res, next);
|
|
await asynnext(req, res, next);
|
|
//// make sure we go to the next routes and don't stop here
|
|
//// make sure we go to the next routes and don't stop here
|
|
//res.end("");
|
|
//res.end("");
|
|
@@ -23,7 +23,7 @@ router.use(async function(req, res, next) {
|
|
*/
|
|
*/
|
|
function asynnext(req, res, next) {
|
|
function asynnext(req, res, next) {
|
|
//異步處理
|
|
//異步處理
|
|
- return new Promise(async(resolve, reject) => {
|
|
|
|
|
|
+ return new Promise(async (resolve, reject) => {
|
|
next();
|
|
next();
|
|
//resolve(true);aa
|
|
//resolve(true);aa
|
|
});
|
|
});
|
|
@@ -38,7 +38,7 @@ router.route('/b').all((req, res, next) => {
|
|
getmysql(req, res, "b", json['ph'], json['pa']);
|
|
getmysql(req, res, "b", json['ph'], json['pa']);
|
|
});
|
|
});
|
|
/* 注册接口 */
|
|
/* 注册接口 */
|
|
-router.route('/register').post(function(req, res, next) {
|
|
|
|
|
|
+router.route('/register').post(function (req, res, next) {
|
|
//mode的处理
|
|
//mode的处理
|
|
if (req.body[0]) {
|
|
if (req.body[0]) {
|
|
// 0 用户名 1 用户密码 2用户身份 3 第三方id(可有可无)
|
|
// 0 用户名 1 用户密码 2用户身份 3 第三方id(可有可无)
|
|
@@ -61,7 +61,7 @@ router.route('/register').post(function(req, res, next) {
|
|
// mysql.usselect(p, function (ret) {
|
|
// mysql.usselect(p, function (ret) {
|
|
// res.end(ret);
|
|
// res.end(ret);
|
|
// });
|
|
// });
|
|
- mysql.usselect(p, function(ret) {
|
|
|
|
|
|
+ mysql.usselect(p, function (ret) {
|
|
res.end(JSON.stringify(ret));
|
|
res.end(JSON.stringify(ret));
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -73,20 +73,20 @@ router.route('/login').all((req, res, next) => {
|
|
// 0 用户名 1 用户密码
|
|
// 0 用户名 1 用户密码
|
|
c = Object.values(req.body[0]); //获取用户密码
|
|
c = Object.values(req.body[0]); //获取用户密码
|
|
p = [c[0]]
|
|
p = [c[0]]
|
|
- // p[1] = bcrypt.hashSync(p[1], bcrypt.genSaltSync(10));
|
|
|
|
|
|
+ // p[1] = bcrypt.hashSync(p[1], bcrypt.genSaltSync(10));
|
|
var _password = [c[0]];
|
|
var _password = [c[0]];
|
|
_password.unshift(_mysqlLabor[0], _mysqlLabor[1], "selectPassword");
|
|
_password.unshift(_mysqlLabor[0], _mysqlLabor[1], "selectPassword");
|
|
|
|
|
|
- mysql.usselect(_password, function(ret) {
|
|
|
|
|
|
+ mysql.usselect(_password, function (ret) {
|
|
var _ret = ret
|
|
var _ret = ret
|
|
var paJ = _ret[0][0].userpassword
|
|
var paJ = _ret[0][0].userpassword
|
|
- bcrypt.compare(c[1], paJ, function(err, result) {
|
|
|
|
|
|
+ bcrypt.compare(c[1], paJ, function (err, result) {
|
|
// console.log(result)
|
|
// console.log(result)
|
|
if (result) {
|
|
if (result) {
|
|
//参数拼接,登录
|
|
//参数拼接,登录
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], "selectLogin");
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], "selectLogin");
|
|
//执行存储过程
|
|
//执行存储过程
|
|
- mysql.usselect(p, function(ret) {
|
|
|
|
|
|
+ mysql.usselect(p, function (ret) {
|
|
res.end(JSON.stringify({ status: "1", ...ret }));
|
|
res.end(JSON.stringify({ status: "1", ...ret }));
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
@@ -267,8 +267,8 @@ router.route('/selectWorksStudent').all((req, res, next) => {
|
|
});
|
|
});
|
|
|
|
|
|
/* 查询学生 */
|
|
/* 查询学生 */
|
|
-router.route('/selectStudent2').all((req, res, next) => {
|
|
|
|
- var json = queryString(req.url);
|
|
|
|
|
|
+router.route('/selectStudent2').all((req, res, next) => {
|
|
|
|
+ var json = queryString(req.url);
|
|
getmysql(req, res, "selectStudent2", json['oid'], json['cu'], json['cn'], json['cid'], json['page'], 8);
|
|
getmysql(req, res, "selectStudent2", json['oid'], json['cu'], json['cn'], json['cid'], json['page'], 8);
|
|
});
|
|
});
|
|
|
|
|
|
@@ -279,7 +279,7 @@ router.route('/addWorkNew').all((req, res, next) => {
|
|
p = [req.body[0].uid, req.body[0].title, req.body[0].brief, req.body[0].cover, req.body[0].astudent, req.body[0].see, req.body[0].chapters, req.body[0].template];
|
|
p = [req.body[0].uid, req.body[0].title, req.body[0].brief, req.body[0].cover, req.body[0].astudent, req.body[0].see, req.body[0].chapters, req.body[0].template];
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], "insert_teacher_work_new");
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], "insert_teacher_work_new");
|
|
//執行存儲過程
|
|
//執行存儲過程
|
|
- mysql.usselect(p, function(ret) {
|
|
|
|
|
|
+ mysql.usselect(p, function (ret) {
|
|
let course = req.body[0].courseType;
|
|
let course = req.body[0].courseType;
|
|
let courseId = ret[0][0].courseId;
|
|
let courseId = ret[0][0].courseId;
|
|
let userid = req.body[0].uid;
|
|
let userid = req.body[0].uid;
|
|
@@ -293,9 +293,9 @@ router.route('/addWorkNew').all((req, res, next) => {
|
|
|
|
|
|
router.route('/addWorkNew2').all((req, res, next) => {
|
|
router.route('/addWorkNew2').all((req, res, next) => {
|
|
if (req.body[0]) {
|
|
if (req.body[0]) {
|
|
- p = [req.body[0].uid, req.body[0].title, req.body[0].brief, req.body[0].cover, req.body[0].astudent, req.body[0].see, req.body[0].chapters, req.body[0].template];
|
|
|
|
|
|
+ p = [req.body[0].uid, req.body[0].title, req.body[0].brief, req.body[0].cover, req.body[0].astudent, req.body[0].see, req.body[0].chapters, req.body[0].template];
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], "insert_teacher_work_new2"); //執行存儲過程
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], "insert_teacher_work_new2"); //執行存儲過程
|
|
- mysql.usselect(p, function(ret) {
|
|
|
|
|
|
+ mysql.usselect(p, function (ret) {
|
|
let course = req.body[0].courseType;
|
|
let course = req.body[0].courseType;
|
|
let courseId = ret[0][0].courseId;
|
|
let courseId = ret[0][0].courseId;
|
|
let userid = req.body[0].uid;
|
|
let userid = req.body[0].uid;
|
|
@@ -308,9 +308,9 @@ router.route('/addWorkNew2').all((req, res, next) => {
|
|
|
|
|
|
router.route('/addWorkNew3').all((req, res, next) => {
|
|
router.route('/addWorkNew3').all((req, res, next) => {
|
|
if (req.body[0]) {
|
|
if (req.body[0]) {
|
|
- p = [req.body[0].uid, req.body[0].title, req.body[0].brief, req.body[0].cover, req.body[0].astudent, req.body[0].see, req.body[0].chapters, req.body[0].template, req.body[0].ateacher];
|
|
|
|
|
|
+ p = [req.body[0].uid, req.body[0].title, req.body[0].brief, req.body[0].cover, req.body[0].astudent, req.body[0].see, req.body[0].chapters, req.body[0].template, req.body[0].ateacher];
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], "insert_teacher_work_new3"); //執行存儲過程
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], "insert_teacher_work_new3"); //執行存儲過程
|
|
- mysql.usselect(p, function(ret) {
|
|
|
|
|
|
+ mysql.usselect(p, function (ret) {
|
|
let course = req.body[0].courseType;
|
|
let course = req.body[0].courseType;
|
|
let courseId = ret[0][0].courseId;
|
|
let courseId = ret[0][0].courseId;
|
|
let userid = req.body[0].uid;
|
|
let userid = req.body[0].uid;
|
|
@@ -328,7 +328,7 @@ function delCourseType(course, courseId, userid) {
|
|
_courseId
|
|
_courseId
|
|
];
|
|
];
|
|
_userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "delete_courseType");
|
|
_userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "delete_courseType");
|
|
- mysql.usselect(_userdata, function(ret) {
|
|
|
|
|
|
+ mysql.usselect(_userdata, function (ret) {
|
|
console.log(ret);
|
|
console.log(ret);
|
|
});
|
|
});
|
|
|
|
|
|
@@ -353,7 +353,7 @@ function addCourseType(userid, course, _courseId) {
|
|
_uid,
|
|
_uid,
|
|
];
|
|
];
|
|
_userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "add_courseType");
|
|
_userdata.unshift(_mysqlLabor[0], _mysqlLabor[1], "add_courseType");
|
|
- mysql.usselect(_userdata, function(ret) {
|
|
|
|
|
|
+ mysql.usselect(_userdata, function (ret) {
|
|
console.log(ret);
|
|
console.log(ret);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -370,7 +370,7 @@ router.route('/updateWorkNew').all((req, res, next) => {
|
|
p = [req.body[0].cid, req.body[0].title, req.body[0].brief, req.body[0].cover, req.body[0].astudent, req.body[0].see, req.body[0].chapters, req.body[0].template];
|
|
p = [req.body[0].cid, req.body[0].title, req.body[0].brief, req.body[0].cover, req.body[0].astudent, req.body[0].see, req.body[0].chapters, req.body[0].template];
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], "update_teacher_work_new");
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], "update_teacher_work_new");
|
|
//執行存儲過程
|
|
//執行存儲過程
|
|
- mysql.usselect(p, function(ret) {
|
|
|
|
|
|
+ mysql.usselect(p, function (ret) {
|
|
let course = req.body[0].courseType;
|
|
let course = req.body[0].courseType;
|
|
let courseId = req.body[0].cid;
|
|
let courseId = req.body[0].cid;
|
|
let userid = req.body[0].uid;
|
|
let userid = req.body[0].uid;
|
|
@@ -389,9 +389,9 @@ router.route('/updateWorkNew').all((req, res, next) => {
|
|
|
|
|
|
router.route('/updateWorkNew2').all((req, res, next) => {
|
|
router.route('/updateWorkNew2').all((req, res, next) => {
|
|
if (req.body[0]) {
|
|
if (req.body[0]) {
|
|
- p = [req.body[0].cid, req.body[0].title, req.body[0].brief, req.body[0].cover, req.body[0].astudent, req.body[0].see, req.body[0].chapters, req.body[0].template];
|
|
|
|
|
|
+ p = [req.body[0].cid, req.body[0].title, req.body[0].brief, req.body[0].cover, req.body[0].astudent, req.body[0].see, req.body[0].chapters, req.body[0].template];
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], "update_teacher_work_new2"); //執行存儲過程
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], "update_teacher_work_new2"); //執行存儲過程
|
|
- mysql.usselect(p, function(ret) {
|
|
|
|
|
|
+ mysql.usselect(p, function (ret) {
|
|
let course = req.body[0].courseType;
|
|
let course = req.body[0].courseType;
|
|
let courseId = req.body[0].cid;
|
|
let courseId = req.body[0].cid;
|
|
let userid = req.body[0].uid;
|
|
let userid = req.body[0].uid;
|
|
@@ -403,9 +403,9 @@ router.route('/updateWorkNew2').all((req, res, next) => {
|
|
|
|
|
|
router.route('/updateWorkNew3').all((req, res, next) => {
|
|
router.route('/updateWorkNew3').all((req, res, next) => {
|
|
if (req.body[0]) {
|
|
if (req.body[0]) {
|
|
- p = [req.body[0].cid, req.body[0].title, req.body[0].brief, req.body[0].cover, req.body[0].astudent, req.body[0].see, req.body[0].chapters, req.body[0].template, req.body[0].ateacher];
|
|
|
|
|
|
+ p = [req.body[0].cid, req.body[0].title, req.body[0].brief, req.body[0].cover, req.body[0].astudent, req.body[0].see, req.body[0].chapters, req.body[0].template, req.body[0].ateacher];
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], "update_teacher_work_new3"); //執行存儲過程
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], "update_teacher_work_new3"); //執行存儲過程
|
|
- mysql.usselect(p, function(ret) {
|
|
|
|
|
|
+ mysql.usselect(p, function (ret) {
|
|
let course = req.body[0].courseType;
|
|
let course = req.body[0].courseType;
|
|
let courseId = req.body[0].cid;
|
|
let courseId = req.body[0].cid;
|
|
let userid = req.body[0].uid;
|
|
let userid = req.body[0].uid;
|
|
@@ -415,6 +415,90 @@ router.route('/updateWorkNew3').all((req, res, next) => {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+function guid() {
|
|
|
|
+ var _num,
|
|
|
|
+ i,
|
|
|
|
+ _guid = "";
|
|
|
|
+ for (i = 0; i < 32; i++) {
|
|
|
|
+ _guid += Math.floor(Math.random() * 16).toString(16); //随机0 - 16 的数字 转变为16进制的字符串
|
|
|
|
+ _num = Math.floor((i - 7) / 4); //计算 (i-7)除4
|
|
|
|
+ if (_num > -1 && _num < 4 && i == 7 + 4 * _num) {
|
|
|
|
+ //会使guid中间加 "-" 形式为xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
|
|
|
+ _guid += "-";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return _guid;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+router.route('/updateWorkNew4').all((req, res, next) => {
|
|
|
|
+ if (req.body[0]) {
|
|
|
|
+ let p = [req.body[0].cid];
|
|
|
|
+ p.unshift(_mysqlLabor[0], _mysqlLabor[1], "select_course_detail"); //執行存儲過程
|
|
|
|
+ mysql.usselect(p, function (ret) {
|
|
|
|
+ let _unitIndex = parseInt(req.body[0].unitIndex);
|
|
|
|
+ let _chapters = JSON.parse(req.body[0].chapters);
|
|
|
|
+ let _unitJson = JSON.parse(ret[0][0].chapters)
|
|
|
|
+ if ((_unitJson.length - 1) < _unitIndex) {
|
|
|
|
+ let _i = _unitIndex - (_unitJson.length - 1)
|
|
|
|
+ for (let i = 0; i < _i; i++) {
|
|
|
|
+ _unitJson.push({
|
|
|
|
+ dyName: "", //单元标题
|
|
|
|
+ chapterInfo: [
|
|
|
|
+ {
|
|
|
|
+ isread: false,
|
|
|
|
+ chapterid: guid(),
|
|
|
|
+ title: "",
|
|
|
|
+ courseName: "",
|
|
|
|
+ taskJson: [
|
|
|
|
+ {
|
|
|
|
+ task: "",
|
|
|
|
+ taskDetail: "",
|
|
|
|
+ chapterData: [],
|
|
|
|
+ toolText: "",
|
|
|
|
+ toolChoose: [
|
|
|
|
+ {
|
|
|
|
+ tool: [],
|
|
|
|
+ toolDetail: "",
|
|
|
|
+ toolType: 0,
|
|
|
|
+ askCount: 1,
|
|
|
|
+ askTitle: "",
|
|
|
|
+ askJson: [{ askstitle: "", askItem: 1, checkList: [] }],
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ isShowTools: false,
|
|
|
|
+ askCount: 1,
|
|
|
|
+ isFold: 0,
|
|
|
|
+ askTitle: "",
|
|
|
|
+ askJson: [{ askstitle: "", askItem: 1, checkList: [] }],
|
|
|
|
+ checkJson: [{ checkCount: [], checkPerent: [] }],
|
|
|
|
+ homeworkList: [],
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ itemCount: 1,
|
|
|
|
+ fileList1: [],
|
|
|
|
+ video: [],
|
|
|
|
+ testData: [],
|
|
|
|
+ pData: [],
|
|
|
|
+ templateArray: [],
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ _unitJson[_unitIndex] = _chapters[_unitIndex]
|
|
|
|
+ } else {
|
|
|
|
+ _unitJson[_unitIndex] = _chapters[_unitIndex]
|
|
|
|
+ }
|
|
|
|
+ console.log(_unitJson);
|
|
|
|
+ let p2 = [req.body[0].cid, JSON.stringify(_unitJson).replaceAll(/%/g, "%25")];
|
|
|
|
+ p2.unshift(_mysqlLabor[0], _mysqlLabor[1], "update_teacher_work_new4"); //執行存儲過程
|
|
|
|
+ mysql.usselect(p2, function (ret) {
|
|
|
|
+ res.end(JSON.stringify({ success: 1 }));
|
|
|
|
+ });
|
|
|
|
+ // res.end(JSON.stringify({ success: 1 }));
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+});
|
|
|
|
+
|
|
router.route('/selectCourseNew').all((req, res, next) => {
|
|
router.route('/selectCourseNew').all((req, res, next) => {
|
|
var json = queryString(req.url);
|
|
var json = queryString(req.url);
|
|
getmysql(req, res, "select_course_new", json['type'], json['uid'], json['oid'], json['typea'], json['typeb'], json['typec'], json['typed'], json['typeE'], json['cu'], json['cn'], json['page'], 10);
|
|
getmysql(req, res, "select_course_new", json['type'], json['uid'], json['oid'], json['typea'], json['typeb'], json['typec'], json['typed'], json['typeE'], json['cu'], json['cn'], json['page'], 10);
|
|
@@ -442,7 +526,7 @@ router.route('/selectClassBySchool').all((req, res, next) => {
|
|
getmysql(req, res, "selectClassBySchool", json['oid']);
|
|
getmysql(req, res, "selectClassBySchool", json['oid']);
|
|
});
|
|
});
|
|
//学生注册接口
|
|
//学生注册接口
|
|
-router.route('/register_student').post(function(req, res, next) {
|
|
|
|
|
|
+router.route('/register_student').post(function (req, res, next) {
|
|
//mode的处理
|
|
//mode的处理
|
|
if (req.body[0]) {
|
|
if (req.body[0]) {
|
|
// 0 用户名 1 用户密码 2用户身份 3 第三方id(可有可无)
|
|
// 0 用户名 1 用户密码 2用户身份 3 第三方id(可有可无)
|
|
@@ -465,7 +549,7 @@ router.route('/register_student').post(function(req, res, next) {
|
|
// mysql.usselect(p, function (ret) {
|
|
// mysql.usselect(p, function (ret) {
|
|
// res.end(ret);
|
|
// res.end(ret);
|
|
// });
|
|
// });
|
|
- mysql.usselect(p, function(ret) {
|
|
|
|
|
|
+ mysql.usselect(p, function (ret) {
|
|
res.end(JSON.stringify(ret));
|
|
res.end(JSON.stringify(ret));
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -656,7 +740,7 @@ router.route('/selectUser').all((req, res, next) => {
|
|
//查询分类及子分类
|
|
//查询分类及子分类
|
|
router.route('/selectType').all((req, res, next) => {
|
|
router.route('/selectType').all((req, res, next) => {
|
|
var json = queryString(req.url);
|
|
var json = queryString(req.url);
|
|
- getmysql(req, res, "selectType", );
|
|
|
|
|
|
+ getmysql(req, res, "selectType",);
|
|
});
|
|
});
|
|
//更加父id查询分类
|
|
//更加父id查询分类
|
|
router.route('/selectTypeByPid').all((req, res, next) => {
|
|
router.route('/selectTypeByPid').all((req, res, next) => {
|
|
@@ -851,16 +935,16 @@ router.route('/getCourseAdmin').all((req, res, next) => {
|
|
|
|
|
|
//admin 查询模板文档
|
|
//admin 查询模板文档
|
|
router.route('/deleteCourseAdmin').all((req, res, next) => {
|
|
router.route('/deleteCourseAdmin').all((req, res, next) => {
|
|
- postmysql(req, res, "delete_courseAdmin", );
|
|
|
|
|
|
+ postmysql(req, res, "delete_courseAdmin",);
|
|
});
|
|
});
|
|
|
|
|
|
//查询ppt在哪页
|
|
//查询ppt在哪页
|
|
-router.route('/selectPptPage').all((req, res, next) => {
|
|
|
|
- var json = queryString(req.url);
|
|
|
|
|
|
+router.route('/selectPptPage').all((req, res, next) => {
|
|
|
|
+ var json = queryString(req.url);
|
|
getmysql(req, res, "selectPptPage");
|
|
getmysql(req, res, "selectPptPage");
|
|
});
|
|
});
|
|
//修改ppt页码
|
|
//修改ppt页码
|
|
-router.route('/updatePptPage').all((req, res, next) => {
|
|
|
|
|
|
+router.route('/updatePptPage').all((req, res, next) => {
|
|
postmysql(req, res, "updatePptPage");
|
|
postmysql(req, res, "updatePptPage");
|
|
});
|
|
});
|
|
|
|
|
|
@@ -977,7 +1061,7 @@ router.route('/deleteEvaluation').all((req, res, next) => {
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
-router.route('/batchRegistrationMore').post(function(req, res, next) {
|
|
|
|
|
|
+router.route('/batchRegistrationMore').post(function (req, res, next) {
|
|
let users = req.body[0];
|
|
let users = req.body[0];
|
|
let arr = JSON.parse(req.body[0].arr);
|
|
let arr = JSON.parse(req.body[0].arr);
|
|
//循环注册
|
|
//循环注册
|
|
@@ -1051,7 +1135,7 @@ router.route('/batchRegistrationMore').post(function(req, res, next) {
|
|
//參數拼接,註冊
|
|
//參數拼接,註冊
|
|
_userdata.unshift(_mysqluser[0], _mysqluser[1], "pbl_add_batchregister");
|
|
_userdata.unshift(_mysqluser[0], _mysqluser[1], "pbl_add_batchregister");
|
|
//用戶註冊處理
|
|
//用戶註冊處理
|
|
- mysql.usselect(_userdata, function(ret) {
|
|
|
|
|
|
+ mysql.usselect(_userdata, function (ret) {
|
|
// let _pbluserdata = [
|
|
// let _pbluserdata = [
|
|
// ret[1][0].uid,
|
|
// ret[1][0].uid,
|
|
// _username,
|
|
// _username,
|
|
@@ -1071,7 +1155,7 @@ router.route('/batchRegistrationMore').post(function(req, res, next) {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
-router.route('/batchRegistration').post(function(req, res, next) {
|
|
|
|
|
|
+router.route('/batchRegistration').post(function (req, res, next) {
|
|
var users = req.body[0];
|
|
var users = req.body[0];
|
|
//循环注册
|
|
//循环注册
|
|
var _username = users.alias;
|
|
var _username = users.alias;
|
|
@@ -1111,7 +1195,7 @@ router.route('/batchRegistration').post(function(req, res, next) {
|
|
//參數拼接,註冊
|
|
//參數拼接,註冊
|
|
_userdata.unshift(_mysqluser[0], _mysqluser[1], "pbl_add_batchregister");
|
|
_userdata.unshift(_mysqluser[0], _mysqluser[1], "pbl_add_batchregister");
|
|
//用戶註冊處理
|
|
//用戶註冊處理
|
|
- mysql.usselect(_userdata, function(ret) {
|
|
|
|
|
|
+ mysql.usselect(_userdata, function (ret) {
|
|
res.end(JSON.stringify({ uid: ret[1][0].uid, ph: _ph, oid: _oid, cid: _class, success: 1 }));
|
|
res.end(JSON.stringify({ uid: ret[1][0].uid, ph: _ph, oid: _oid, cid: _class, success: 1 }));
|
|
});
|
|
});
|
|
});
|
|
});
|
|
@@ -1130,35 +1214,35 @@ function generateAPIKey(username) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-queryString = function(url) {
|
|
|
|
|
|
+queryString = function (url) {
|
|
var a = url.split("?");
|
|
var a = url.split("?");
|
|
var json = querystring.parse(a[1])
|
|
var json = querystring.parse(a[1])
|
|
return json;
|
|
return json;
|
|
}
|
|
}
|
|
|
|
|
|
//post存儲過程處理
|
|
//post存儲過程處理
|
|
-postmysql = function(req, res, functionname) {
|
|
|
|
|
|
+postmysql = function (req, res, functionname) {
|
|
//mode的處理
|
|
//mode的處理
|
|
if (req.body[0]) {
|
|
if (req.body[0]) {
|
|
p = Object.values(req.body[0]);
|
|
p = Object.values(req.body[0]);
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
|
|
//執行存儲過程
|
|
//執行存儲過程
|
|
- mysql.usselect(p, function(ret) { res.end(JSON.stringify(ret)); });
|
|
|
|
|
|
+ mysql.usselect(p, function (ret) { res.end(JSON.stringify(ret)); });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//get獲取數據庫信息
|
|
//get獲取數據庫信息
|
|
-getmysql = function(req, res, functionname, ...p) {
|
|
|
|
|
|
+getmysql = function (req, res, functionname, ...p) {
|
|
p = p || [];
|
|
p = p || [];
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
|
|
//執行存儲過程
|
|
//執行存儲過程
|
|
- mysql.usselect(p, function(ret) { res.end(JSON.stringify(ret)); }); //
|
|
|
|
|
|
+ mysql.usselect(p, function (ret) { res.end(JSON.stringify(ret)); }); //
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
//post存储过程处理
|
|
//post存储过程处理
|
|
|
|
|
|
-userpostmysql = function(req, res, functionname) {
|
|
|
|
|
|
+userpostmysql = function (req, res, functionname) {
|
|
|
|
|
|
//mode的处理
|
|
//mode的处理
|
|
|
|
|
|
@@ -1170,7 +1254,7 @@ userpostmysql = function(req, res, functionname) {
|
|
|
|
|
|
//执行存储过程
|
|
//执行存储过程
|
|
|
|
|
|
- mysql.usselect(p, function(ret) { res.end(JSON.stringify(ret)); });
|
|
|
|
|
|
+ mysql.usselect(p, function (ret) { res.end(JSON.stringify(ret)); });
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1180,7 +1264,7 @@ userpostmysql = function(req, res, functionname) {
|
|
|
|
|
|
//get获取数据库信息
|
|
//get获取数据库信息
|
|
|
|
|
|
-usergetmysql = function(req, res, functionname, ...p) {
|
|
|
|
|
|
+usergetmysql = function (req, res, functionname, ...p) {
|
|
|
|
|
|
p = p || [];
|
|
p = p || [];
|
|
|
|
|
|
@@ -1188,7 +1272,7 @@ usergetmysql = function(req, res, functionname, ...p) {
|
|
|
|
|
|
//执行存储过程
|
|
//执行存储过程
|
|
|
|
|
|
- mysql.usselect(p, function(ret) { res.end(JSON.stringify(ret)); }); //
|
|
|
|
|
|
+ mysql.usselect(p, function (ret) { res.end(JSON.stringify(ret)); }); //
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|