Mark Location Time to red when it is later than now 3600s
This commit is contained in:
parent
232a076b67
commit
9c9eafadcb
BIN
APIServer.exe
BIN
APIServer.exe
Binary file not shown.
41
ews/ews.go
41
ews/ews.go
@ -414,13 +414,6 @@ func (e *EWS) GetUutInfo(cfg cnf.Cfg, logger *log.Logger, host string, addr stri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get Location Information
|
|
||||||
loc, locTime := "", ""
|
|
||||||
if last != "" {
|
|
||||||
qry := dbo.QueryRow(fmt.Sprintf(`SELECT CONCAT_WS(' ', line, CONCAT_WS('-',col,row,num)) AS loc, update_time FROM locinfo WHERE mac='%s'`, ul.MAC))
|
|
||||||
qry.Scan(&loc, &locTime)
|
|
||||||
}
|
|
||||||
|
|
||||||
//Get History Records
|
//Get History Records
|
||||||
uh := new(UutInfo)
|
uh := new(UutInfo)
|
||||||
bkup := ""
|
bkup := ""
|
||||||
@ -463,6 +456,29 @@ func (e *EWS) GetUutInfo(cfg cnf.Cfg, logger *log.Logger, host string, addr stri
|
|||||||
uh.USN, uh.MAC, uh.IPAddr, uh.Relay, uh.Item, uh.Status, uh.Message, uh.LastChg, "\r\n")
|
uh.USN, uh.MAC, uh.IPAddr, uh.Relay, uh.Item, uh.Status, uh.Message, uh.LastChg, "\r\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Get Location Information
|
||||||
|
loc, locTime := "", ""
|
||||||
|
var locStmp int64 = 0
|
||||||
|
if ul.MAC != "" {
|
||||||
|
qry := dbo.QueryRow(fmt.Sprintf(`SELECT CONCAT_WS(' ', line, CONCAT_WS('-',col,row,num)) AS loc, update_time, update_stmp FROM locinfo WHERE mac='%s' ORDER BY seqid DESC;`, ul.MAC))
|
||||||
|
qry.Scan(&loc, &locTime, &locStmp)
|
||||||
|
} else {
|
||||||
|
qry := dbo.QueryRow(fmt.Sprintf(`SELECT CONCAT_WS(' ', line, CONCAT_WS('-',col,row,num)) AS loc, update_time, update_stmp FROM locinfo WHERE mac='%s' ORDER BY seqid DESC;`, uh.MAC))
|
||||||
|
qry.Scan(&loc, &locTime, &locStmp)
|
||||||
|
}
|
||||||
|
|
||||||
|
if loc == "" {
|
||||||
|
loc = `<span style="color: red;">Unknown</span>`
|
||||||
|
} else {
|
||||||
|
loc = fmt.Sprintf(`<span>%s</span>`, loc)
|
||||||
|
}
|
||||||
|
|
||||||
|
if time.Now().Unix()-locStmp >= 3600 {
|
||||||
|
locTime = fmt.Sprintf(`<span style="color: red;">%s</span>`, locTime)
|
||||||
|
} else {
|
||||||
|
locTime = fmt.Sprintf(`<span>%s</span>`, locTime)
|
||||||
|
}
|
||||||
|
|
||||||
//Get Misc. Info
|
//Get Misc. Info
|
||||||
if partNO == "" {
|
if partNO == "" {
|
||||||
partNO = uh.PartNO
|
partNO = uh.PartNO
|
||||||
@ -650,17 +666,6 @@ func (e *EWS) SimpleMsgHTML(clr, msg string) string {
|
|||||||
|
|
||||||
func (e *EWS) TemplateUutInfo(loc, locTime, misc, last, bkup string) string {
|
func (e *EWS) TemplateUutInfo(loc, locTime, misc, last, bkup string) string {
|
||||||
now := time.Now().Format("2006-01-02 15:04:05")
|
now := time.Now().Format("2006-01-02 15:04:05")
|
||||||
if loc == "" {
|
|
||||||
loc = `<span style="color: red; font-size: 14px; font-family: Consolas;">Unknown</span>`
|
|
||||||
}
|
|
||||||
|
|
||||||
// if misc == "" {
|
|
||||||
// misc = `<span style="color: red;">NO Records !</span>`
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if bkup == "" {
|
|
||||||
// bkup = `<span style="color: red;">NO Records !</span>`
|
|
||||||
// }
|
|
||||||
|
|
||||||
resp := fmt.Sprintf(`<!DOCTYPE html>
|
resp := fmt.Sprintf(`<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user