GetIntParam 获取整数参数的通用函数
(input map[string]any, key string, defaultValue int)
| 35 | |
| 36 | // GetIntParam 获取整数参数的通用函数 |
| 37 | func GetIntParam(input map[string]any, key string, defaultValue int) int { |
| 38 | if value, exists := input[key]; exists { |
| 39 | if num, ok := value.(float64); ok { |
| 40 | return int(num) |
| 41 | } |
| 42 | } |
| 43 | return defaultValue |
| 44 | } |
| 45 | |
| 46 | // GetBoolParam 获取布尔参数的通用函数 |
| 47 | func GetBoolParam(input map[string]any, key string, defaultValue bool) bool { |