lrf402788946 4 years ago
parent
commit
64673613d1

+ 0 - 59
app/controller/.admin.js

@@ -1,59 +0,0 @@
-module.exports = {
-  create: {
-    requestBody: [
-      "!name",
-      "!phone",
-      "!passwd",
-      "remark",
-    ],
-  },
-  destroy: {
-    params: ["!id"],
-    service: "delete",
-  },
-  update: {
-    params: ["!id"],
-    requestBody: [
-      "name",
-      "phone",
-      "remark",
-    ],
-  },
-  show: {
-    parameters: {
-      params: ["!id"],
-    },
-    service: "fetch",
-  },
-  index: {
-    parameters: {
-      query: {
-        name: "%name%",
-        phone: "phone",
-        "create_time@start": "create_time@start",
-        "create_time@end": "create_time@end",
-      },
-      // options: {
-      //   "meta.state": 0 // 默认条件
-      // },
-    },
-    service: "query",
-    options: {
-      query: ["skip", "limit"],
-      sort: ["meta.createdAt"],
-      desc: true,
-      count: true,
-    },
-  },
-  //修改密码
-  password: {
-    params: ["!id"],
-    requestBody: ["passwd"],
-    service: "password",
-  },
-  // 登陆
-  login: {
-    requestBody: ["code_phone", "passwd"],
-    service: "login",
-  }
-};

+ 0 - 104
app/controller/.organization.js

