From b4dc31232ae655d9d9484f445da8ee6a5486949e Mon Sep 17 00:00:00 2001 From: 陆恒 Date: Mon, 15 Jun 2020 14:55:05 +0800 Subject: [PATCH] 提交 --- src/HttpServer/logic/datadef.go | 9 +++++++++ src/HttpServer/logic/httpserver.go | 19 +++++++++++++++++++ src/HttpServer/logic/logic.go | 18 ++++++++++++++++++ 3 files changed, 46 insertions(+), 0 deletions(-) diff --git a/src/HttpServer/logic/datadef.go b/src/HttpServer/logic/datadef.go index e3956e1..cde3931 100644 --- a/src/HttpServer/logic/datadef.go +++ b/src/HttpServer/logic/datadef.go @@ -77,6 +77,15 @@ type UserInfoResp struct { Data UserInfoData `json:"data"` } +type AddAdData struct { +} + +type AddAdResp struct { + Code int `json:"code"` + Message string `json:"message"` + Data AddAdData `json:"data"` +} + type DataDesc struct { Pos int `json:"pos"` Catlv int `json:"cat_lv"` diff --git a/src/HttpServer/logic/httpserver.go b/src/HttpServer/logic/httpserver.go index ae7aa3c..a5a5c85 100644 --- a/src/HttpServer/logic/httpserver.go +++ b/src/HttpServer/logic/httpserver.go @@ -138,6 +138,7 @@ func startServerHttpServe() { http.HandleFunc("/api/gambling/autoChoose", AutoChoose) //自动选号码 http.HandleFunc("/api/gambling/removeCat", RemoveCat) //清除猫 http.HandleFunc("/api/user/info", UserInfo) //个人信息 + http.HandleFunc("api/ad/add", AddAd) //看广告 /////---------------------------------------------------------------------old //http.HandleFunc("/happycat/exchangetwoPos", ExchangePos) //交换位置 @@ -1110,6 +1111,24 @@ func UserInfo(w http.ResponseWriter, r *http.Request) { HandlerUserInfo(w, s, Uuid) } +func AddAd(w http.ResponseWriter, r *http.Request) { + Uuid := 0 + if len(r.Header) > 0 { + Uuid, _ = strconv.Atoi(r.Header.Get("uid")) + } + if Uuid == 0 { + SetHeader(w) + return + } + result, _ := ioutil.ReadAll(r.Body) + r.Body.Close() + + s := string(result) + logger.Info("AddAd , body:%v,uuid=%v", s, Uuid) + + HandlerAddAd(w, s, Uuid) +} + func TestaddCat(w http.ResponseWriter, r *http.Request) { Uuid := 0 if len(r.Header) > 0 { diff --git a/src/HttpServer/logic/logic.go b/src/HttpServer/logic/logic.go index b220b7b..17ce62b 100644 --- a/src/HttpServer/logic/logic.go +++ b/src/HttpServer/logic/logic.go @@ -230,6 +230,24 @@ func HandlerDoBuyCat(w http.ResponseWriter, data string, uuid int) { fmt.Fprint(w, string(respstr)) } +func HandlerAddAd(w http.ResponseWriter, data string, uuid int) { + SetHeader(w) + var resp AddAdResp + resp.Code = 0 + resp.Message = "success" + + for { + + //暂时没处理 + + break + } + + //回包 + respstr, _ := json.Marshal(&resp) + fmt.Fprint(w, string(respstr)) +} + func HandlerUserInfo(w http.ResponseWriter, data string, uuid int) { SetHeader(w) var resp UserInfoResp -- libgit2 0.21.0