You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
578 B
34 lines
578 B
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)
|
|
}
|