Browse Source

提交保存

master
xyiege 5 months ago
parent
commit
d320a35798
  1. 23
      aufs/core/setting.go
  2. 2
      aufs/main.go

23
aufs/core/setting.go

@ -3,6 +3,7 @@ package core
import (
"aufs/db"
"encoding/json"
"fmt"
"net/http"
"strconv"
)
@ -51,3 +52,25 @@ func Scdetail(w http.ResponseWriter, r *http.Request) {
uCorsHadler(w, r)
json.NewEncoder(w).Encode(scresp)
}
// 编辑
func Scedit(w http.ResponseWriter, r *http.Request) {
// 使用post方式
if r.Method != http.MethodPost {
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
return
}
// 解析表单数据
frmdata := r.ParseForm()
fmt.Println(frmdata)
// 获取参数
// id := frmdata.Get("id")
// // 转换为整数
// scid, err := strconv.Atoi(id)
// if err != nil {
// // 处理转换错误
// }
// 数据库初始化
db.Init()
// 编辑
}

2
aufs/main.go

@ -34,6 +34,8 @@ func startWeb() {
http.HandleFunc("/scdb", core.Settdb)
// 服务器详情
http.HandleFunc("/scdetail", core.Scdetail)
// 编辑
http.HandleFunc("/scedit", core.Scedit)
// 内存信息
http.HandleFunc("/dtmem", core.Dtmem)

Loading…
Cancel
Save