Commit 99813ecea806c4c9bad92ce156f9e62fa93a81e8
1 parent
1b482921
Exists in
master
提交
Showing
1 changed file
with
18 additions
and
2 deletions
Show diff stats
src/HttpServer/logic/httpserver.go
| ... | ... | @@ -89,6 +89,7 @@ func ClearData(w http.ResponseWriter, r *http.Request) { |
| 89 | 89 | fmt.Fprint(w, "ClearData coin=%v",coin)*/ |
| 90 | 90 | |
| 91 | 91 | //首先检查白名单 |
| 92 | + var wilteist []int | |
| 92 | 93 | rkey := "CATCAFE_REDIS_CAN_RESETDATA_LIST" |
| 93 | 94 | vv,err := redishandler.GetRedisClient().HGetAllKeys(rkey) |
| 94 | 95 | if err != nil { |
| ... | ... | @@ -97,9 +98,24 @@ func ClearData(w http.ResponseWriter, r *http.Request) { |
| 97 | 98 | |
| 98 | 99 | for _,val := range vv { |
| 99 | 100 | bytestr := string(val.([]byte)) |
| 100 | - logger.Info("ClearData white list str=%v",bytestr) | |
| 101 | + bytenum,_ := strconv.Atoi(bytestr) | |
| 102 | + wilteist = append(wilteist,bytenum) | |
| 103 | + | |
| 104 | + } | |
| 105 | + logger.Info("ClearData white list wilteist=%v",wilteist) | |
| 106 | + isinwhitelist := false | |
| 107 | + for _,val := range wilteist { | |
| 108 | + if val == uuidnum { | |
| 109 | + isinwhitelist = true | |
| 110 | + break | |
| 111 | + } | |
| 112 | + } | |
| 113 | + | |
| 114 | + if !isinwhitelist { | |
| 115 | + //不在白名单 | |
| 116 | + fmt.Fprint(w, "你要清楚的数据不在白名单内,请联系管理员") | |
| 117 | + return | |
| 101 | 118 | } |
| 102 | - return | |
| 103 | 119 | |
| 104 | 120 | err = mysql.DoClearData(uuidnum) |
| 105 | 121 | if err != nil { | ... | ... |