lsc hai 1 ano
pai
achega
e724cc04b0
Modificáronse 1 ficheiros con 62 adicións e 0 borrados
  1. 62 0
      pbl.js

+ 62 - 0
pbl.js

@@ -6154,6 +6154,68 @@ router.route("/batchRegistrationSzdjg").post(function(req, res, next) {
     });
 });
 
+//深圳电教馆注册
+router.route("/batchRegistrationSzdjg2").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];
+    //加密密碼
+    _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
+    ];
+    //參數拼接,註冊
+    _userdata.unshift(_mysqluser[0], _mysqluser[1], "pbl_add_batchregisterSzdjg2");
+    //用戶註冊處理
+    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) {