lrf402788946 4 yıl önce
ebeveyn
işleme
eaf4c8955c
2 değiştirilmiş dosya ile 139 ekleme ve 134 silme
  1. 102 99
      app/controller/users/.personal.js
  2. 37 35
      app/model/personal.js

+ 102 - 99
app/controller/users/.personal.js

@@ -1,99 +1,102 @@
-module.exports = {
-  create: {
-    requestBody: [
-      "!name",
-      "!password",
-      "!phone",
-      "email",
-      "addr",
-      "office_phone",
-      "profession",
-      "code",
-      "openid",
-      "status",
-      "remark",
-      "create_time",
-    ],
-  },
-  destroy: {
-    params: ["!id"],
-    service: "delete",
-  },
-  update: {
-    params: ["!id"],
-    requestBody: [
-      "name",
-      "phone",
-      "email",
-      "addr",
-      "office_phone",
-      "profession",
-      "code",
-      "openid",
-      "status",
-      "remark",
-      "create_time",
-    ],
-  },
-  show: {
-    parameters: {
-      params: ["!id"],
-    },
-    service: "fetch",
-  },
-  index: {
-    parameters: {
-      query: {
-        phone: "phone",
-        code: "code",
-        status: "status",
-        profession: "profession",
-        "create_time@start": "create_time@start",
-        "create_time@end": "create_time@end",
-      },
-      options: {
-        isdel: "0", // 默认条件
-      },
-    },
-    service: "query",
-    options: {
-      query: ["skip", "limit"],
-      sort: ["meta.createdAt"],
-      desc: true,
-      count: true,
-    },
-  },
-  //修改密码
-  password: {
-    params: ["!id"],
-    requestBody: ["password"],
-    service: "password",
-  },
-  // 登陆
-  login: {
-    requestBody: ["phone", "password"],
-    service: "login",
-  },
-  upgrade: {
-    requestBody: [
-      "education",
-      "school",
-      "birthDate",
-      "qqwx",
-      "email",
-      "company",
-      "zwzc",
-      "expertise",
-      "img_path",
-      "workexperience",
-      "scientific",
-      "undertakingproject",
-      "scienceaward",
-      "social",
-      "status",
-      "remark",
-      "!id",
-    ],
-    service: "upgrade",
-  },
-};
+module.exports = {
+  create: {
+    requestBody: [
+      "!name",
+      "!password",
+      "!phone",
+      "email",
+      "addr",
+      "office_phone",
+      "profession",
+      "code",
+      "openid",
+      "status",
+      "remark",
+      "juris",
+      "create_time",
+    ],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: [
+      "name",
+      "phone",
+      "email",
+      "addr",
+      "office_phone",
+      "profession",
+      "code",
+      "openid",
+      "status",
+      "remark",
+      "juris",
+      "create_time",
+    ],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        phone: "phone",
+        code: "code",
+        juris:"juris",
+        status: "status",
+        profession: "profession",
+        "create_time@start": "create_time@start",
+        "create_time@end": "create_time@end",
+      },
+      options: {
+        isdel: "0", // 默认条件
+      },
+    },
+    service: "query",
+    options: {
+      query: ["skip", "limit"],
+      sort: ["meta.createdAt"],
+      desc: true,
+      count: true,
+    },
+  },
+  //修改密码
+  password: {
+    params: ["!id"],
+    requestBody: ["password"],
+    service: "password",
+  },
+  // 登陆
+  login: {
+    requestBody: ["phone", "password"],
+    service: "login",
+  },
+  upgrade: {
+    requestBody: [
+      "education",
+      "school",
+      "birthDate",
+      "qqwx",
+      "email",
+      "company",
+      "zwzc",
+      "expertise",
+      "img_path",
+      "workexperience",
+      "scientific",
+      "undertakingproject",
+      "scienceaward",
+      "social",
+      "status",
+      "remark",
+      "!id",
+    ],
+    service: "upgrade",
+  },
+};

+ 37 - 35
app/model/personal.js

@@ -1,35 +1,37 @@
-'use strict';
-const Schema = require('mongoose').Schema;
-const moment = require('moment');
-const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
-const { Secret } = require('naf-framework-mongoose/lib/model/schema');
-
-// 个人用户表
-const personal = {
-  name: { type: String, required: true }, // 用户名
-  password: { type: Secret, required: true, select: false }, // 登录密码
-  phone: { type: String, required: false, maxLength: 200 }, // 电话号码
-  email: { type: String, required: false, maxLength: 200 }, // 邮箱
-  addr: { type: String, required: false, maxLength: 500 }, // 地址
-  office_phone: { type: String, required: false, maxLength: 500 }, // 办公电话
-  profession: { type: String, required: false, maxLength: 500 }, // 所属行业
-  code: { type: String, required: false, default: 'INVESTORS' }, // 邀请码
-  openid: { type: String, required: false }, // 微信openid
-  status: { type: String, required: false, default: '0', maxLength: 200 }, // 审核状态,0-注册,1-通过,2-拒绝
-  isdel: { type: String, required: false, maxLength: 200, default: '0' }, // 是否删除,0-否,1-是
-  remark: { type: String, maxLength: 200 },
-  is_expert: { type: Boolean, default: false }, // 是否是专家
-  create_time: { type: String, default: moment().format('YYYY-MM-DD HH:mm:ss') },
-};
-const schema = new Schema(personal, { toJSON: { virtuals: true } });
-schema.index({ id: 1 });
-schema.index({ phone: 1 });
-schema.index({ code: 1 });
-schema.index({ status: 1 });
-schema.index({ profession: 1 });
-schema.index({ 'meta.createdAt': 1 });
-schema.plugin(metaPlugin);
-module.exports = app => {
-  const { mongoose } = app;
-  return mongoose.model('Personal', schema, 'personal');
-};
+'use strict';
+const Schema = require('mongoose').Schema;
+const moment = require('moment');
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
+const { Secret } = require('naf-framework-mongoose/lib/model/schema');
+
+// 个人用户表
+const personal = {
+  name: { type: String, required: true }, // 用户名
+  password: { type: Secret, required: true, select: false }, // 登录密码
+  phone: { type: String, required: false, maxLength: 200 }, // 电话号码
+  email: { type: String, required: false, maxLength: 200 }, // 邮箱
+  addr: { type: String, required: false, maxLength: 500 }, // 地址
+  office_phone: { type: String, required: false, maxLength: 500 }, // 办公电话
+  profession: { type: String, required: false, maxLength: 500 }, // 所属行业
+  code: { type: String, required: false, default: 'INVESTORS' }, // 邀请码
+  openid: { type: String, required: false }, // 微信openid
+  status: { type: String, required: false, default: '0', maxLength: 200 }, // 审核状态,0-注册,1-通过,2-拒绝
+  isdel: { type: String, required: false, maxLength: 200, default: '0' }, // 是否删除,0-否,1-是
+  remark: { type: String, maxLength: 200 },
+  juris: { type: String }, // 辖区
+  is_expert: { type: Boolean, default: false }, // 是否是专家
+  create_time: { type: String, default: moment().format('YYYY-MM-DD HH:mm:ss') },
+};
+const schema = new Schema(personal, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ phone: 1 });
+schema.index({ code: 1 });
+schema.index({ status: 1 });
+schema.index({ juris: 1 });
+schema.index({ profession: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Personal', schema, 'personal');
+};