Selaa lähdekoodia

用户表:添加是否是团长

lrf 2 vuotta sitten
vanhempi
commit
06f841363d
2 muutettua tiedostoa jossa 6 lisäystä ja 3 poistoa
  1. 3 2
      app/controller/user/config/.user.js
  2. 3 1
      app/model/user/user.js

+ 3 - 2
app/controller/user/config/.user.js

@@ -1,6 +1,6 @@
 module.exports = {
   create: {
-    requestBody: ['name', 'phone', 'password', 'icon', 'birth', 'gender', 'email', 'openid', 'status'],
+    requestBody: ['is_leader', 'name', 'phone', 'password', 'icon', 'birth', 'gender', 'email', 'openid', 'status'],
   },
   destroy: {
     requestBody: ['!key', '!target'],
@@ -8,7 +8,7 @@ module.exports = {
   },
   update: {
     params: ['!id'],
-    requestBody: ['name', 'phone', 'password', 'icon', 'birth', 'gender', 'email', 'openid', 'status'],
+    requestBody: ['is_leader', 'name', 'phone', 'password', 'icon', 'birth', 'gender', 'email', 'openid', 'status'],
   },
   show: {
     parameters: {
@@ -27,6 +27,7 @@ module.exports = {
         email: 'email',
         openid: 'openid',
         status: 'status',
+        is_leader: 'is_leader',
       },
       // options: {
       //   "meta.state": 0 // 默认条件

+ 3 - 1
app/model/user/user.js

@@ -14,7 +14,8 @@ const user = {
   gender: { type: String, required: false, zh: '性别' }, // 字典:gender
   email: { type: String, required: false, zh: '电子邮箱' }, //
   openid: { type: String, required: false, zh: '微信小程序' }, //
-  status: { type: String, required: false, default: '0', zh: '状态' }, // 字典statusr_status
+  status: { type: String, required: false, default: '0', zh: '状态' }, // 字典:statusr_status
+  is_leader: { type: String, required: false, default: '1', zh: '是否是团长' }, // 字典:is_use
 };
 const schema = new Schema(user, { toJSON: { getters: true, virtuals: true } });
 schema.index({ id: 1 });
@@ -24,6 +25,7 @@ schema.index({ phone: 1 });
 schema.index({ gender: 1 });
 schema.index({ openid: 1 });
 schema.index({ status: 1 });
+schema.index({ is_leader: 1 });
 
 schema.plugin(metaPlugin);