Browse Source

更改女生最短跑步距离

Pchen. 11 months ago
parent
commit
ae847745b1
1 changed files with 10 additions and 5 deletions
  1. 10 5
      lib/Lepao/Lepao.js

+ 10 - 5
lib/Lepao/Lepao.js

@@ -12,15 +12,20 @@ class Lepao {
     }
 
     async getPath(account, vip) {
-        const accountSql = 'SELECT area, max_distance, min_distance FROM lepao_account WHERE student_num = ?'
+        const accountSql = 'SELECT area, max_distance, min_distance, sex FROM lepao_account WHERE student_num = ?'
         const rows = await db.query(accountSql, [account])
         if (!rows || rows.length === 0) {
             throw new Error('无法获取账号数据')
         }
 
-        const { area, max_distance, min_distance } = rows[0]
-        const max = Number(max_distance) || 4.00
-        const min = Number(min_distance) || 2.00
+        const { area, max_distance, min_distance, sex } = rows[0]
+
+        let max = Number(max_distance) || 4.00
+        let min = Number(min_distance) || 2.00
+        if (sex === 2) {
+            max = Number(max_distance) || 4.00
+            min = Number(min_distance) || 1.60
+        }
 
         // if (vip !== 1) {
         //     if (area) throw new Error('指定乐跑跑区为 VIP 专用功能,请先开通 VIP')
@@ -54,7 +59,7 @@ class Lepao {
             if (userPermissionData[0].lepao_count < 1)
                 throw new Error('用户乐跑次数不足,请购买乐跑套餐!')
 
-            if(state !== 1) {
+            if (state !== 1) {
                 return this.sendFailEmail(account, '登录已过期,请尝试使用登录器重新登录')
             }