3rd_fix download
This commit is contained in:
@@ -66,9 +66,13 @@ class User(db.Model):
|
||||
|
||||
def get_total_cost(self):
|
||||
"""計算使用者總成本"""
|
||||
return db.session.query(
|
||||
func.sum(self.api_usage_stats.cost)
|
||||
).scalar() or 0.0
|
||||
try:
|
||||
from app.models.stats import APIUsageStats
|
||||
return db.session.query(
|
||||
func.sum(APIUsageStats.cost)
|
||||
).filter(APIUsageStats.user_id == self.id).scalar() or 0.0
|
||||
except Exception:
|
||||
return 0.0
|
||||
|
||||
def update_last_login(self):
|
||||
"""更新最後登入時間"""
|
||||
|
Reference in New Issue
Block a user