|
|
@@ -100,7 +100,16 @@ class Lepao {
|
|
|
// 更换跑区
|
|
|
this.logger.info(`${account}开始更换跑区,path_id=${path_id}`)
|
|
|
const zoneUrl = this.runpy + '/set_zone'
|
|
|
- const ossData = { uid, token, school_id, student_id: account, random_id: path_id }
|
|
|
+
|
|
|
+ // 晚上10点后提前
|
|
|
+ let run_end_time = Math.floor(Date.now() / 1000) - 300 // 提前5分钟
|
|
|
+ let hour = new Date().getHours()
|
|
|
+ if (hour >= 22) {
|
|
|
+ this.logger.info(`${account}当前时间为${hour}点,调整run_end_time提前5小时`)
|
|
|
+ run_end_time -= 18000
|
|
|
+ }
|
|
|
+
|
|
|
+ const ossData = { uid, token, school_id, student_id: account, random_id: path_id, run_end_time }
|
|
|
|
|
|
try {
|
|
|
const zoneRes = await axios.post(zoneUrl, ossData)
|
|
|
@@ -124,6 +133,7 @@ class Lepao {
|
|
|
|
|
|
try {
|
|
|
const ossRes = await axios.post(ossUrl, ossData)
|
|
|
+
|
|
|
const { data } = ossRes
|
|
|
this.logger.info(`${account}上传OSS记录返回结果: ${JSON.stringify(data)}`)
|
|
|
if (!data || data.code !== 200 || !data.oss_path) {
|
|
|
@@ -143,14 +153,6 @@ class Lepao {
|
|
|
await db.query(useLepaoCountSql, [uuid])
|
|
|
this.logger.info(`${account}扣减乐跑次数完成`)
|
|
|
|
|
|
- // 晚上10点后提前
|
|
|
- let run_end_time = Math.floor(Date.now() / 1000)
|
|
|
- let hour = new Date().getHours()
|
|
|
- if (hour >= 22) {
|
|
|
- this.logger.info(`${account}当前时间为${hour}点,调整run_end_time提前5小时`)
|
|
|
- run_end_time -= 18000
|
|
|
- }
|
|
|
-
|
|
|
const lepaoData = {
|
|
|
uid,
|
|
|
token,
|