You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
577 B
Go
43 lines
577 B
Go
/**
|
|
* @Author: jager
|
|
* @Email: lhj168os@gmail.com
|
|
* @File: consts
|
|
* @Date: 2021/12/31 5:20 下午
|
|
* @package: consts
|
|
* @Version: v1.0.0
|
|
*
|
|
* @Description:
|
|
*
|
|
*/
|
|
|
|
package apity
|
|
|
|
import "strconv"
|
|
|
|
type ApiType int64
|
|
|
|
const (
|
|
Soup ApiType = 1 << iota
|
|
Weather
|
|
Obscenity
|
|
Astro
|
|
)
|
|
|
|
func Type(ty string) ApiType {
|
|
tyN, err := strconv.Atoi(ty)
|
|
if err == nil {
|
|
return ApiType(1 << (tyN - 1))
|
|
}
|
|
switch ty {
|
|
case "soup":
|
|
return Soup
|
|
case "weather":
|
|
return Weather
|
|
case "obscenity":
|
|
return Obscenity
|
|
case "astro":
|
|
return Astro
|
|
}
|
|
return ApiType(0)
|
|
}
|