Browse Source

修改学生表内学校id字段

liuyu 5 years ago
parent
commit
000a6eadd1
4 changed files with 7 additions and 7 deletions
  1. 3 3
      app/controller/.student.js
  2. 1 1
      app/model/student.js
  3. 2 2
      app/service/leave.js
  4. 1 1
      app/service/login.js

+ 3 - 3
app/controller/.student.js

@@ -7,7 +7,7 @@ module.exports = {
       'gender',
       'nation',
       'school_name',
-      'schoolid',
+      'schid',
       'faculty',
       'major',
       'entry_year',
@@ -42,7 +42,7 @@ module.exports = {
       'gender',
       'nation',
       'school_name',
-      'schoolid',
+      'schid',
       'faculty',
       'major',
       'entry_year',
@@ -79,7 +79,7 @@ module.exports = {
         gender:'gender',
         nation:'nation',
         school_name:'school_name',
-        schoolid :'schoolid',
+        schid :'schid',
         faculty :'faculty',
         major:'major',
         entry_year:'entry_year',

+ 1 - 1
app/model/student.js

@@ -10,7 +10,7 @@ const StudentSchema = {
   gender: { type: String, required: false, maxLength: 200 }, // 性别
   nation: { type: String, required: false, maxLength: 200 }, // 民族
   school_name: { type: String, required: false, maxLength: 200 }, // 学校名称
-  schoolid: { type: String, required: false, maxLength: 200 }, // 学校id
+  schid: { type: String, required: false, maxLength: 200 }, // 学校id
   faculty: { type: String, required: false, maxLength: 200 }, // 院系
   major: { type: String, required: false, maxLength: 200 }, // 专业
   entry_year: { type: String, required: false, maxLength: 200 }, // 入学年份

+ 2 - 2
app/service/leave.js

@@ -20,8 +20,8 @@ class LeaveService extends CrudService {
     const entity = await this.model.create(newdata);
     const studentid = data.studentid;
     const student = await this.smodel.findById(studentid);
-    const schoolid = student.schoolid;
-    const user = await this.umodel.findOne({ uid: schoolid, type: '2' });
+    const schid = student.schid;
+    const user = await this.umodel.findOne({ uid: schid, type: '2' });
     if (user) {
       const openid = user.openid;
       const date = await this.ctx.service.util.updatedate();

+ 1 - 1
app/service/login.js

@@ -61,7 +61,7 @@ class LoginService extends CrudService {
     } else if (type === '4') {
       _userid = uid.toString();
       const result = await this.stuModel.findById(_userid);
-      res = { userid: _userid, schid: result.schoolid, schname: result.school_name, termid: result.termid, batchid: result.batchid, classid: result.classid, bedroomid: result.bedroomid, bedroom: result.bedroom, job: result.job, name, type, id: _id, status };
+      res = { userid: _userid, schid: result.schid, schname: result.school_name, termid: result.termid, batchid: result.batchid, classid: result.classid, bedroomid: result.bedroomid, bedroom: result.bedroom, job: result.job, name, type, id: _id, status };
     }
     const token = await jwt.sign(res, secret, { expiresIn, issuer, subject });
     return token;