Updated backend
This commit is contained in:
parent
69a64879b6
commit
b6f8546114
1 changed files with 32 additions and 1 deletions
|
|
@ -158,6 +158,26 @@ func connect() {
|
||||||
"result2": array2,
|
"result2": array2,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
case "get-list-registered":
|
||||||
|
array := []string{}
|
||||||
|
|
||||||
|
results, err := db.Query("SELECT IFNULL(employeeid, 0) AS result FROM esign WHERE employeeid <> ?", 276)
|
||||||
|
if err != nil {
|
||||||
|
c.AbortWithError(http.StatusBadRequest, err)
|
||||||
|
c.String(http.StatusBadRequest, err.Error())
|
||||||
|
}
|
||||||
|
for results.Next() {
|
||||||
|
err = results.Scan(&result)
|
||||||
|
if err != nil {
|
||||||
|
c.AbortWithError(http.StatusBadRequest, err)
|
||||||
|
c.String(http.StatusBadRequest, err.Error())
|
||||||
|
}
|
||||||
|
array = append(array, result)
|
||||||
|
}
|
||||||
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"result": array,
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -466,7 +486,7 @@ func connect() {
|
||||||
"result": result,
|
"result": result,
|
||||||
})
|
})
|
||||||
|
|
||||||
case "get-password":
|
case "get-password":
|
||||||
err := db.QueryRow("SELECT IFNULL(password, '') AS result FROM esign WHERE employeeid = ?", data).Scan(&result)
|
err := db.QueryRow("SELECT IFNULL(password, '') AS result FROM esign WHERE employeeid = ?", data).Scan(&result)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
|
|
@ -480,6 +500,17 @@ func connect() {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"result": result,
|
"result": result,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
case "get-employeename":
|
||||||
|
err := db.QueryRow("SELECT IFNULL(employeename, '') AS result FROM employee WHERE employeeid = ?", data).Scan(&result)
|
||||||
|
if err != nil {
|
||||||
|
c.AbortWithError(http.StatusBadRequest, err)
|
||||||
|
c.String(http.StatusBadRequest, err.Error())
|
||||||
|
}
|
||||||
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"result": result,
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue