|
@@ -2,18 +2,18 @@
|
|
|
* @Author: fuyu
|
|
|
* @Date: 2021-03-23 16:25:59
|
|
|
* @LastEditors: fuyu
|
|
|
- * @LastEditTime: 2021-03-28 22:24:17
|
|
|
+ * @LastEditTime: 2021-03-28 22:26:02
|
|
|
* @FilePath: /sql_merge/src/service/log.js
|
|
|
*/
|
|
|
const fs = require('fs')
|
|
|
const path = require('path');
|
|
|
const rootPath = path.join(__dirname, '..', '..', 'logs')
|
|
|
import {getNowDay, getNowTime} from './time'
|
|
|
-export async function logSum(institution_id, count) {
|
|
|
+export async function logSum(institution_id, count, ) {
|
|
|
if(institution_id instanceof Array) {
|
|
|
institution_id = 'all'
|
|
|
}
|
|
|
- const dirPath = path.join(rootPath, 'sum')
|
|
|
+ const dirPath = path.join(rootPath, 'sum', prefix = '')
|
|
|
checkPath(dirPath)
|
|
|
const filePath = path.join(dirPath, getNowDay() + '.log')
|
|
|
const time = getNowTime()
|
|
@@ -21,7 +21,7 @@ export async function logSum(institution_id, count) {
|
|
|
time: time, institution_id, count,
|
|
|
}
|
|
|
fs.appendFileSync(filePath, JSON.stringify(obj) + '\r\n')
|
|
|
- fs.writeFileSync(path.join(dirPath, institution_id + '-' + getNowDay() + '.log'), count + '')
|
|
|
+ fs.writeFileSync(path.join(dirPath, prefix + institution_id + '-' + getNowDay() + '.log'), count + '')
|
|
|
}
|
|
|
export async function logSingle(name) {
|
|
|
checkPath(rootPath)
|