From d87a33f37dab78c58ad3e9843ccf722c07792bbd Mon Sep 17 00:00:00 2001 From: zhangminghua Date: Wed, 28 Dec 2022 10:23:02 +0800 Subject: [PATCH] =?UTF-8?q?(*)=E5=91=98=E5=B7=A5=E6=B2=9F=E9=80=9A?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=E6=9A=82?= =?UTF-8?q?=E4=BA=A4=EF=BC=8C=E5=BE=85=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/employeeCommunicate/index.js | 31 +++++++++++++++++++ .../lib/routes/employeeCommunicate/index.js | 9 ++++++ 2 files changed, 40 insertions(+) create mode 100644 api/app/lib/controllers/employeeCommunicate/index.js create mode 100644 api/app/lib/routes/employeeCommunicate/index.js diff --git a/api/app/lib/controllers/employeeCommunicate/index.js b/api/app/lib/controllers/employeeCommunicate/index.js new file mode 100644 index 0000000..8c39ac4 --- /dev/null +++ b/api/app/lib/controllers/employeeCommunicate/index.js @@ -0,0 +1,31 @@ +'use strict'; +const fs = require('fs'); +const moment = require('moment'); +/** + * 查询员工沟通统计数据 + * @param {*} ctx ctx ctx.query:{keywordTarget-关键字项、keyword-关键字内容、limit-页宽, page-页码} + */ + async function get(ctx) { + try { + const { models } = ctx.fs.dc; + const { keywordTarget, keyword, entryTime, limit, page } = ctx.query; + const where = {}; + + let employeeCommunicate = await models.EmployeeCommunicate.findAndCountAll({ + where: where, + offset: Number(page) * Number(limit), + limit: Number(limit), + order: [['id', 'ASC']] + }); + ctx.status = 200 + ctx.body = employeeCommunicate; + } catch (error) { + ctx.fs.logger.error(`path:${ctx.path},error:${error}`) + ctx.status = 400; + ctx.body = { name: 'FindError', message: '查询员工沟通统计数据失败' } + } +} + +module.exports = { + get +} \ No newline at end of file diff --git a/api/app/lib/routes/employeeCommunicate/index.js b/api/app/lib/routes/employeeCommunicate/index.js new file mode 100644 index 0000000..6e22f08 --- /dev/null +++ b/api/app/lib/routes/employeeCommunicate/index.js @@ -0,0 +1,9 @@ +'use strict'; + +const employeeCommunicate = require('../../controllers/employeeCommunicate'); + +module.exports = function (app, router, opts) { + + app.fs.api.logAttr['GET/employee/communicate/list'] = { content: '查询员工沟通统计数据', visible: true }; + router.get('/employee/communicate/list', employeeCommunicate.get); +}; \ No newline at end of file