const fs = require('fs') const path = require('path') const moment = require('moment') const store = require('../../config.json') const env = require('./env.js') let timeLog = path.join(__dirname, '../../logs/time.log') let syncTime = {} if (fs.existsSync(path.join(__dirname, '../../logs/time.log'))) { try { syncTime = JSON.parse(fs.readFileSync(timeLog)) } catch (err) { syncTime = {} } } store['syncTime'] = syncTime store['upyun'] = { operator: 'qmth', password: 'qmth123456' } module.exports = store; module.exports.updateSyncTime = function () { if (env.server && env.exam) { syncTime[env.server.host + '_' + env.exam.id] = moment().format('YYYY-MM-DD HH:mm:ss') store['syncTime'] = syncTime fs.writeFileSync(timeLog, JSON.stringify(syncTime)) } }