Captcha identifier

master
Leonardo Domingues 2022-02-09 14:26:25 -03:00
parent 62ad6dcb51
commit fa69db55c8
1 changed files with 11 additions and 1 deletions

View File

@ -47,11 +47,12 @@ func NewCli(apikey string) *Cli {
return ret return ret
} }
func RegistrarExec(table, apikey string, check bool) { func RegistrarExec(table, apikey string, check bool, checkC bool) {
//Para robôs, age como contador e registra cada repetição no mês //Para robôs, age como contador e registra cada repetição no mês
c := NewCli(apikey) c := NewCli(apikey)
var registros int var registros int
var erro int var erro int
captReg := 0
current := time.Now().Format("2006-01") current := time.Now().Format("2006-01")
res, err := c.Do(&DataAPIRequest{ res, err := c.Do(&DataAPIRequest{
Col: table, Col: table,
@ -66,6 +67,10 @@ func RegistrarExec(table, apikey string, check bool) {
result := res.Data[0].(map[string]interface{}) result := res.Data[0].(map[string]interface{})
registros = int(result["exec"].(float64)) registros = int(result["exec"].(float64))
registros = registros + 1 registros = registros + 1
captReg = int(result["capt"].(float64))
if checkC {
captReg = captReg + 1
}
ident := strconv.Itoa(int(result["ID"].(float64))) ident := strconv.Itoa(int(result["ID"].(float64)))
_, err = c.Do(&DataAPIRequest{ _, err = c.Do(&DataAPIRequest{
@ -74,6 +79,7 @@ func RegistrarExec(table, apikey string, check bool) {
Id: ident, Id: ident,
Data: map[string]interface{}{ Data: map[string]interface{}{
"exec": registros, "exec": registros,
"capt": captReg,
}, },
}) })
if err != nil { if err != nil {
@ -101,6 +107,9 @@ func RegistrarExec(table, apikey string, check bool) {
if check { if check {
registros = 1 registros = 1
erro = 0 erro = 0
if checkC {
captReg = 1
}
} else { } else {
registros = 0 registros = 0
erro = 1 erro = 1
@ -112,6 +121,7 @@ func RegistrarExec(table, apikey string, check bool) {
"date": current, "date": current,
"exec": registros, "exec": registros,
"err": erro, "err": erro,
"capt": captReg,
}, },
}) })
if err != nil { if err != nil {