package cacheApi import ( "epur-pay/model" "epur-pay/pkg/rds" "epur-pay/pkg/utils" "strings" ) type BlackList struct { Ip model.ArryString duplicate *BlackList } func (p *BlackList) Refresh() *BlackList { p.duplicate = &BlackList{} blackInfo := model.BlackList{} utils.Error(rds.DB.Raw(`select * from black_list where id = ?`, 1).Scan(&blackInfo).Error) p.duplicate.Ip = blackInfo.Ip return p.duplicate } // 验证码ip func (p *BlackList) Check(ip string) bool { if len(strings.ReplaceAll(ip, " ", "")) <= 0 { return false } return p.Ip.Of(ip) }