Dockerfile
This commit is contained in:
47
consts/stock/zone_status.go
Normal file
47
consts/stock/zone_status.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package stock
|
||||
|
||||
// ZoneStatus 库区状态枚举
|
||||
type ZoneStatus string
|
||||
|
||||
const (
|
||||
ZoneStatusEnabled ZoneStatus = "enable" // 启用
|
||||
ZoneStatusDisabled ZoneStatus = "disable" // 停用
|
||||
)
|
||||
|
||||
// GetAllZoneStatuses 获取所有库区状态
|
||||
func GetAllZoneStatuses() []ZoneStatus {
|
||||
return []ZoneStatus{
|
||||
ZoneStatusEnabled,
|
||||
ZoneStatusDisabled,
|
||||
}
|
||||
}
|
||||
|
||||
type ZoneStatusKeyValue struct {
|
||||
Key ZoneStatus
|
||||
Value string
|
||||
}
|
||||
|
||||
var (
|
||||
ZoneStatusEnabledKeyValue = ZoneStatusKeyValue{Key: ZoneStatusEnabled, Value: "启用"}
|
||||
ZoneStatusDisabledKeyValue = ZoneStatusKeyValue{Key: ZoneStatusDisabled, Value: "停用"}
|
||||
)
|
||||
|
||||
func GetAllZoneStatusKeyValue() []ZoneStatusKeyValue {
|
||||
return []ZoneStatusKeyValue{
|
||||
ZoneStatusEnabledKeyValue,
|
||||
ZoneStatusDisabledKeyValue,
|
||||
}
|
||||
}
|
||||
|
||||
var zoneStatusValueMap = map[ZoneStatus]string{
|
||||
ZoneStatusEnabled: ZoneStatusEnabledKeyValue.Value,
|
||||
ZoneStatusDisabled: ZoneStatusDisabledKeyValue.Value,
|
||||
}
|
||||
|
||||
func GetZoneStatusValueByKey(key ZoneStatus) (value string) {
|
||||
value, exists := zoneStatusValueMap[key]
|
||||
if !exists {
|
||||
value = "未知状态"
|
||||
}
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user