Files
Authentication/services/access_log.go
T
2025-11-25 15:12:31 +08:00

30 lines
689 B
Go

package services
import (
"authentication/db"
"authentication/models"
)
func InsertAccessLogLogin(log models.UserAccessLog) error {
query := `INSERT INTO access_log (
user_id,
participant_id,
activity_type,
ip_address,
field_updated,
time)
VALUES (?, ?, ?, ?, ?, ?)`
_, err := db.DB.Exec(query, log.UserID, log.ParticipantID, log.ActivityType, log.IPAddress, log.FieldUpdated, log.Time)
return err
}
func GetActivityMessages(id int) (description string, err error) {
query := `SELECT Description FROM activity_type WHERE id = ?`
err = db.DB.QueryRow(query, id).Scan(&description)
if err != nil {
return "", err
}
return description, nil
}