feat(server-go): 和风天气接入与高发病天气预警规则(#12)

This commit is contained in:
weijuesen
2026-08-12 17:40:24 +08:00
parent fa86542e55
commit c7f18c1381
10 changed files with 464 additions and 0 deletions
@@ -34,6 +34,7 @@ var AllPermissions = []PermissionDef{
{"rearing:write", "饲养记录管理", "新增、编辑、删除饲养记录"},
{"notification:read", "订阅查看", "查看微信订阅绑定状态"},
{"notification:write", "订阅管理", "绑定微信并管理订阅授权"},
{"weather:read", "天气查看", "查看天气与高发病天气预警"},
{"user:manage", "用户管理", "管理用户、角色和权限"},
{"audit:read", "审计查看", "查看审计日志"},
}
@@ -48,6 +49,7 @@ var RolePermissionMap = map[string][]string{
"inspection:create", "inspection:read",
"tray:read", "tray:write", "batch:read", "batch:write", "rearing:read", "rearing:write",
"notification:read", "notification:write",
"weather:read",
"user:manage", "audit:read",
},
RoleOperator: {
@@ -58,6 +60,7 @@ var RolePermissionMap = map[string][]string{
"inspection:create", "inspection:read",
"tray:read", "tray:write", "batch:read", "batch:write", "rearing:read", "rearing:write",
"notification:read", "notification:write",
"weather:read",
},
RoleViewer: {
"dashboard:view", "room:read", "device:read",
@@ -66,6 +69,7 @@ var RolePermissionMap = map[string][]string{
"inspection:read",
"tray:read", "batch:read", "rearing:read",
"notification:read",
"weather:read",
},
RoleFarmer: {
"dashboard:view", "room:read", "device:read", "device:control",
@@ -74,5 +78,6 @@ var RolePermissionMap = map[string][]string{
"inspection:create", "inspection:read",
"tray:read", "batch:read", "rearing:read",
"notification:read", "notification:write",
"weather:read",
},
}
+18
View File
@@ -0,0 +1,18 @@
package model
import (
"encoding/json"
"time"
)
// WeatherAlert 高发病天气预警
type WeatherAlert struct {
ID string `gorm:"type:uuid;primaryKey;default:gen_random_uuid()" json:"id"`
Disease string `gorm:"size:64" json:"disease"`
Level string `gorm:"size:16" json:"level"`
Reason string `gorm:"type:text" json:"reason"`
Snapshot json.RawMessage `gorm:"type:jsonb" json:"snapshot,omitempty"`
CreatedAt time.Time `gorm:"type:timestamptz" json:"createdAt"`
}
func (WeatherAlert) TableName() string { return "weather_alerts" }