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.

48 lines
973 B
Go

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/**
* @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 // 1鸡汤句子
Weather // 2天气
Obscenity // 3脏词检测
Almanac // 4黄历
Dirty // 5脏词检测
SelfIp // 6客户端自身ip
DomainIP // 7域名的ip
IPDomain // 8ip的域名
Horoscope // 9 八字
)
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 "almanac":
return Almanac
}
return ApiType(0)
}