up
This commit is contained in:
@@ -15,6 +15,7 @@ type PartnerRecurso struct {
|
||||
Categoria string `json:"categoria" gorm:"column:categoria;default:'general'"` // general|tecnico|comercial|marketing
|
||||
Archivo string `json:"archivo" gorm:"column:archivo"`
|
||||
NombreOrig string `json:"nombre_orig" gorm:"column:nombre_orig"`
|
||||
Enlace string `json:"enlace" gorm:"column:enlace"` // URL externa opcional
|
||||
Activo bool `json:"activo" gorm:"column:activo;default:true"`
|
||||
}
|
||||
|
||||
|
||||
@@ -213,9 +213,19 @@ func sendTelegramAdmin(mensaje string) {
|
||||
continue
|
||||
}
|
||||
ts := &TelegramService{BotToken: cfg.BotToken}
|
||||
if err := ts.SendMessage(cfg.ChatID, mensaje); err != nil {
|
||||
log.Printf("[Notif] Error enviando telegram admin (cfg %d): %v", cfg.ID, err)
|
||||
sendErr := ts.SendMessage(cfg.ChatID, mensaje)
|
||||
logEntry := &models.TelegramLog{
|
||||
TelegramConfigID: cfg.ID,
|
||||
Titulo: "Notificación del sistema",
|
||||
Mensaje: mensaje,
|
||||
Estado: "ok",
|
||||
}
|
||||
if sendErr != nil {
|
||||
log.Printf("[Notif] Error enviando telegram admin (cfg %d): %v", cfg.ID, sendErr)
|
||||
logEntry.Estado = "failed"
|
||||
logEntry.ErrorMsg = sendErr.Error()
|
||||
}
|
||||
_ = models.CreateTelegramLog(logEntry)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user