|
@@ -13,6 +13,7 @@ const {
|
|
|
selectCheckpoints,
|
|
selectCheckpoints,
|
|
|
generateCadence
|
|
generateCadence
|
|
|
} = require('../../plugin/Lepao/Path')
|
|
} = require('../../plugin/Lepao/Path')
|
|
|
|
|
+const { v4: uuidv4 } = require('uuid')
|
|
|
const {
|
|
const {
|
|
|
dataEncrypt,
|
|
dataEncrypt,
|
|
|
dataDecrypt,
|
|
dataDecrypt,
|
|
@@ -142,12 +143,14 @@ class Worker {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- async addLepaoRecord(uuid, account, result, pathId, pointData) {
|
|
|
|
|
|
|
+ async addLepaoRecord(uuid, account, result, pathId, pointData, runMode = 'auto') {
|
|
|
if (!uuid || !account || !result || !pathId) return
|
|
if (!uuid || !account || !result || !pathId) return
|
|
|
try {
|
|
try {
|
|
|
const time = Date.now()
|
|
const time = Date.now()
|
|
|
- const sql = 'INSERT INTO lepao_record (uuid, time, lepao_account, result, path_id, point_data, state) VALUES (?, ?, ?, ?, ?, ?, ?)'
|
|
|
|
|
- await db.query(sql, [uuid, time, account, result, pathId, JSON.stringify(pointData || []), 1])
|
|
|
|
|
|
|
+ const publicId = uuidv4()
|
|
|
|
|
+ const safeRunMode = runMode === 'manual' ? 'manual' : 'auto'
|
|
|
|
|
+ const sql = 'INSERT INTO lepao_record (public_id, uuid, time, lepao_account, result, path_id, point_data, state, run_mode) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)'
|
|
|
|
|
+ await db.query(sql, [publicId, uuid, time, account, result, pathId, JSON.stringify(pointData || []), 1, safeRunMode])
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
this.logger.error(`写入乐跑记录失败: ${error.stack || error}`)
|
|
this.logger.error(`写入乐跑记录失败: ${error.stack || error}`)
|
|
|
}
|
|
}
|
|
@@ -564,7 +567,7 @@ class Worker {
|
|
|
|
|
|
|
|
// 绑定接口有返回即入库
|
|
// 绑定接口有返回即入库
|
|
|
if (bindRes && bindRes.data) {
|
|
if (bindRes && bindRes.data) {
|
|
|
- await this.addLepaoRecord(userData?.create_user, req.account, bindRes.data, pathId, pointData)
|
|
|
|
|
|
|
+ await this.addLepaoRecord(userData?.create_user, req.account, bindRes.data, pathId, pointData, req.runMode)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const runResult = this.isRunSuccess(bindRes)
|
|
const runResult = this.isRunSuccess(bindRes)
|