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.
go-library/utils/jobs/ip.go

20 lines
370 B

package jobs
import (
"github.com/dtapps/go-library/utils/goip"
"gorm.io/gorm"
)
// RefreshIp 刷新Ip
func (app *App) RefreshIp(tx *gorm.DB) {
xip := goip.GetOutsideIp()
if app.OutsideIp == "" || app.OutsideIp == "0.0.0.0" {
return
}
if app.OutsideIp == xip {
return
}
tx.Where("ips = ?", app.OutsideIp).Delete(&TaskIp{}) // 删除
app.OutsideIp = xip
}