Browse Source

✨ feat: 更新账号时获取路径数据

Pchen. 7 months ago
parent
commit
e49849ca44
1 changed files with 19 additions and 1 deletions
  1. 19 1
      apis/Lepao/Account/UpdateAccount.js

+ 19 - 1
apis/Lepao/Account/UpdateAccount.js

@@ -9,8 +9,9 @@ const { BaseStdResponse } = require("../../../BaseStdResponse.js")
 // 客户端上传数据接口
 // 客户端上传数据接口
 class UpdateAccount extends API {
 class UpdateAccount extends API {
     constructor() {
     constructor() {
-        super();
+        super()
 
 
+        this.runpy = config.runpy
         this.noEncrypt()
         this.noEncrypt()
         this.setPath('/Lepao/UpdateAccount')
         this.setPath('/Lepao/UpdateAccount')
         this.setMethod('POST')
         this.setMethod('POST')
@@ -96,6 +97,23 @@ class UpdateAccount extends API {
                     lepao.beginLepao(findRows[0].create_user, student_num, token, uid, school_id, 1)
                     lepao.beginLepao(findRows[0].create_user, student_num, token, uid, school_id, 1)
                 }
                 }
             }
             }
+
+            // 获取新加账号中存在的路径
+            try {
+                let sql = 'SELECT id FROM lepao_record WHERE lepao_account = ?'
+                let rows = await db.query(sql, [student_num])
+
+                // 不是老帐号就不获取
+                if (!rows || rows.length !== 0) return
+
+                const reqData = { uid, token, school_id, student_id: student_num }
+                this.logger.info(`开始请求获取跑步记录 uid=${uid} student_id=${student_num}`)
+                const recordUrl = this.runpy + '/get_path_data'
+                await axios.post(recordUrl, reqData)
+            } catch (error) {
+                this.logger.info(`获取跑步记录出错 ${error.stack}`)
+            }
+
         } catch (error) {
         } catch (error) {
             this.logger.error(`更新用户信息时出错。${error.stack}`)
             this.logger.error(`更新用户信息时出错。${error.stack}`)
             return res.json({
             return res.json({