@@ -1,104 +0,0 @@
-module.exports = {
-  create: {
-    requestBody: [
-      "!name",
-      "!passwd",
-      "phone",
-      "email",
-      "addr",
-      "code",
-      "office_phone",
-      "profession",
-      "institution_code",
-      "companytype",
-      "companydate",
-      "companycapital",
-      "companyperson",
-      "sndqyzsr",
-      "sndyffy",
-      "companytotal",
-      "zjzyfrs",
-      "companybrief",
-      "mainproduct",
-      "qualifications",
-      "remark",
-      "juris",
-      "openid",
-      "status",
-    ],
-  },
-  destroy: {
-    params: ["!id"],
-    service: "delete",
-  },
-  update: {
-    params: ["!id"],
-    requestBody: [
-      "name",
-      "phone",
-      "email",
-      "addr",
-      "code",
-      "office_phone",
-      "profession",
-      "institution_code",
-      "companytype",
-      "companydate",
-      "companycapital",
-      "companyperson",
-      "sndqyzsr",
-      "sndyffy",
-      "companytotal",
-      "zjzyfrs",
-      "companybrief",
-      "mainproduct",
-      "qualifications",
-      "remark",
-      "juris",
-      "openid",
-      "status",
-    ],
-  },
-  show: {
-    parameters: {
-      params: ["!id"],
-    },
-    service: "fetch",
-  },
-  index: {
-    parameters: {
-      query: {
-        phone: "phone",
-        code: "code",
-        profession: "profession",
-        institution_code: "institution_code",
-        companyperson: "companyperson",
-        status: "status",
-        juris: "juris",
-        "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: ["passwd"],
-    service: "password",
-  },
-  // 登陆
-  login: {
-    requestBody: ["institution_code", "passwd"],
-    service: "login",
-  },
-};

+ 0 - 63
app/controller/.policy.js

@@ -1,63 +0,0 @@
-module.exports = {
-  create: {
-    requestBody: [
-      "user_id",
-      "type",
-      "company",
-      "apply_personal",
-      "phone",
-      "qyfr",
-      "yyzz",
-      "qylr",
-      "desc",
-      "status",
-    ],
-  },
-  destroy: {
-    params: ["!id"],
-    service: "delete",
-  },
-  update: {
-    params: ["!id"],
-    requestBody: [
-      "user_id",
-      "type",
-      "company",
-      "apply_personal",
-      "phone",
-      "qyfr",
-      "yyzz",
-      "qylr",
-      "desc",
-      "status",
-    ],
-  },
-  show: {
-    parameters: {
-      params: ["!id"],
-    },
-    service: "fetch",
-  },
-  index: {
-    parameters: {
-      query: {
-        company: "company",
-        type: "type",
-        phone: "phone",
-        status: "status",
-        "create_time@start": "create_time@start",
-        "create_time@end": "create_time@end",
-      },
-      // options: {
-      //   "meta.state": 0 // 默认条件
-      // },
-    },
-    service: "query",
-    options: {
-      query: ["skip", "limit"],
-      sort: ["meta.createdAt"],
-      desc: true,
-      count: true,
-    },
-  },
-};

+ 0 - 64
app/controller/.road_show.js

@@ -1,64 +0,0 @@
-module.exports = {
-  create: {
-    requestBody: [
-      "user_id",
-      "dock_id",
-      "title",
-      "brief",
-      "origin",
-      "publish_time",
-      "content",
-      "picture",
-      "filepath",
-      "remark"
-    ],
-  },
-  destroy: {
-    params: ["!id"],
-    service: "delete",
-  },
-  update: {
-    params: ["!id"],
-    requestBody: [
-      "user_id",
-      "dock_id",
-      "title",
-      "brief",
-      "origin",
-      "publish_time",
-      "content",
-      "picture",
-      "filepath",
-      "remark"
-    ],
-  },
-  show: {
-    parameters: {
-      params: ["!id"],
-    },
-    service: "fetch",
-  },
-  index: {
-    parameters: {
-      query: {
-        dock_id:"dock_id",
-        title:"%title%",
-        origin:"origin",
-        "publish_time@start":"publish_time@start",
-        "publish_time@end":"publish_time@end",
-        "create_time@start": "create_time@start",
-        "create_time@end": "create_time@end",
-      },
-      // options: {
-      //   "meta.state": 0 // 默认条件
-      // },
-    },
-    service: "query",
-    options: {
-      query: ["skip", "limit"],
-      sort: ["meta.createdAt"],
-      desc: true,
-      count: true,
-    },
-  },
-};

+ 0 - 58
app/controller/.ticket.js

@@ -1,58 +0,0 @@
-module.exports = {
-  create: {
-    requestBody: [
-      "user_id",
-      "material",
-      "medium_material",
-      "contract",
-      "mechanism_id",
-    ],
-  },
-  destroy: {
-    params: ["!id"],
-    service: "delete",
-  },
-  update: {
-    params: ["!id"],
-    requestBody: [
-      "user_id",
-      "mechanism_id",
-      "material",
-      "medium_material",
-      "contract",
-      "status",
-    ],
-  },
-  show: {
-    parameters: {
-      params: ["!id"],
-    },
-    service: "fetch",
-  },
-  index: {
-    parameters: {
-      query: {
-        name: "name",
-        user_id: "user_id",
-        mechanism_id: "mechanism_id",
-        status: "status",
-        "create_time@start": "create_time@start",
-        "create_time@end": "create_time@end",
-      },
-      // options: {
-      //   "meta.state": 0 // 默认条件
-      // },
-    },
-    service: "query",
-    options: {
-      query: ["skip", "limit"],
-      sort: ["meta.createdAt"],
-      desc: true,
-      count: true,
-    },
-  },
-  status: {
-    params: ["!id"],
-    requestBody: ["status", "desc", "opera_id"],
-  },
-};

+ 0 - 39
app/controller/.ticket_record.js

@@ -1,39 +0,0 @@
-module.exports = {
-  create: {
-    requestBody: ["ticket_id", "status", "desc", "opera_id"],
-  },
-  destroy: {
-    params: ["!id"],
-    service: "delete",
-  },
-  update: {
-    params: ["!id"],
-    requestBody: ["ticket_id", "status", "desc", "opera_id"],
-  },
-  show: {
-    parameters: {
-      params: ["!id"],
-    },
-    service: "fetch",
-  },
-  index: {
-    parameters: {
-      query: {
-        ticket_id: "ticket_id",
-        status: "status",
-        "create_time@start": "create_time@start",
-        "create_time@end": "create_time@end",
-      },
-      // options: {
-      //   "meta.state": 0 // 默认条件
-      // },
-    },
-    service: "query",
-    options: {
-      query: ["skip", "limit"],
-      sort: ["meta.createdAt"],
-      desc: true,
-      count: true,
-    },
-  },
-};

+ 0 - 13
app/controller/admin.js

@@ -1,13 +0,0 @@
-'use strict';
-const meta = require('./.admin.js');
-const Controller = require('egg').Controller;
-const { CrudController } = require('naf-framework-mongoose/lib/controller');
-
-// 管理员
-class AdminController extends Controller {
-  constructor(ctx) {
-    super(ctx);
-    this.service = this.ctx.service.admin;
-  }
-}
-module.exports = CrudController(AdminController, meta);

+ 0 - 13
app/controller/organization.js

@@ -1,13 +0,0 @@
-'use strict';
-const meta = require('./.organization.js');
-const Controller = require('egg').Controller;
-const { CrudController } = require('naf-framework-mongoose/lib/controller');
-
-// 机构
-class OrganizationController extends Controller {
-  constructor(ctx) {
-    super(ctx);
-    this.service = this.ctx.service.organization;
-  }
-}
-module.exports = CrudController(OrganizationController, meta);

+ 0 - 13
app/controller/policy.js

@@ -1,13 +0,0 @@
-'use strict';
-const meta = require('./.policy.js');
-const Controller = require('egg').Controller;
-const { CrudController } = require('naf-framework-mongoose/lib/controller');
-
-// 高企政策服务
-class PolicyController extends Controller {
-  constructor(ctx) {
-    super(ctx);
-    this.service = this.ctx.service.policy;
-  }
-}
-module.exports = CrudController(PolicyController, meta);

+ 0 - 13
app/controller/road_show.js

@@ -1,13 +0,0 @@
-'use strict';
-const meta = require('./.road_show.js');
-const Controller = require('egg').Controller;
-const { CrudController } = require('naf-framework-mongoose/lib/controller');
-
-// 项目路演
-class Road_showController extends Controller {
-  constructor(ctx) {
-    super(ctx);
-    this.service = this.ctx.service.roadShow;
-  }
-}
-module.exports = CrudController(Road_showController, meta);

+ 0 - 17
app/controller/ticket.js

@@ -1,17 +0,0 @@
-'use strict';
-const meta = require('./.ticket.js');
-const Controller = require('egg').Controller;
-const { CrudController } = require('naf-framework-mongoose/lib/controller');
-
-// 高企申报
-class TicketController extends Controller {
-  constructor(ctx) {
-    super(ctx);
-    this.service = this.ctx.service.ticket;
-  }
-  async index() {
-    const { data, total } = await this.service.query(this.ctx.query);
-    this.ctx.ok({ data, total });
-  }
-}
-module.exports = CrudController(TicketController, meta);

+ 0 - 13
app/controller/ticket_record.js

@@ -1,13 +0,0 @@
-'use strict';
-const meta = require('./.ticket_record.js');
-const Controller = require('egg').Controller;
-const { CrudController } = require('naf-framework-mongoose/lib/controller');
-
-// 创新券记录表
-class Ticket_recordController extends Controller {
-  constructor(ctx) {
-    super(ctx);
-    this.service = this.ctx.service.ticketRecord;
-  }
-}
-module.exports = CrudController(Ticket_recordController, meta);

+ 0 - 22
app/model/admin.js

@@ -1,22 +0,0 @@
-'use strict';
-const Schema = require('mongoose').Schema;
-const moment = require('moment');
-const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
-const { ObjectId } = require('mongoose').Types;
-const { Secret } = require('naf-framework-mongoose/lib/model/schema');
-// 管理员表
-const admin = {
-  name: { type: String }, // 名称
-  phone: { type: String }, // 手机
-  passwd: { type: Secret, select: false }, // 注册密码
-  remark: { type: String },
-  create_time: { type: String, default: moment(new Date()).format('YYYY-MM-DD HH:mm:ss') },
-};
-const schema = new Schema(admin, { toJSON: { virtuals: true } });
-schema.index({ id: 1 });
-schema.index({ 'meta.createdAt': 1 });
-schema.plugin(metaPlugin);
-module.exports = app => {
-  const { mongoose } = app;
-  return mongoose.model('Admin', schema, 'admin');
-};

+ 0 - 50
app/model/organization.js

@@ -1,50 +0,0 @@
-'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 organization = {
-  name: { type: String, required: true, maxLength: 200 }, // 用户名
-  passwd: { 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 }, // 所属行业
-  institution_code: { type: String, required: false, maxLength: 500 }, // 机构代码
-  code: { type: String, required: false, default: 'INVESTORS' }, // 邀请码
-
-  companytype: { type: String, required: false, maxLength: 300 }, // 注册类型
-  companydate: { type: String, required: false, maxLength: 300 }, // 注册时间
-  companycapital: { type: String, required: false, maxLength: 300 }, // 注册资金
-  companyperson: { type: String, required: false, maxLength: 300 }, // 企业法人
-  sndqyzsr: { type: String, required: false, maxLength: 300 }, // 上年度企业总收入
-  sndyffy: { type: String, required: false, maxLength: 300 }, // 上年度研发费用
-  companytotal: { type: String, required: false, maxLength: 300 }, // 企业总人数
-  zjzyfrs: { type: String, required: false, maxLength: 300 }, // 专&兼职研发人数
-  companybrief: { type: String, required: false }, // 企业简介
-  mainproduct: { type: String, required: false, maxLength: 300 }, // 主要产品
-  qualifications: { type: String, required: false, maxLength: 300 }, // 企业资质&荣誉
-  status: { type: String, required: false, default: '0', maxLength: 200 }, // 审核状态,0-注册,1-通过,2-拒绝
-
-  // 21-05-07添加区字段
-  juris: { type: String }, // 辖区
-  openid: { type: Array }, // 微信绑定 [{name:"微信昵称",openid:value}],多人管理一个账号,方便删除
-  isdel: { type: String, required: false, default: '0' }, // 0=>未删除;1=>已删除
-  remark: { type: String, maxLength: 200 },
-  create_time: { type: String, default: moment().format('YYYY-MM-DD HH:mm:ss') },
-};
-const schema = new Schema(organization, { toJSON: { virtuals: true } });
-schema.index({ id: 1 });
-schema.index({ phone: 1 });
-schema.index({ profession: 1 });
-schema.index({ institution_code: 1 });
-schema.index({ companyperson: 1 });
-schema.index({ 'meta.createdAt': 1 });
-schema.plugin(metaPlugin);
-module.exports = app => {
-  const { mongoose } = app;
-  return mongoose.model('Organization', schema, 'organization');
-};

+ 0 - 32
app/model/policy.js

@@ -1,32 +0,0 @@
-'use strict';
-const Schema = require('mongoose').Schema;
-const moment = require('moment');
-const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
-const { ObjectId } = require('mongoose').Types;
-// 高企政策服务表
-const policy = {
-  user_id: { type: ObjectId },
-  type: { type: String }, // 研发补贴,奖励兑现
-  company: { type: String }, // 申请单位
-  apply_personal: { type: String }, // 申请人
-  phone: { type: String }, // 联系电话
-  qyfr: { type: Array }, // 法人复印件
-  yyzz: { type: Array }, // 企业营业执照
-  qylr: { type: Array }, // 企业利润表
-  desc: { type: String }, //  建议
-  status: { type: String, default: '0' }, // 0:申请;1:通过;2拒绝
-
-  remark: { type: String },
-  create_time: { type: String, default: moment(new Date()).format('YYYY-MM-DD HH:mm:ss') },
-};
-const schema = new Schema(policy, { toJSON: { virtuals: true } });
-schema.index({ id: 1 });
-schema.index({ type: 1 });
-schema.index({ company: 1 });
-schema.index({ phone: 1 });
-schema.index({ 'meta.createdAt': 1 });
-schema.plugin(metaPlugin);
-module.exports = app => {
-  const { mongoose } = app;
-  return mongoose.model('Policy', schema, 'policy');
-};

+ 0 - 29
app/model/ticket.js

@@ -1,29 +0,0 @@
-'use strict';
-const Schema = require('mongoose').Schema;
-const moment = require('moment');
-const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
-const { ObjectId } = require('mongoose').Types;
-// 高企申报表
-const ticket = {
-  user_id: { type: ObjectId }, // 用户id
-  mechanism_id: { type: ObjectId }, // 中介机构id
-  material: { type: Array }, // 审核资料
-  medium_material: { type: Array }, // 中介机构审核资料
-  contract: { type: Array }, // 合同
-  status: { type: String, default: '0' },
-  // 0-初审;
-  // 1-初审通过(企业,中介上传合同);-1-初审失败;
-  // 2-高企申报成功;-2:高企申报失败
-  remark: { type: String },
-  create_time: { type: String, default: moment(new Date()).format('YYYY-MM-DD HH:mm:ss') },
-};
-const schema = new Schema(ticket, { toJSON: { virtuals: true } });
-schema.index({ id: 1 });
-schema.index({ status: 1 });
-schema.index({ user_id: 1 });
-schema.index({ 'meta.createdAt': 1 });
-schema.plugin(metaPlugin);
-module.exports = app => {
-  const { mongoose } = app;
-  return mongoose.model('Ticket', schema, 'ticket');
-};

+ 0 - 24
app/model/ticket_record.js

@@ -1,24 +0,0 @@
-'use strict';
-const Schema = require('mongoose').Schema;
-const moment = require('moment');
-const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
-const { ObjectId } = require('mongoose').Types;
-// 创新劵审核记录表
-const ticket_record = {
-  ticket_id: { type: ObjectId },
-  opera_id: { type: ObjectId }, // 审核人
-  status: { type: String }, // 改变为的状态
-  desc: { type: String }, // 建议
-  remark: { type: String },
-  create_time: { type: String, default: moment(new Date()).format('YYYY-MM-DD HH:mm:ss') },
-};
-const schema = new Schema(ticket_record, { toJSON: { virtuals: true } });
-schema.index({ id: 1 });
-schema.index({ ticket_id: 1 });
-schema.index({ status: 1 });
-schema.index({ 'meta.createdAt': 1 });
-schema.plugin(metaPlugin);
-module.exports = app => {
-  const { mongoose } = app;
-  return mongoose.model('Ticket_record', schema, 'ticket_record');
-};

+ 0 - 6
app/router.js

@@ -10,16 +10,10 @@ module.exports = app => {
   require('./router/news')(app); // 新闻
   require('./router/product')(app); // 产品
   require('./router/patent')(app); // 专利
-  require('./router/road_show')(app); // 路演
   require('./router/expert')(app); // 专家
-  require('./router/admin')(app); // 管理员
-  require('./router/organization')(app); // 企业
   require('./router/mechanism')(app); // 机构
   require('./router/online')(app); // 在线
   require('./router/code')(app); // 字典表
-  require('./router/policy')(app); // 高企服务
-  require('./router/ticket')(app); // 创新券
-  require('./router/ticket_record')(app); // 创新券
   require('./router/statistics')(app); // 统计
   require('./router/open_info')(app); // 公开信息
 };

+ 0 - 11
app/router/admin.js

@@ -1,11 +0,0 @@
-'use strict';
-
-
-module.exports = app => {
-  const { router, controller } = app;
-  const prefix = 'admin';
-  router.post(prefix, `/${prefix}/login`, controller[prefix].login);
-  router.post(prefix, `/${prefix}/password/:id`, controller[prefix].password);
-  router.resources(prefix, `/${prefix}`, controller[prefix]); // index、create、show、destroy
-  router.post(prefix, `/${prefix}/update/:id`, controller[prefix].update);
-};

+ 0 - 11
app/router/organization.js

@@ -1,11 +0,0 @@
-'use strict';
-
-
-module.exports = app => {
-  const { router, controller } = app;
-  const prefix = 'organization';
-  router.post(prefix, `/${prefix}/login`, controller[prefix].login);
-  router.post(prefix, `/${prefix}/password/:id`, controller[prefix].password);
-  router.resources(prefix, `/${prefix}`, controller[prefix]); // index、create、show、destroy
-  router.post(prefix, `/${prefix}/update/:id`, controller[prefix].update);
-};

+ 0 - 9
app/router/policy.js

@@ -1,9 +0,0 @@
-'use strict';
-
-
-module.exports = app => {
-  const { router, controller } = app;
-  const prefix = 'policy';
-  router.resources(prefix, `/${prefix}`, controller[prefix]); // index、create、show、destroy
-  router.post(prefix, `/${prefix}/update/:id`, controller[prefix].update);
-};

+ 0 - 9
app/router/road_show.js

@@ -1,9 +0,0 @@
-'use strict';
-
-
-module.exports = app => {
-  const { router, controller } = app;
-  const prefix = 'roadShow';
-  router.resources(prefix, `/${prefix}`, controller[prefix]); // index、create、show、destroy
-  router.post(prefix, `/${prefix}/update/:id`, controller[prefix].update);
-};

+ 0 - 10
app/router/ticket.js

@@ -1,10 +0,0 @@
-'use strict';
-
-
-module.exports = app => {
-  const { router, controller } = app;
-  const prefix = 'ticket';
-  router.post(prefix, `/${prefix}/status/:id`, controller[prefix].status);
-  router.resources(prefix, `/${prefix}`, controller[prefix]); // index、create、show、destroy
-  router.post(prefix, `/${prefix}/update/:id`, controller[prefix].update);
-};

+ 0 - 9
app/router/ticket_record.js

@@ -1,9 +0,0 @@
-'use strict';
-
-
-module.exports = app => {
-  const { router, controller } = app;
-  const prefix = 'ticketRecord';
-  router.resources(prefix, `/${prefix}`, controller[prefix]); // index、create、show、destroy
-  router.post(prefix, `/${prefix}/update/:id`, controller[prefix].update);
-};

+ 0 - 58
app/service/admin.js

@@ -1,58 +0,0 @@
-'use strict';
-const { CrudService } = require('naf-framework-mongoose/lib/service');
-const { BusinessError, ErrorCode } = require('naf-core').Error;
-const { ObjectId } = require('mongoose').Types;
-const _ = require('lodash');
-const jwt = require('jsonwebtoken');
-
-
-// 管理员
-class AdminService extends CrudService {
-  constructor(ctx) {
-    super(ctx, 'admin');
-    this.model = this.ctx.model.Admin;
-  }
-  /**
-   * 创建用户
-   * @param {Object} params 用户信息
-   */
-  async create({ passwd, ...data }) {
-    data.passwd = { secret: passwd };
-    const { phone } = data;
-    // 检查手机号
-    const num = await this.model.count({ phone });
-    if (num > 0) throw new BusinessError(ErrorCode.DATA_EXISTED, '已有管理员');
-    const res = await this.model.create(data);
-    return res;
-  }
-  /**
-   * 修改密码
-   * @param {Object} {id,passwd} 用户id和密码
-   */
-  async password({ id, passwd }) {
-    const object = await this.model.findById(id);
-    if (!object) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到用户的信息');
-    object.passwd = { secret: passwd };
-    await object.save();
-  }
-  /**
-   * 管理员登陆
-   * @param {Object} params 登陆信息
-   * @property code_phone code或者是phone
-   * @property passwd 密码
-   */
-  async login({ code_phone, passwd }) {
-    const object = await this.model.findOne({ $or: [{ code: code_phone }, { phone: code_phone }] }, '+passwd');
-    if (!object) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到用户的信息');
-    const { passwd: op } = object;
-    const { secret } = op;
-    if (secret !== passwd) throw new BusinessError(ErrorCode.BAD_PASSWORD, '密码错误');
-    const data = _.omit(JSON.parse(JSON.stringify(object)), [ 'meta', 'passwd', '__v' ]);
-    const { secret: secrets } = this.config.jwt;
-    const token = jwt.sign(data, secrets);
-    return token;
-  }
-
-}
-
-module.exports = AdminService;

+ 0 - 66
app/service/organization.js

@@ -1,66 +0,0 @@
-'use strict';
-const { CrudService } = require('naf-framework-mongoose/lib/service');
-const { BusinessError, ErrorCode } = require('naf-core').Error;
-const _ = require('lodash');
-const jwt = require('jsonwebtoken');
-// 机构
-class OrganizationService extends CrudService {
-  constructor(ctx) {
-    super(ctx, 'organization');
-    this.redis = this.app.redis;
-    this.model = this.ctx.model.Organization;
-  }
-  /**
-   * 创建用户
-   * @param {Object} params 用户信息
-   */
-  async create({ passwd, ...data }) {
-    data.passwd = { secret: passwd };
-    const { institution_code } = data;
-    // 检查是否重复
-    const num = await this.model.count({ institution_code, isdel: '0' });
-    if (num > 0) throw new BusinessError(ErrorCode.DATA_EXISTED, '已有个企业使用该 统一社会信用代码');
-    return await this.model.create(data);
-  }
-  /**
-   * 修改密码
-   * @param {Object} {id,passwd} 用户id和密码
-   */
-  async password({ id, passwd }) {
-    const object = await this.model.findById(id);
-    if (!object) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到用户的信息');
-    object.passwd = { secret: passwd };
-    await object.save();
-  }
-  /**
-   * 登陆
-   * @param {Object} params 登陆信息
-   * @property institution_code 手机号
-   * @property passwd 密码
-   */
-  async login({ institution_code, passwd }) {
-    const object = await this.model.findOne({ institution_code, isdel: '0' }, '+passwd');
-    if (!object) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到用户的信息');
-    const { passwd: op, status } = object;
-    const { secret } = op;
-    if (status !== '1') throw new BusinessError(ErrorCode.ACCESS_DENIED, '拒绝访问!');
-    if (secret !== passwd) throw new BusinessError(ErrorCode.BAD_passwd, '密码错误');
-    const data = _.omit(JSON.parse(JSON.stringify(object)), [ 'meta', 'passwd', '__v' ]);
-    const { secret: secrets } = this.config.jwt;
-    const token = jwt.sign(data, secrets);
-    // 记录登陆
-    // let number = await this.redis.get('login_number') || 0;
-    // number++;
-    // await this.redis.set('login_number', number);
-    return token;
-  }
-
-  async delete({ id }) {
-    const object = await this.model.findById(id);
-    if (!object) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到用户的信息');
-    object.isdel = '1';
-    await object.save();
-  }
-}
-
-module.exports = OrganizationService;

+ 0 - 15
app/service/policy.js

@@ -1,15 +0,0 @@
-'use strict';
-const { CrudService } = require('naf-framework-mongoose/lib/service');
-const { BusinessError, ErrorCode } = require('naf-core').Error;
-const _ = require('lodash');
-const assert = require('assert');
-
-// 高企政策
-class PolicyService extends CrudService {
-  constructor(ctx) {
-    super(ctx, 'policy');
-    this.model = this.ctx.model.Policy;
-  }
-}
-
-module.exports = PolicyService;

+ 0 - 16
app/service/road_show.js

@@ -1,16 +0,0 @@
-'use strict';
-const { CrudService } = require('naf-framework-mongoose/lib/service');
-const { BusinessError, ErrorCode } = require('naf-core').Error;
-const { ObjectId } = require('mongoose').Types;
-const _ = require('lodash');
-const assert = require('assert');
-
-// 项目路演
-class Road_showService extends CrudService {
-  constructor(ctx) {
-    super(ctx, 'road_show');
-    this.model = this.ctx.model.RoadShow;
-  }
-}
-
-module.exports = Road_showService;

+ 4 - 2
app/service/statistics.js

@@ -80,11 +80,12 @@ class IndexService extends CrudService {
    * 统计用户(企业,专家,机构)数量
    */
   async users() {
-    const org = await this.orgModel.count({ status: '1' });
+    // 去live中找企业用户了
+    // const org = await this.orgModel.count({ status: '1' });
     const expert = await this.expertModel.count({ status: '1' });
     const mech = await this.mechanismModel.count({ status: '1' });
     const arr = [];
-    arr.push({ name: '企业用户', value: org });
+    // arr.push({ name: '企业用户', value: org });
     arr.push({ name: '专家用户', value: expert });
     arr.push({ name: '机构用户', value: mech });
     return arr;
@@ -93,6 +94,7 @@ class IndexService extends CrudService {
    * 统计各种数据
    */
   async data() {
+    // 弃用
     // 高企政策服务通过数量 1
     const policy = await this.policyModel.count({ status: '1' });
     // 创新券领取成果数量 4

+ 0 - 66
app/service/ticket.js

@@ -1,66 +0,0 @@
-'use strict';
-const { CrudService } = require('naf-framework-mongoose/lib/service');
-const { BusinessError, ErrorCode } = require('naf-core').Error;
-const _ = require('lodash');
-const assert = require('assert');
-const { ObjectId } = require('mongoose').Types;
-
-// 高企申报
-class TicketService extends CrudService {
-  constructor(ctx) {
-    super(ctx, 'ticket');
-    this.model = this.ctx.model.Ticket;
-    this.record = this.ctx.model.TicketRecord;
-  }
-
-  async query({ skip = 0, limit = 0, ...query } = {}) {
-    const nquery = _.omit(query, [ 'name' ]);
-    if (nquery.user_id) nquery.user_id = ObjectId(nquery.user_id);
-    if (nquery.mechanism_id) nquery.mechanism_id = ObjectId(nquery.mechanism_id);
-    const arr = [
-      { $match: nquery },
-      {
-        $lookup: {
-          from: 'organization',
-          localField: 'user_id',
-          foreignField: '_id',
-          as: 'company',
-        },
-      },
-      { $unwind: '$company' },
-      { $addFields: { name: '$company.name' } },
-      { $project: { _id: 1, name: 1, meta: 1, status: 1 } },
-    ];
-    if (_.get(query, 'name')) {
-      arr.push({ $match: { name: new RegExp(_.get(query, 'name')) } });
-    }
-    let res = await this.model.aggregate(arr);
-    const total = res.length;
-    if (limit && limit !== '0') {
-      res = _.slice(res, parseInt(skip), parseInt(limit));
-    }
-    return { data: res, total };
-  }
-
-  async fetch({ id }) {
-    let res = await this.model.findById(id);
-    if (!res) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到指定数据');
-    res = JSON.parse(JSON.stringify(res));
-    const { user_id } = res;
-    if (user_id) {
-      const company = await this.ctx.model.Organization.findById(user_id);
-      if (company) res.name = company.name;
-    }
-    return res;
-  }
-
-  async status({ id }, body) {
-    const { status } = body;
-    await this.model.updateOne({ _id: id }, { status });
-    // TODO,添加记录
-    body.ticket_id = id;
-    await this.record.create(body);
-  }
-}
-
-module.exports = TicketService;

+ 0 - 15
app/service/ticket_record.js

@@ -1,15 +0,0 @@
-'use strict';
-const { CrudService } = require('naf-framework-mongoose/lib/service');
-const { BusinessError, ErrorCode } = require('naf-core').Error;
-const _ = require('lodash');
-const assert = require('assert');
-
-//
-class Ticket_recordService extends CrudService {
-  constructor(ctx) {
-    super(ctx, 'ticket_record');
-    this.model = this.ctx.model.TicketRecord;
-  }
-}
-
-module.exports = Ticket_recordService;