定制 clarion-app/weather-backend 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

clarion-app/weather-backend

Composer 安装命令:

composer require clarion-app/weather-backend

包简介

Fetchs and store weather data. Provides endpoints for frontend weather app.

README 文档

README

A Laravel package that fetches and stores weather data, providing comprehensive weather forecasting endpoints for frontend applications. This backend integrates with weather APIs (like OpenWeatherMap) to deliver current conditions, forecasts, alerts, and minutely precipitation data.

Features

  • Multi-Location Support: Manage multiple weather locations with favorites and active status
  • Comprehensive Weather Data: Current, hourly, daily, and historical weather information
  • Weather Alerts: Store and manage weather alerts with severity levels and acknowledgment
  • Minutely Precipitation: Detailed precipitation forecasts for the next hour
  • Geocoding Integration: Location search and creation from coordinates
  • Multiple Weather APIs: Support for multiple weather service providers
  • Data Cleanup: Automated cleanup of old weather data
  • Background Jobs: Asynchronous weather data updates via Laravel queues
  • REST API: Full RESTful API with authentication

Database Schema

The package creates the following database tables:

  • weather_apis: Configuration for weather service providers
  • weather_locations: Geographic locations for weather monitoring
  • weather_data: Current, hourly, daily, and historical weather data
  • weather_alerts: Weather warnings and alerts
  • weather_minutely: Minute-by-minute precipitation forecasts

API Endpoints

Weather APIs Management

  • GET /weather-apis - List all weather APIs
  • POST /weather-apis - Create new weather API configuration
  • GET /weather-apis/{id} - Get specific weather API
  • PUT /weather-apis/{id} - Update weather API configuration
  • DELETE /weather-apis/{id} - Delete weather API
  • PATCH /weather-apis/{id}/activate - Activate weather API
  • PATCH /weather-apis/{id}/deactivate - Deactivate weather API
  • GET /weather-apis/active - Get active weather APIs

Location Management

  • GET /locations - List all locations
  • POST /locations - Create new location
  • GET /locations/{id} - Get specific location
  • PUT /locations/{id} - Update location
  • DELETE /locations/{id} - Delete location
  • GET /locations/active - Get active locations
  • GET /locations/favorites - Get favorite locations
  • GET /locations/nearby - Find nearby locations
  • GET /locations/search-geocode - Search locations by geocoding
  • POST /locations/from-geocode - Create location from geocode data
  • PATCH /locations/{id}/activate - Activate location
  • PATCH /locations/{id}/deactivate - Deactivate location
  • PATCH /locations/{id}/favorite - Add location to favorites
  • DELETE /locations/{id}/favorite - Remove location from favorites

Weather Data

  • GET /weather-data - List all weather data
  • POST /weather-data - Create weather data entry
  • GET /weather-data/{id} - Get specific weather data
  • PUT /weather-data/{id} - Update weather data
  • DELETE /weather-data/{id} - Delete weather data
  • GET /weather-data/{locationId}/current - Get current weather for location
  • GET /weather-data/{locationId}/hourly - Get hourly forecast for location
  • GET /weather-data/{locationId}/daily - Get daily forecast for location
  • GET /weather-data/{locationId}/historical - Get historical data for location
  • POST /weather-data/cleanup - Clean up old weather data

Weather Alerts

  • GET /weather-alerts - List all weather alerts
  • POST /weather-alerts - Create weather alert
  • GET /weather-alerts/{id} - Get specific weather alert
  • PUT /weather-alerts/{id} - Update weather alert
  • DELETE /weather-alerts/{id} - Delete weather alert
  • GET /weather-alerts/{locationId}/active - Get active alerts for location
  • GET /weather-alerts/statistics - Get alert statistics
  • GET /weather-alerts/severity/{severity} - Get alerts by severity
  • PATCH /weather-alerts/{id}/acknowledge - Acknowledge alert
  • PATCH /weather-alerts/{id}/resolve - Resolve alert
  • POST /weather-alerts/cleanup - Clean up old alerts

Minutely Precipitation

  • GET /weather-minutely - List minutely data
  • POST /weather-minutely - Create minutely data
  • GET /weather-minutely/{id} - Get specific minutely data
  • PUT /weather-minutely/{id} - Update minutely data
  • DELETE /weather-minutely/{id} - Delete minutely data
  • GET /weather-minutely/{locationId}/next-hour - Get next hour precipitation
  • GET /weather-minutely/{locationId}/precipitation - Get precipitation data
  • GET /weather-minutely/{locationId}/recent - Get recent minutely data
  • POST /weather-minutely/bulk - Bulk create minutely data
  • POST /weather-minutely/cleanup - Clean up old minutely data

OpenWeatherMap Integration

  • POST /openweathermap/fetch-current - Fetch current weather from OpenWeatherMap
  • POST /openweathermap/fetch-complete - Fetch complete weather data
  • POST /openweathermap/fetch-historical - Fetch historical weather data

Commands

Weather Update Command

Update weather data for all active locations:

php artisan weather:update

This command dispatches a job to update weather data asynchronously via Laravel's queue system.

Configuration

The package integrates with the Clarion framework and includes custom prompts for AI-assisted operations:

  • Choose Operations: Guides users to first get location IDs, then fetch weather data
  • Generate API Calls: Provides context for proper API parameter usage

Models

  • WeatherApi: Weather service provider configurations
  • WeatherLocation: Geographic locations with coordinates and metadata
  • WeatherData: Weather measurements and forecasts
  • WeatherAlert: Weather warnings and notifications
  • WeatherMinutely: Minute-by-minute precipitation data

Jobs

  • WeatherDataUpdate: Background job for updating weather data from external APIs

Authentication

All API endpoints require authentication via Laravel's auth:api middleware.

Units Support

The package supports different unit systems for temperature, wind speed, and other measurements, configurable per location.

Data Retention

The package includes cleanup functionality to manage data retention and prevent database bloat from historical weather data.

License

MIT License

Author

Tim Schwartz (tim@metaverse.systems)

clarion-app/weather-backend 适用场景与选型建议

clarion-app/weather-backend 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 06 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 clarion-app/weather-backend 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 clarion-app/weather-backend 我们能提供哪些服务?
定制开发 / 二次开发

基于 clarion-app/weather-backend 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-20