瀏覽代碼

Merge branch 'master' of https://git.cocorobo.cn/CocoRoboLabs/pbl-api

SanHQin 8 月之前
父節點
當前提交
c60d7f8220
共有 1 個文件被更改,包括 69 次插入0 次删除
  1. 69 0
      pbl.js

+ 69 - 0
pbl.js

@@ -4339,6 +4339,10 @@ router.route("/getClassAdmin").all((req, res, next) => {
     var json = queryString(req.url);
     var json = queryString(req.url);
     getmysql(req, res, "select_classAdmin", json["cn"], json["page"], 10);
     getmysql(req, res, "select_classAdmin", json["cn"], json["page"], 10);
 });
 });
+//查询ai权限
+router.route("/getAIJ").all((req, res, next) => {
+    getmysql(req, res, "getAIJ");
+});
 //admin 添加班级
 //admin 添加班级
 router.route("/addClassAdmin").all((req, res, next) => {
 router.route("/addClassAdmin").all((req, res, next) => {
     postmysql(req, res, "add_classAdmin");
     postmysql(req, res, "add_classAdmin");
@@ -6291,6 +6295,71 @@ router.route("/batchRegistrationSzdjg2").post(function(req, res, next) {
     });
     });
 });
 });
 
 
+//深圳电教馆注册
+router.route("/batchRegistrationSzdjg3").post(function(req, res, next) {
+    var users = Object.values(req.body)[0].split(",");
+    //循环注册
+    var _username = users[0]; //名字
+    var _mail = users[1]; //用户名 账号
+    var _password = "123456";
+    var _alias = _username;
+    var _org = users[2];
+    var _oid = users[3];
+    var _ph = users[4];
+    var _class = users[5];
+    var _type = users[6];
+    var _openid = users[7];
+    var _dest = users[8];
+    var _eduId = users[9];
+    //加密密碼
+    _password = bcrypt.hashSync(_password, bcrypt.genSaltSync(10));
+    //生成激活碼
+    let _hashstr = new Date().getTime() + "";
+    let _digest = crypto
+        .createHash("sha256")
+        .update(_hashstr, "utf8")
+        .digest("hex");
+    //用戶數據
+    var _userdata = [
+        _mail,
+        _password,
+        _alias,
+        "",
+        0,
+        _username,
+        _openid,
+        generateAPIKey(_username),
+        _digest,
+        "",
+        _username,
+        '',
+        _type,
+        _org,
+        _oid,
+        _ph,
+        _class,
+        "",
+        "0",
+        _dest,
+        _eduId
+    ];
+    //參數拼接,註冊
+    _userdata.unshift(_mysqluser[0], _mysqluser[1], "pbl_add_batchregisterSzdjg3");
+    //用戶註冊處理
+    mysql.usselect(_userdata, function(ret) {
+        res.end(
+            JSON.stringify({
+                uid: ret[1][0].uid,
+                ph: _ph,
+                oid: _oid,
+                cid: _class,
+                success: 1,
+            })
+        );
+    });
+});
+
+
 
 
 //新增教师
 //新增教师
 router.route("/batchRegistration1").post(function(req, res, next) {
 router.route("/batchRegistration1").post(function(req, res, next) {