低空智控平台 后端go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

82 lines
2.7 KiB

package cache
import "fmt"
const (
UserTokenKey = "laic:token:%d:%s" // 用户 access token 存证(userId, shortId)
RefreshTokenKey = "laic:refresh:%d:%s" // 用户 refresh token 存证(userId, shortId)
SmsCodeKey = "laic:sms:%s" // 短信验证码(phone)
DockStatusKey = "device:dock:%s:status" // 机巢实时状态 Hash(dockId)
DockAlarmKey = "device:dock:%s:alarm_codes" // 机巢告警码 Set(dockId)
DroneTelemetryKey = "device:drone:%s:telemetry" // 无人机遥测 Hash(dockId)
DroneAlarmKey = "device:drone:%s:alarm_codes" // 无人机告警码 Set(dockId)
OtaStatusKey = "device:dock:%s:ota" // 机巢 OTA 升级进度 Hash(dockId)
WorkflowKey = "device:workflow:%s" // 当前工作流状态 Hash(dockId)
VideoKey = "device:video:%s" // 当前视频推流状态 Hash(dockId)
OnlineDockSetKey = "laic:devices:online:dock" // 在线机巢 Set
OnlineDroneSetKey = "laic:devices:online:drone" // 在线无人机 Set
DockHeartbeatKey = "laic:devices:heartbeat:dock:%s"
DroneHeartbeatKey = "laic:devices:heartbeat:drone:%s"
TrafficKey = "laic:traffic:%d" // 用户云媒体流量余额(字节,Redis 为权威)
TrafficKeyPrefix = "laic:traffic:" // 流量余额 key 前缀(快照刷新扫描用)
LiveBilledKey = "laic:live:billed:%s" // 直播会话上次计费时间戳(sessionId)
)
func UserTokenKeyOf(userID int64, shortID string) string {
return fmt.Sprintf(UserTokenKey, userID, shortID)
}
func RefreshTokenKeyOf(userID int64, shortID string) string {
return fmt.Sprintf(RefreshTokenKey, userID, shortID)
}
func SmsCodeKeyOf(phone string) string {
return fmt.Sprintf(SmsCodeKey, phone)
}
func DockStatusKeyOf(dockID string) string {
return fmt.Sprintf(DockStatusKey, dockID)
}
func DockAlarmKeyOf(dockID string) string {
return fmt.Sprintf(DockAlarmKey, dockID)
}
func DroneTelemetryKeyOf(dockID string) string {
return fmt.Sprintf(DroneTelemetryKey, dockID)
}
func DroneAlarmKeyOf(dockID string) string {
return fmt.Sprintf(DroneAlarmKey, dockID)
}
func OtaStatusKeyOf(dockID string) string {
return fmt.Sprintf(OtaStatusKey, dockID)
}
func WorkflowKeyOf(dockID string) string {
return fmt.Sprintf(WorkflowKey, dockID)
}
func VideoKeyOf(dockID string) string {
return fmt.Sprintf(VideoKey, dockID)
}
func DockHeartbeatKeyOf(dockID string) string {
return fmt.Sprintf(DockHeartbeatKey, dockID)
}
func DroneHeartbeatKeyOf(droneSN string) string {
return fmt.Sprintf(DroneHeartbeatKey, droneSN)
}
func TrafficKeyOf(userID int64) string {
return fmt.Sprintf(TrafficKey, userID)
}
func LiveBilledKeyOf(sessionID string) string {
return fmt.Sprintf(LiveBilledKey, sessionID)
}