فهرست منبع

专家表数据整理

guhongwei 3 سال پیش
والد
کامیت
a17aeeb594
2فایلهای تغییر یافته به همراه106 افزوده شده و 102 حذف شده
  1. 84 78
      app/controller/user/config/.expert.js
  2. 22 24
      app/model/user/expert.js

+ 84 - 78
app/controller/user/config/.expert.js

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

+ 22 - 24
app/model/user/expert.js

@@ -1,46 +1,44 @@
-'use strict';
-const Schema = require('mongoose').Schema;
-const moment = require('moment');
-const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
-const { Secret } = require('naf-framework-mongoose-free/lib/model/schema');
-const { ObjectId } = require('mongoose').Types;
+"use strict";
+const Schema = require("mongoose").Schema;
+const moment = require("moment");
+const metaPlugin = require("naf-framework-mongoose-free/lib/model/meta-plugin");
+const { Secret } = require("naf-framework-mongoose-free/lib/model/schema");
+const { ObjectId } = require("mongoose").Types;
 
 // 专家表
 const expert = {
-  // 个人合并部分
   name: { type: String, required: true }, // 用户名
-  password: { type: Secret, required: true, select: false }, // 登录密码
   phone: { type: String, required: false, maxLength: 200 }, // 电话号码
+  password: { type: Secret, required: true, select: false }, // 登录密码
+  code: { type: String, required: false, default: "INVESTORS" }, // 邀请码
+  role: { type: String, required: false, default: "5" }, // 角色
   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
   juris: { type: String }, // 辖区
-  // 个人合并部分结束
-  education: { type: String, required: false, maxLength: 500 }, // 最高学历
-  school: { type: String, required: false, maxLength: 500 }, // 毕业院校
+
+  card: { type: String, required: false, maxLength: 200 }, // 身份证号
   birthDate: { type: String, required: false, maxLength: 500 }, // 出生日期
   qqwx: { type: String, required: false, maxLength: 500 }, // qq&微信
+  school: { type: String, required: false, maxLength: 500 }, // 所在院校
+  education: { type: String, required: false, maxLength: 500 }, // 最高学历
+  major: { type: String, required: false, maxLength: 200 }, // 所学专业
   company: { type: String, required: false, maxLength: 500 }, // 单位名称
   zwzc: { type: String, required: false, maxLength: 500 }, // 职务职称
-  expertise: { type: String, required: false, maxLength: 500 }, // 擅长领域
   img_path: { type: String, required: false }, // 头像图片
+  expertise: { type: String, required: false, maxLength: 500 }, // 擅长领域
   workexperience: { type: String, required: false, maxLength: 500 }, // 工作经历
   scientific: { type: String, required: false, maxLength: 500 }, // 科研综述
   undertakingproject: { type: String, required: false, maxLength: 500 }, // 承担项目
   scienceaward: { type: String, required: false, maxLength: 500 }, // 科技奖励
   social: { type: String, required: false, maxLength: 500 }, // 社会任职
-  status: { type: String, required: false, default: '0', maxLength: 500 }, // 审核状态,0-注册,1-通过,2-拒绝
-  major: { type: String, required: false, maxLength: 200 }, // 专业
-  card: { type: String, required: false, maxLength: 200 }, // 身份证号
 
-  isdel: { type: String, required: false, default: '0' }, // 0=>未删除;1=>已删除
+  status: { type: String, required: false, default: "0", maxLength: 500 }, // 审核状态,0-注册,1-通过,2-拒绝
+  openid: { type: String, required: false }, // 微信openid
+  isdel: { type: String, required: false, default: "0" }, // 0=>未删除;1=>已删除
   remark: { type: String, maxLength: 200 },
-  create_time: {
-    type: String,
-  },
+  create_time: { type: String },
 };
 const schema = new Schema(expert, { toJSON: { virtuals: true } });
 schema.index({ id: 1 });
@@ -48,9 +46,9 @@ schema.index({ name: 1 });
 schema.index({ phone: 1 });
 schema.index({ code: 1 });
 schema.index({ status: 1 });
-schema.index({ 'meta.createdAt': 1 });
+schema.index({ "meta.createdAt": 1 });
 schema.plugin(metaPlugin);
-module.exports = app => {
+module.exports = (app) => {
   const { mongoose } = app;
-  return mongoose.model('Expert', schema, 'expert');
+  return mongoose.model("Expert", schema, "expert");
 };