Files
gofly-platform-services/zlt-business/order-center/src/main/resources/config/weather-config-example.yml
T

114 lines
3.4 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# =============================================
# 天气系统配置示例
# =============================================
# 将以下配置添加到 application.yml 或 application-dev.yml 中
weather:
# 天气数据源配置
data-source:
primary: open-meteo # 主要数据源(open-meteo:免费API, gd:高德, qweather:和风)
fallback: gd # 备用数据源
# Open-Meteo 天气API配置(免费,无需API Key)
open-meteo:
enabled: true
base-url: https://api.open-meteo.com/v1/forecast
timeout: 5000
# 高德天气API配置(可选)
gaode:
enabled: false
api-key: YOUR_GAODE_API_KEY_HERE # 请替换为实际的高德API Key
base-url: https://restapi.amap.com/v3/weather
timeout: 5000
# 和风天气API配置(可选)
qweather:
enabled: false
api-key: YOUR_QWEATHER_API_KEY_HERE # 请替换为实际的和风API Key
base-url: https://devapi.qweather.com/v7/weather
timeout: 5000
# 缓存配置
cache:
realtime-ttl: 10 # 实时天气缓存时间(分钟)
forecast-ttl: 60 # 预报天气缓存时间(分钟)
redis-enabled: true # 是否启用Redis缓存
local-max-size: 100 # 本地缓存最大数量
# 规则引擎配置
rule-engine:
default-rule-code: DRONE_FLIGHT_STANDARD # 默认规则编码
cache-enabled: true # 是否启用规则缓存
cache-refresh-interval: 30 # 缓存刷新间隔(分钟)
# =============================================
# Open-Meteo 天气API说明
# =============================================
# Open-Meteo 是一个完全免费的天气API服务
# 优势:
# 1. 完全免费,无需注册和API Key
# 2. 数据准确,来源于多个气象机构
# 3. 全球覆盖,支持任意经纬度查询
# 4. 无请求限制
# 5. 开源项目,社区活跃
# 官网:https://open-meteo.com/
# API文档:https://open-meteo.com/en/docs
# 支持的天气参数:
# - temperature_2m: 2米高度温度(°C)
# - relative_humidity_2m: 相对湿度(%)
# - precipitation: 降水量(mm)
# - weather_code: 天气代码
# - cloud_cover: 云量(%)
# - pressure_msl: 海平面气压(hPa)
# - wind_speed_10m: 10米高度风速(m/s)
# - wind_direction_10m: 风向(°)
# =============================================
# 如何获取其他天气API Key(可选)
# =============================================
# 高德天气API:
# 1. 访问 https://lbs.amap.com/
# 2. 注册并登录高德开放平台
# 3. 创建应用,选择"Web服务"类型
# 4. 获取API Key
# 和风天气API:
# 1. 访问 https://www.qweather.com/
# 2. 注册并登录和风天气开发平台
# 3. 创建项目,选择"Web API"类型
# 4. 获取API Key
# =============================================
# Redis配置(如果启用Redis缓存)
# =============================================
spring:
redis:
host: localhost
port: 6379
database: 0
password: # 如果Redis设置了密码,请填写
timeout: 5000
lettuce:
pool:
max-active: 8
max-wait: -1
max-idle: 8
min-idle: 0
# =============================================
# 定时任务配置
# =============================================
spring:
task:
scheduling:
pool:
size: 5 # 定时任务线程池大小
thread-name-prefix: weather-scheduler-