-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathoperatorlog.go
88 lines (61 loc) · 1.76 KB
/
operatorlog.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package main
import (
"fmt"
"io"
"log"
"net/http"
)
// //CompareFunc 获取index
// type CompareFunc func(interface{}, interface{}) int
// func indexOf(a []interface{}, e interface{}, cmp CompareFunc) int {
// n := len(a)
// var i int
// for ; i < n; i++ {
// if cmp(e, a[i]) == 0 {
// return i
// }
// }
// return -1
// }
func (j *jsonapi) httpOperatorLogList(w http.ResponseWriter, req *http.Request) {
sethttphead(w)
_, err := checktoken(w, req)
if err != nil {
return
}
result, _ := io.ReadAll(req.Body)
req.Body.Close()
//list := make([]OperatorLog, 0)
var total = 0
stb := &query{}
err = jsonextra.Unmarshal(result, &stb)
if err != nil {
log.Println("operater log query err :", err)
w.Write([]byte(`{"code":20000,"data":{"isok":1,"message":"操作日记查询参数错误"}}`))
return
}
ww, p, _ := queryToWhere("", *stb)
list, total := getOperatorLog(ww, p)
// list := getOperatorLog()
//fmt.Println(emplist)
rescode, _ := jsonextra.Marshal(list)
respone := fmt.Sprintf(`{"code":20000,"data":{"total":%v,"items":%s}}`,
total, rescode)
w.Write([]byte(respone))
}
// func (j *jsonapi) httpsavesetup(w http.ResponseWriter, req *http.Request) {
// sethttphead(w)
// u, ok := checktoken(w, req)
// if !ok {
// return
// }
// if checkrole(u, "admin") == false {
// w.Write([]byte("{\"code\":20000,\"data\":{\"message\":\"当前用户没有权限设置此参数\"}}"))
// return
// }
// //req.ParseForm()
// //points := strings.TrimSpace(req.Form.Get("points"))
// //perater := strings.TrimSpace(req.Form.Get("uid"))
// //conf.points = points
// w.Write([]byte("{\"code\":20000,\"data\":{\"message\":\"设置成功\"}}"))
//}