明树Git Lab

Commit 197ccad1 authored by zengfanpei's avatar zengfanpei

update

parent 27254597
......@@ -3,4 +3,5 @@ node_modules/
package-lock.json
.vscode
test/
test.js
public/avatar
\ No newline at end of file
......@@ -89,9 +89,10 @@ const collectInsectPestSituationSchema = new Schema({
comment: "上一次标注后的图片(压缩后)",
},
/* 图片识别结果 */
/* 识别结果 不管哪一种形式,只要结果确认有效则写入,为空则表示此条数据无效,后续需要根据业务定期处理这类数据 */
cameraRecognition: {
type: String
type: String,
default: null,
},
createdAt: {
......
let curDate = new Date();
let curDateStr = curDate.getFullYear() + "" + String(curDate.getMonth() + 1).padStart(2, '0') + "" + curDate.getDate();
module.exports = {
apps: [{
name: "letian",
script: 'server.js',
watch: true,
ignore_watch: ['node_modules', 'logs'],
env_dev: {
NODE_ENV: "dev"
},
log_date_format: "YYYY-MM-DD HH:mm:ss",
out_file: `logs/${curDateStr}.log`,
error_file: `logs/${curDateStr}.log`,
}]
};
This diff is collapsed.
const axios = require('axios');
const requestLogModule = require("../module/requestLogModule");
async function httpRequest ({url, method, data, params, headers, responseType}) {
console.log(`${url}, ${JSON.stringify(data)}, ${JSON.stringify(params)}`)
async function httpRequest ({url, method, data, params, headers = {}, responseType}) {
try {
let opt = {
url,
......@@ -18,11 +17,13 @@ async function httpRequest ({url, method, data, params, headers, responseType})
requestLogModule.createRequestLog({
url,
method,
params: JSON.stringify(params) + JSON.stringify(data),
params: JSON.stringify(params) + JSON.stringify((headers["Content-Type"] == "mutipart/form-data" ? "" : data)),
headers: JSON.stringify(headers),
type: "device",
status: ret && ret.status,
result: JSON.stringify(ret.data)
result: responseType == 'stream' ? "" : JSON.stringify(ret.data)
}).catch(error => {
console.log(error);
});
if(ret && ret.status == 200) {
......@@ -36,10 +37,12 @@ async function httpRequest ({url, method, data, params, headers, responseType})
requestLogModule.createRequestLog({
url,
method,
params: JSON.stringify(params) + JSON.stringify(data),
params: JSON.stringify(params) + JSON.stringify((headers["Content-Type"] == "mutipart/form-data" ? "" : data)),
headers: JSON.stringify(headers),
type: "device",
msg: error.message,
}).catch(error => {
console.log(error);
});
return {data: null, status: false};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment