Spaces:
Sleeping
Sleeping
update
Browse files- api_key_sb.py +10 -2
api_key_sb.py
CHANGED
|
@@ -48,7 +48,15 @@ async def update_api_key_ran_at(api_key_id: str, ran_at_time: datetime = None):
|
|
| 48 |
else:
|
| 49 |
current_local_time = ran_at_time.isoformat()
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
except Exception as e:
|
|
|
|
| 54 |
raise HTTPException(status_code=500, detail=f"更新API密钥运行时间失败!错误信息:{str(e)}")
|
|
|
|
| 48 |
else:
|
| 49 |
current_local_time = ran_at_time.isoformat()
|
| 50 |
|
| 51 |
+
print(f"尝试更新 API 密钥 {api_key_id} 的 ran_at 为 {current_local_time}")
|
| 52 |
+
response = supabase.table("airs_api_keys").update({"ran_at": current_local_time}).eq("id", api_key_id).execute()
|
| 53 |
+
print(f'API 密钥 {api_key_id} 的 ran_at 更新成功为 {current_local_time}. Supabase 响应: {response.data}')
|
| 54 |
+
|
| 55 |
+
# 验证更新是否成功
|
| 56 |
+
verification_response = supabase.from_('airs_api_keys').select('ran_at').eq('id', api_key_id).single().execute()
|
| 57 |
+
verified_ran_at = verification_response.data.get('ran_at')
|
| 58 |
+
print(f"验证:API 密钥 {api_key_id} 的实际 ran_at 值为 {verified_ran_at}")
|
| 59 |
+
|
| 60 |
except Exception as e:
|
| 61 |
+
print(f"更新API密钥运行时间失败!错误信息:{str(e)}")
|
| 62 |
raise HTTPException(status_code=500, detail=f"更新API密钥运行时间失败!错误信息:{str(e)}")
|