This repository has been archived on 2024-03-03. You can view files and clone it, but cannot push or open issues or pull requests.
adlin/token-validator/ping.go

20 lines
453 B
Go

package main
import (
"time"
)
func init() {
router.POST("/api/students/:sid/pong", apiHandler(studentHandler(stdPong), sslOnly))
}
func stdPong(student Student, body []byte) (interface{}, error) {
if res, err := DBExec("INSERT INTO student_pong (id_student, time) VALUES (?, ?)", student.Id, time.Now()); err != nil {
return false, err
} else if _, err := res.LastInsertId(); err != nil {
return false, err
} else {
return true, err
}
}