This repository has been archived on 2024-03-03. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
adlin/token-validator/ping.go

19 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
}
}