|
@@ -56,9 +56,9 @@ class Lepao {
|
|
|
return randomPath.id
|
|
return randomPath.id
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- async getRecord(uid, token, school_id, student_id) {
|
|
|
|
|
|
|
+ async getRecord(uid, token, school_id, student_id, userAgent) {
|
|
|
try {
|
|
try {
|
|
|
- const reqData = { uid, token, school_id, student_id }
|
|
|
|
|
|
|
+ const reqData = { uid, token, school_id, student_id, userAgent }
|
|
|
this.logger.info(`开始请求获取跑步次数 uid=${uid} student_id=${student_id}`)
|
|
this.logger.info(`开始请求获取跑步次数 uid=${uid} student_id=${student_id}`)
|
|
|
const recordUrl = this.runpy + '/get_record'
|
|
const recordUrl = this.runpy + '/get_record'
|
|
|
let recordRes = await axios.post(recordUrl, reqData)
|
|
let recordRes = await axios.post(recordUrl, reqData)
|
|
@@ -143,7 +143,12 @@ class Lepao {
|
|
|
run_end_time -= 18000
|
|
run_end_time -= 18000
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const ossData = { uid, token, school_id, student_id: account, random_id: path_id, run_end_time }
|
|
|
|
|
|
|
+ let phoneSql = 'SELECT userAgent, deviceModel FROM lepao_account WHERE student_num = ?'
|
|
|
|
|
+ let phoneData = await db.query(phoneSql, [account])
|
|
|
|
|
+ let userAgent = phoneData && phoneData.length > 0 ? phoneData[0].userAgent : 'Mozilla/5.0 (Linux; Android 16; 2211133C Build/BP2A.250605.031.A3; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/138.0.7204.180 Mobile Safari/537.36 XWEB/1380347 MMWEBSDK/20250202 MMWEBID/1020 wxwork/5.0.6.66174 MicroMessenger/8.0.28.48(0x28001c30) MiniProgramEnv/android Luggage/3.0.2.95ef3f83 NetType/5G Language/zh_CN ABI/arm64'
|
|
|
|
|
+ let deviceModel = phoneData && phoneData.length > 0 ? phoneData[0].deviceModel : '2211133C'
|
|
|
|
|
+
|
|
|
|
|
+ const ossData = { uid, token, school_id, student_id: account, random_id: path_id, run_end_time, userAgent }
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
const zoneRes = await axios.post(zoneUrl, ossData)
|
|
const zoneRes = await axios.post(zoneUrl, ossData)
|
|
@@ -205,7 +210,9 @@ class Lepao {
|
|
|
random_id: path_id,
|
|
random_id: path_id,
|
|
|
record_file: oss_path,
|
|
record_file: oss_path,
|
|
|
run_end_time,
|
|
run_end_time,
|
|
|
- point_data
|
|
|
|
|
|
|
+ point_data,
|
|
|
|
|
+ userAgent,
|
|
|
|
|
+ deviceModel
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
this.logger.info(`${account}乐跑请求参数构造完成:`)
|
|
this.logger.info(`${account}乐跑请求参数构造完成:`)
|
|
@@ -230,7 +237,7 @@ class Lepao {
|
|
|
await this.addRecord(uuid, account, data.data, path_id, point_data)
|
|
await this.addRecord(uuid, account, data.data, path_id, point_data)
|
|
|
|
|
|
|
|
// 获取剩余跑步次数
|
|
// 获取剩余跑步次数
|
|
|
- const recordData = await this.getRecord(uid, token, school_id, account)
|
|
|
|
|
|
|
+ const recordData = await this.getRecord(uid, token, school_id, account, userAgent)
|
|
|
this.logger.info(`${account}获取剩余跑步次数结果: ${JSON.stringify(recordData)}`)
|
|
this.logger.info(`${account}获取剩余跑步次数结果: ${JSON.stringify(recordData)}`)
|
|
|
|
|
|
|
|
let term_num = recordData?.term_num || 0
|
|
let term_num = recordData?.term_num || 0
|