Browse Source

修复无法获取跑步数据的bug

Pchen0 11 months ago
parent
commit
75ac3ebc42
1 changed files with 3 additions and 5 deletions
  1. 3 5
      lib/Lepao/Lepao.js

+ 3 - 5
lib/Lepao/Lepao.js

@@ -55,14 +55,14 @@ class Lepao {
         try {
         try {
             const reqData = { uid, token, school_id, student_id }
             const reqData = { uid, token, school_id, student_id }
             const recordUrl = this.runpy + '/get_record'
             const recordUrl = this.runpy + '/get_record'
-            const recordRes = await axios.post(recordUrl, reqData)
-            const { data } = recordRes.data
+            let recordRes = await axios.post(recordUrl, reqData)
+            const { data } = recordRes
             if (!data || data.status !== 1 || !data.data) {
             if (!data || data.status !== 1 || !data.data) {
                 this.logger.info('获取剩余跑步次数失败!')
                 this.logger.info('获取剩余跑步次数失败!')
                 console.log(data)
                 console.log(data)
                 return
                 return
             }
             }
-            return data
+            return data.data
         } catch (error) {
         } catch (error) {
             this.logger.error('获取跑步次数失败!')
             this.logger.error('获取跑步次数失败!')
             console.log(error.stack)
             console.log(error.stack)
@@ -148,8 +148,6 @@ class Lepao {
                 const lepaoRes = await axios.post(lepaoUrl, lepaoData)
                 const lepaoRes = await axios.post(lepaoUrl, lepaoData)
                 const { data } = lepaoRes
                 const { data } = lepaoRes
 
 
-                this.logger.info(data)
-
                 if (!data || data.status !== 1 || !data.data) {
                 if (!data || data.status !== 1 || !data.data) {
                     this.setStatusFail(account)
                     this.setStatusFail(account)
                     throw new Error(data?.info || '未知错误,请尝试重新登录')
                     throw new Error(data?.info || '未知错误,请尝试重新登录')