ems-core v1.0.0: Standard EMS platform core
Shared backend + frontend for multi-customer EMS deployments. - 12 enterprise modules: quota, cost, charging, maintenance, analysis, etc. - 120+ API endpoints, 37 database tables - Customer config mechanism (CUSTOMER env var + YAML config) - Collectors: Modbus TCP, MQTT, HTTP API, Sungrow iSolarCloud - Frontend: React 19 + Ant Design + ECharts + Three.js - Infrastructure: Redis cache, rate limiting, aggregation engine Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
33
backend/app/models/weather.py
Normal file
33
backend/app/models/weather.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from sqlalchemy import Column, Integer, String, Float, Boolean, DateTime
|
||||
from sqlalchemy.sql import func
|
||||
from app.core.database import Base
|
||||
|
||||
|
||||
class WeatherData(Base):
|
||||
"""气象数据缓存"""
|
||||
__tablename__ = "weather_data"
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
timestamp = Column(DateTime(timezone=True), nullable=False, index=True)
|
||||
data_type = Column(String(20), nullable=False) # observation, forecast
|
||||
temperature = Column(Float)
|
||||
humidity = Column(Float)
|
||||
solar_radiation = Column(Float) # W/m2
|
||||
cloud_cover = Column(Float) # 0-100 %
|
||||
wind_speed = Column(Float) # m/s
|
||||
source = Column(String(20), default="mock") # api, mock
|
||||
fetched_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
|
||||
|
||||
class WeatherConfig(Base):
|
||||
"""气象API配置"""
|
||||
__tablename__ = "weather_config"
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
api_provider = Column(String(50), default="mock")
|
||||
api_key = Column(String(200))
|
||||
location_lat = Column(Float, default=39.9)
|
||||
location_lon = Column(Float, default=116.4)
|
||||
fetch_interval_minutes = Column(Integer, default=30)
|
||||
is_enabled = Column(Boolean, default=True)
|
||||
updated_at = Column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now())
|
||||
Reference in New Issue
Block a user