改用core核心库包

This commit is contained in:
TsMask
2023-08-26 17:02:58 +08:00
parent 26b55965da
commit 2a8a2b5d25
6 changed files with 12 additions and 62 deletions

View File

@@ -10,6 +10,7 @@ import (
"runtime"
"time"
"ems.agt/lib/core/utils/ctx"
"ems.agt/lib/dborm"
"ems.agt/lib/log"
"ems.agt/lib/services"
@@ -169,16 +170,6 @@ func Pref(w http.ResponseWriter, r *http.Request) {
services.ResponseWithJson(w, http.StatusOK, data)
}
// GET http://192.168.21.183:3040/api/rest/maintenance/v1/prefLog?pageNum=1&pageSize=10
func PrefLog(w http.ResponseWriter, r *http.Request) {
pageNumb, pageSize := services.GetPageNumSize(r)
result, err := dborm.DbClient.XEngine.QueryString("SELECT * FROM sys_perf_data limit ?,?", (pageNumb-1)*pageSize, pageSize)
if err != nil {
services.ResponseInternalServerError500ProcessError(w, err)
}
services.ResponseWithJson(w, http.StatusOK, result)
}
// POST http://192.168.21.183:3040/api/rest/maintenance/v1/config
func Config(w http.ResponseWriter, r *http.Request) {
// json 請求參數獲取
@@ -186,7 +177,7 @@ func Config(w http.ResponseWriter, r *http.Request) {
Key string `json:"key"`
Value string `json:"value"`
}
err := services.ShouldBindJSON(r, &bodyArgs)
err := ctx.ShouldBindJSON(r, &bodyArgs)
if err != nil {
log.Error("io.ReadAll is failed:", err)
services.ResponseNotFound404UriNotExist(w, r)
@@ -292,7 +283,7 @@ func TopOps(w http.ResponseWriter, r *http.Request) {
Ops string `json:"ops"`
Pid string `json:"pid"`
}
err := services.ShouldBindJSON(r, &bodyArgs)
err := ctx.ShouldBindJSON(r, &bodyArgs)
if err != nil {
log.Error("io.ReadAll is failed:", err)
services.ResponseNotFound404UriNotExist(w, r)