package config // Zhgmang 指挥官-莽 type ( Zhgmang struct { GiftEffect struct { Free []int64 // 免费礼物 ClearScreen []int64 // 清屏礼物 RandomAddon []int64 // 随机加成礼物 } } ZhgmangGiftType int32 ) const ( ZhgmangGiftUnknown ZhgmangGiftType = iota ZhgmangGiftFree ZhgmangGiftClearScreen ZhgmangGiftRandomAddon ) func (z Zhgmang) ParseGiftType(id int64) ZhgmangGiftType { if z.isContains(id, z.GiftEffect.Free) { return ZhgmangGiftFree } else if z.isContains(id, z.GiftEffect.ClearScreen) { return ZhgmangGiftClearScreen } else if z.isContains(id, z.GiftEffect.RandomAddon) { return ZhgmangGiftRandomAddon } return ZhgmangGiftUnknown } func (z Zhgmang) isContains(id int64, arr []int64) bool { for _, s := range arr { if s == id { return true } } return false }