/** * @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 // 8:ip的域名 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) }