Browse Source

冲突

master
wenlele 2 years ago
parent
commit
6bab1fe165
  1. 144
      api/app/lib/controllers/projectRegime/projectSituation.js
  2. 8
      web/Dockerfile
  3. 121
      web/log/development.txt

144
api/app/lib/controllers/projectRegime/projectSituation.js

@ -243,78 +243,78 @@ async function qrCodeShow (ctx, next) {
async function q(ctx) { async function q(ctx) {
let error = { // let error = {
name: 'FindError', // name: 'FindError',
message: "获取失败!" // message: "获取失败!"
}; // };
const models = ctx.fs.dc.models; // const models = ctx.fs.dc.models;
const { devices } = ctx.request.body // const { devices } = ctx.request.body
const attachment = ctx.app.fs.qn_attachment // const attachment = ctx.app.fs.qn_attachment
try { // try {
if (!Array.isArray(devices)) { // if (!Array.isArray(devices)) {
error = { name: 'paramsError', message: '参数不能为空' }; // error = { name: 'paramsError', message: '参数不能为空' };
ctx.throw(400); // ctx.throw(400);
} // }
const devicesArr = await models.Device.findAll({ // const devicesArr = await models.Device.findAll({
attributes: ['deviceNo', 'periodCode', 'qrSrc'], // attributes: ['deviceNo', 'periodCode', 'qrSrc'],
where: { deviceNo: { $in: devices } } // where: { deviceNo: { $in: devices } }
}) // })
let ids = [], idsMap = {}, qnImages = [] // let ids = [], idsMap = {}, qnImages = []
devicesArr.forEach(d => { // devicesArr.forEach(d => {
const qrSrc = d.qrSrc // const qrSrc = d.qrSrc
const deviceNo = d.deviceNo // const deviceNo = d.deviceNo
const periodCode = d.periodCode // const periodCode = d.periodCode
if (qrSrc) { // if (qrSrc) {
if (/^\d+$/.test(qrSrc)) { // if (/^\d+$/.test(qrSrc)) {
ids.push(qrSrc) // ids.push(qrSrc)
idsMap[qrSrc] = { deviceNo, periodCode } // idsMap[qrSrc] = { deviceNo, periodCode }
} else { // } else {
let domain = globalCache.getQnDomain() // let domain = globalCache.getQnDomain()
let imgUrl = `${domain}/${qrSrc}` // let imgUrl = `${domain}/${qrSrc}`
qnImages.push({ src: imgUrl, deviceNo, periodCode }) // qnImages.push({ src: imgUrl, deviceNo, periodCode })
} // }
} // }
}) // })
const docs = await models.QrcodePng.findAll({ // const docs = await models.QrcodePng.findAll({
where: { // where: {
id: { $in: ids } // id: { $in: ids }
}, // },
attributes: ["id", "base64"] // attributes: ["id", "base64"]
}) // })
let pics = [] // let pics = []
if (docs.length > 0) { // if (docs.length > 0) {
pics = docs.map((d) => { // pics = docs.map((d) => {
let { deviceNo, periodCode } = idsMap[d.id] || {} // let { deviceNo, periodCode } = idsMap[d.id] || {}
let base64 = d.base64.replace(/^data:image\/\w+;base64,/, '') // let base64 = d.base64.replace(/^data:image\/\w+;base64,/, '')
return { // return {
url: Buffer.from(base64, 'base64'), // url: Buffer.from(base64, 'base64'),
name: deviceNo, // name: deviceNo,
periodCode // periodCode
} // }
}) // })
} // }
if (qnImages.length > 0) { // if (qnImages.length > 0) {
let qns = await downloadImgsAsBase64(qnImages) // let qns = await downloadImgsAsBase64(qnImages)
pics = pics.concat(qns) // pics = pics.concat(qns)
} // }
let fileUrl = await downLoadImageBiz(pics, { zipName: "二维码_" + moment().format("YYYY-MM-DD-HH-mm-ss"), attachment }) // let fileUrl = await downLoadImageBiz(pics, { zipName: "二维码_" + moment().format("YYYY-MM-DD-HH-mm-ss"), attachment })
add2CleanCache(fileUrl, attachment) // add2CleanCache(fileUrl, attachment)
ctx.status = 200 // ctx.status = 200
ctx.body = { fileUrl } // ctx.body = { fileUrl }
} catch (err) { // } catch (err) {
ctx.fs.logger.error(err); // ctx.fs.logger.error(err);
ctx.status = 400; // ctx.status = 400;
ctx.body = error; // ctx.body = error;
} // }
} }
module.exports = { module.exports = {

8
web/Dockerfile

@ -1,12 +1,12 @@
FROM repository.anxinyun.cn/base-images/nodejs12:20.10.12.2
#FROM repository.anxinyun.cn/base-images/nodejs12:20.10.12.2
FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12
COPY . /var/app COPY . /var/app
WORKDIR /var/app WORKDIR /var/app
EXPOSE 8080 EXPOSE 8080
RUN npm config set registry=http://10.8.30.22:7000 RUN npm config set registry=http://10.8.30.22:7000
RUN npm cache clean -f RUN npm cache clean -f
RUN npm install -g node-gyp #RUN npm install -g node-gyp
#RUN rm -rf package-lock.json #RUN rm -rf package-lock.json
RUN npm install --registry http://10.8.30.22:7000 RUN npm install --registry http://10.8.30.22:7000
RUN npm run build RUN npm run build

121
web/log/development.txt

@ -4180,3 +4180,124 @@
2023-01-16 20:44:31.875 - debug: [FS-LOGGER] Init. 2023-01-16 20:44:31.875 - debug: [FS-LOGGER] Init.
2023-01-16 20:44:31.879 - debug: init fs.attachment and inject it into app(app.fs.attachment) and runtime ctx(ctx.fs.attachment) 2023-01-16 20:44:31.879 - debug: init fs.attachment and inject it into app(app.fs.attachment) and runtime ctx(ctx.fs.attachment)
2023-01-16 20:44:32.175 - info: [Router] Inject api: attachment/index 2023-01-16 20:44:32.175 - info: [Router] Inject api: attachment/index
2023-01-17 09:24:10.150 - error: [FS-ERRHD]
{
message: 'Error: connect ECONNREFUSED 127.0.0.1:4900',
name: 'RequestError',
cause: {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 4900
},
error: { '$ref': '$["cause"]' },
options: {
jar: false,
url: 'http://127.0.0.1:4900/projectList?token=01c8ff18-8aa8-4027-9021-b618f5935c09&limit=10&page=0',
headers: {
host: '127.0.0.1:4900',
connection: 'keep-alive',
'sec-ch-ua': '"Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"',
expires: '-1',
'cache-control': 'no-cache,no-store,must-revalidate,max-age=-1,private',
'x-requested-with': 'XMLHttpRequest',
'sec-ch-ua-mobile': '?0',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
'sec-ch-ua-platform': '"Windows"',
accept: '*/*',
'sec-fetch-site': 'same-origin',
'sec-fetch-mode': 'cors',
'sec-fetch-dest': 'empty',
referer: 'http://localhost:5900/projectRegime/information',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'zh-CN,zh;q=0.9'
},
encoding: null,
followRedirect: true,
method: 'GET',
body: '[object Object]',
simple: false,
resolveWithFullResponse: true,
callback: [Function: RP$callback],
transform: undefined,
transform2xxOnly: false
},
response: undefined,
stack: 'RequestError: Error: connect ECONNREFUSED 127.0.0.1:4900\n' +
' at new RequestError (C:\\Users\\方式、\\Desktop\\Inspection\\web\\node_modules\\request-promise-core\\lib\\errors.js:14:15)\n' +
' at Request.plumbing.callback (C:\\Users\\方式、\\Desktop\\Inspection\\web\\node_modules\\request-promise-core\\lib\\plumbing.js:87:29)\n' +
' at Request.RP$callback [as _callback] (C:\\Users\\方式、\\Desktop\\Inspection\\web\\node_modules\\request-promise-core\\lib\\plumbing.js:46:31)\n' +
' at self.callback (C:\\Users\\方式、\\Desktop\\Inspection\\web\\node_modules\\request\\request.js:185:22)\n' +
' at Request.emit (events.js:314:20)\n' +
' at Request.onRequestError (C:\\Users\\方式、\\Desktop\\Inspection\\web\\node_modules\\request\\request.js:877:8)\n' +
' at ClientRequest.emit (events.js:314:20)\n' +
' at Socket.socketErrorListener (_http_client.js:427:9)\n' +
' at Socket.emit (events.js:314:20)\n' +
' at emitErrorNT (internal/streams/destroy.js:92:8)\n' +
' at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)\n' +
' at processTicksAndRejections (internal/process/task_queues.js:84:21)'
}
2023-01-17 11:00:38.475 - error: [FS-ERRHD]
{
message: 'Error: connect ECONNREFUSED 127.0.0.1:4900',
name: 'RequestError',
cause: {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 4900
},
error: { '$ref': '$["cause"]' },
options: {
jar: false,
url: 'http://127.0.0.1:4900/projectList?token=01c8ff18-8aa8-4027-9021-b618f5935c09&limit=10&page=0',
headers: {
host: '127.0.0.1:4900',
connection: 'keep-alive',
'sec-ch-ua': '"Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"',
expires: '-1',
'cache-control': 'no-cache,no-store,must-revalidate,max-age=-1,private',
'x-requested-with': 'XMLHttpRequest',
'sec-ch-ua-mobile': '?0',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
'sec-ch-ua-platform': '"Windows"',
accept: '*/*',
'sec-fetch-site': 'same-origin',
'sec-fetch-mode': 'cors',
'sec-fetch-dest': 'empty',
referer: 'http://localhost:5900/projectRegime/information',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'zh-CN,zh;q=0.9'
},
encoding: null,
followRedirect: true,
method: 'GET',
body: '[object Object]',
simple: false,
resolveWithFullResponse: true,
callback: [Function: RP$callback],
transform: undefined,
transform2xxOnly: false
},
response: undefined,
stack: 'RequestError: Error: connect ECONNREFUSED 127.0.0.1:4900\n' +
' at new RequestError (C:\\Users\\方式、\\Desktop\\Inspection\\web\\node_modules\\request-promise-core\\lib\\errors.js:14:15)\n' +
' at Request.plumbing.callback (C:\\Users\\方式、\\Desktop\\Inspection\\web\\node_modules\\request-promise-core\\lib\\plumbing.js:87:29)\n' +
' at Request.RP$callback [as _callback] (C:\\Users\\方式、\\Desktop\\Inspection\\web\\node_modules\\request-promise-core\\lib\\plumbing.js:46:31)\n' +
' at self.callback (C:\\Users\\方式、\\Desktop\\Inspection\\web\\node_modules\\request\\request.js:185:22)\n' +
' at Request.emit (events.js:314:20)\n' +
' at Request.onRequestError (C:\\Users\\方式、\\Desktop\\Inspection\\web\\node_modules\\request\\request.js:877:8)\n' +
' at ClientRequest.emit (events.js:314:20)\n' +
' at Socket.socketErrorListener (_http_client.js:427:9)\n' +
' at Socket.emit (events.js:314:20)\n' +
' at emitErrorNT (internal/streams/destroy.js:92:8)\n' +
' at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)\n' +
' at processTicksAndRejections (internal/process/task_queues.js:84:21)'
}
2023-01-17 11:01:32.542 - info: extNames
[
'/_file-server/project/e0bd9eaf-e4b9-4e85-aed9-77c668dbb92a/1',
'jpg'
]

Loading…
Cancel
Save