Commit bc29d2f5c4cc7827fa7c093763981b86d8fcf574
1 parent
a79d6ab6
Exists in
master
and in
4 other branches
提交测试接口
Showing
1 changed file
with
30 additions
and
1 deletions
Show diff stats
src/HttpServer/logic/httpserver.go
... | ... | @@ -2,7 +2,9 @@ package logic |
2 | 2 | |
3 | 3 | import ( |
4 | 4 | "HttpServer/conf" |
5 | + "HttpServer/redishandler" | |
5 | 6 | "common/logger" |
7 | + "common/redis" | |
6 | 8 | "encoding/json" |
7 | 9 | "fmt" |
8 | 10 | "io/ioutil" |
... | ... | @@ -39,7 +41,8 @@ func startServerHttpServe() { |
39 | 41 | //http.HandleFunc("/catcafe/QueryAllAccount", QueryAllAccount) //查询所有账号的等级信息等数据 |
40 | 42 | //------------------------------------------------------------- |
41 | 43 | |
42 | - http.HandleFunc("/eliminatestar/test", Testapi) //登录 | |
44 | + http.HandleFunc("/eliminatestar/test", Testapi) //测试接口 | |
45 | + http.HandleFunc("/eliminatestar/clear", ClearData) //清除账号 | |
43 | 46 | //---------------------------------------------------------------------------------------- |
44 | 47 | http.HandleFunc("/eliminatestar/login", UserLogin) //登录 |
45 | 48 | http.HandleFunc("/eliminatestar/getuserdata", Getuserdata) //获取玩家数据 |
... | ... | @@ -62,6 +65,32 @@ func startServerHttpServe() { |
62 | 65 | CheckErr(err) |
63 | 66 | } |
64 | 67 | |
68 | +func ClearData(w http.ResponseWriter, r *http.Request) { | |
69 | + | |
70 | + Uuid := 0 | |
71 | + if len(r.Header) > 0 { | |
72 | + Uuid, _ = strconv.Atoi(r.Header.Get("Uuid")) | |
73 | + } | |
74 | + | |
75 | + if Uuid == 0 { | |
76 | + SetHeader(w) | |
77 | + //logger.Error("Uuid is nil!") | |
78 | + return | |
79 | + } | |
80 | + result, _ := ioutil.ReadAll(r.Body) | |
81 | + r.Body.Close() | |
82 | + | |
83 | + s := string(result) | |
84 | + logger.Info("ClearData , body:%v,uuid=%v", s, Uuid) | |
85 | + | |
86 | + redishandler.GetRedisClient().HDel(redis.USER_DATA_KEY, strconv.Itoa(Uuid)) | |
87 | + redishandler.GetRedisClient().HDel(redis.USER_TASKINFO_LIST, strconv.Itoa(Uuid)) | |
88 | + redishandler.GetRedisClient().HDel(redis.USER_ACHIEVEMENTINFO_LIST, strconv.Itoa(Uuid)) | |
89 | + redishandler.GetRedisClient().HDel(redis.USER_WITHDRAW_RECORDLIST, strconv.Itoa(Uuid)) | |
90 | + | |
91 | + fmt.Fprint(w, "success!") | |
92 | +} | |
93 | + | |
65 | 94 | func Usersign(w http.ResponseWriter, r *http.Request) { |
66 | 95 | |
67 | 96 | Uuid := 0 | ... | ... |