'commit'
This commit is contained in:
@@ -41,6 +41,29 @@ class TeLaiDianService:
|
||||
async def close_db(self):
|
||||
await self.db.close()
|
||||
|
||||
async def save_station_profile_only(self, station_name, address):
|
||||
if not station_name or not address:
|
||||
return False
|
||||
|
||||
station_hash = self.get_hash(station_name)
|
||||
now = datetime.now()
|
||||
|
||||
async with await self.db.get_session() as session:
|
||||
profile_id = self.generate_id()
|
||||
await self.station_profile_model.save(
|
||||
session=session,
|
||||
id=profile_id,
|
||||
station_hash=station_hash,
|
||||
operator=self.operator,
|
||||
station_name=station_name,
|
||||
address=address,
|
||||
valid_start_time=now
|
||||
)
|
||||
await session.commit()
|
||||
|
||||
logger.info(f"仅保存场站基础信息: {station_name}")
|
||||
return True
|
||||
|
||||
async def save_station_data(self, station_name, address, prices):
|
||||
"""
|
||||
保存场站及其价格数据到数据库
|
||||
|
||||
Reference in New Issue
Block a user