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
}
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
c := NewCli(apikey)
var registros int
var erro int
captReg := 0
current := time.Now().Format("2006-01")
res, err := c.Do(&DataAPIRequest{
Col: table,
@ -66,6 +67,10 @@ func RegistrarExec(table, apikey string, check bool) {
result := res.Data[0].(map[string]interface{})
registros = int(result["exec"].(float64))
registros = registros + 1
captReg = int(result["capt"].(float64))
if checkC {
captReg = captReg + 1
}
ident := strconv.Itoa(int(result["ID"].(float64)))
_, err = c.Do(&DataAPIRequest{
@ -74,6 +79,7 @@ func RegistrarExec(table, apikey string, check bool) {
Id: ident,
Data: map[string]interface{}{
"exec": registros,
"capt": captReg,
},
})
if err != nil {
@ -101,6 +107,9 @@ func RegistrarExec(table, apikey string, check bool) {
if check {
registros = 1
erro = 0
if checkC {
captReg = 1
}
} else {
registros = 0
erro = 1
@ -112,6 +121,7 @@ func RegistrarExec(table, apikey string, check bool) {
"date": current,
"exec": registros,
"err": erro,
"capt": captReg,
},
})
if err != nil {