|
|
@@ -79,12 +79,13 @@ class Worker {
|
|
|
const m = String(msg || '')
|
|
|
return (
|
|
|
m.includes('已乐跑成功') ||
|
|
|
+ m.includes('已存在成功跑步记录') ||
|
|
|
m.includes('不在有效乐跑时间范围内') ||
|
|
|
m.includes('登录已过期') ||
|
|
|
m.includes('登录信息失效') ||
|
|
|
m.includes('登录失效') ||
|
|
|
m.includes('登录状态异常') ||
|
|
|
- m.includes('已达上限') ||
|
|
|
+ m.includes('已达到上限') ||
|
|
|
m.includes('次数不足') ||
|
|
|
m.includes('请重新登录')
|
|
|
)
|
|
|
@@ -1261,7 +1262,7 @@ class Worker {
|
|
|
|
|
|
/* ---------------- 上传 OSS 文件 ---------------- */
|
|
|
this.register('lepao.uploadOssFile', async (req, ctx) => {
|
|
|
- const { pathData, newPathData, ossSts: sts } = req
|
|
|
+ const { account, pathData, newPathData, ossSts: sts } = req
|
|
|
|
|
|
// 处理跑步路径
|
|
|
const pathResult = dataEncrypt(JSON.stringify(newPathData))
|
|
|
@@ -1291,6 +1292,34 @@ class Worker {
|
|
|
}
|
|
|
|
|
|
const now = new Date()
|
|
|
+ let day = now.getDay()
|
|
|
+ if (day === 0) day = 7
|
|
|
+
|
|
|
+ // 判断当天是否有成功记录
|
|
|
+ if(!ruleData?.weekData?.list || ruleData?.weekData?.list?.length !== 7) {
|
|
|
+ const err = new Error('获取当天跑步记录失败,请联系客服或稍后再试')
|
|
|
+ err.code = 'DAILY_RECORD_FETCH_FAILED'
|
|
|
+ err.retryable = false
|
|
|
+ throw err
|
|
|
+ }
|
|
|
+
|
|
|
+ const weekData = ruleData?.weekData?.list[day - 1]
|
|
|
+ if (!weekData) {
|
|
|
+ const err = new Error('获取当天跑步记录失败,请联系客服或稍后再试')
|
|
|
+ err.code = 'DAILY_RECORD_FETCH_FAILED'
|
|
|
+ err.retryable = false
|
|
|
+ throw err
|
|
|
+ }
|
|
|
+
|
|
|
+ if(Number(weekData?.distance) > 1.6) {
|
|
|
+ this.logger.warn(`${account}当天已存在成功跑步记录,距离:${weekData?.distance}km,请勿重复跑步`)
|
|
|
+ await this.writeSuccessRedis(account)
|
|
|
+ const err = new Error('当天已存在成功跑步记录,请勿重复跑步')
|
|
|
+ err.code = 'DAILY_ALREADY_COMPLETED'
|
|
|
+ err.retryable = false
|
|
|
+ throw err
|
|
|
+ }
|
|
|
+
|
|
|
const yyyy = now.getFullYear()
|
|
|
const mm = String(now.getMonth() + 1).padStart(2, '0')
|
|
|
const dd = String(now.getDate()).padStart(2, '0')
|