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:黄历
)
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)