feat((model api key) and app):
fix bug
This commit is contained in:
@@ -203,7 +203,7 @@ class AppStatisticsService:
|
||||
end_date: 结束时间戳(毫秒)
|
||||
|
||||
Returns:
|
||||
统计数据字典
|
||||
每日统计数据列表
|
||||
"""
|
||||
# 将毫秒时间戳转换为 datetime
|
||||
start_time = datetime.fromtimestamp(start_date / 1000)
|
||||
|
||||
@@ -652,10 +652,12 @@ class ModelApiKeyService:
|
||||
@staticmethod
|
||||
def record_api_key_usage(db: Session, api_key_id: uuid.UUID | None) -> bool:
|
||||
"""记录API Key使用"""
|
||||
success = ModelApiKeyRepository.update_usage(db, api_key_id)
|
||||
if success:
|
||||
db.commit()
|
||||
return success
|
||||
if not api_key_id:
|
||||
success = ModelApiKeyRepository.update_usage(db, api_key_id)
|
||||
if success:
|
||||
db.commit()
|
||||
return success
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def get_a_api_key(db: Session, model_config_id: uuid.UUID) -> ModelApiKey:
|
||||
|
||||
Reference in New Issue
Block a user