diff --git a/src/HttpServer/logic/httpserver.go b/src/HttpServer/logic/httpserver.go index 6f3acfc..ebdb70b 100644 --- a/src/HttpServer/logic/httpserver.go +++ b/src/HttpServer/logic/httpserver.go @@ -2,7 +2,9 @@ package logic import ( "HttpServer/conf" + "HttpServer/redishandler" "common/logger" + "common/redis" "encoding/json" "fmt" "io/ioutil" @@ -39,7 +41,8 @@ func startServerHttpServe() { //http.HandleFunc("/catcafe/QueryAllAccount", QueryAllAccount) //查询所有账号的等级信息等数据 //------------------------------------------------------------- - http.HandleFunc("/eliminatestar/test", Testapi) //登录 + http.HandleFunc("/eliminatestar/test", Testapi) //测试接口 + http.HandleFunc("/eliminatestar/clear", ClearData) //清除账号 //---------------------------------------------------------------------------------------- http.HandleFunc("/eliminatestar/login", UserLogin) //登录 http.HandleFunc("/eliminatestar/getuserdata", Getuserdata) //获取玩家数据 @@ -62,6 +65,32 @@ func startServerHttpServe() { CheckErr(err) } +func ClearData(w http.ResponseWriter, r *http.Request) { + + Uuid := 0 + if len(r.Header) > 0 { + Uuid, _ = strconv.Atoi(r.Header.Get("Uuid")) + } + + if Uuid == 0 { + SetHeader(w) + //logger.Error("Uuid is nil!") + return + } + result, _ := ioutil.ReadAll(r.Body) + r.Body.Close() + + s := string(result) + logger.Info("ClearData , body:%v,uuid=%v", s, Uuid) + + redishandler.GetRedisClient().HDel(redis.USER_DATA_KEY, strconv.Itoa(Uuid)) + redishandler.GetRedisClient().HDel(redis.USER_TASKINFO_LIST, strconv.Itoa(Uuid)) + redishandler.GetRedisClient().HDel(redis.USER_ACHIEVEMENTINFO_LIST, strconv.Itoa(Uuid)) + redishandler.GetRedisClient().HDel(redis.USER_WITHDRAW_RECORDLIST, strconv.Itoa(Uuid)) + + fmt.Fprint(w, "success!") +} + func Usersign(w http.ResponseWriter, r *http.Request) { Uuid := 0 -- libgit2 0.21.0