Commit b4dc31232ae655d9d9484f445da8ee6a5486949e
1 parent
fd97af7a
Exists in
master
提交
Showing
3 changed files
with
46 additions
and
0 deletions
Show diff stats
src/HttpServer/logic/datadef.go
@@ -77,6 +77,15 @@ type UserInfoResp struct { | @@ -77,6 +77,15 @@ type UserInfoResp struct { | ||
77 | Data UserInfoData `json:"data"` | 77 | Data UserInfoData `json:"data"` |
78 | } | 78 | } |
79 | 79 | ||
80 | +type AddAdData struct { | ||
81 | +} | ||
82 | + | ||
83 | +type AddAdResp struct { | ||
84 | + Code int `json:"code"` | ||
85 | + Message string `json:"message"` | ||
86 | + Data AddAdData `json:"data"` | ||
87 | +} | ||
88 | + | ||
80 | type DataDesc struct { | 89 | type DataDesc struct { |
81 | Pos int `json:"pos"` | 90 | Pos int `json:"pos"` |
82 | Catlv int `json:"cat_lv"` | 91 | Catlv int `json:"cat_lv"` |
src/HttpServer/logic/httpserver.go
@@ -138,6 +138,7 @@ func startServerHttpServe() { | @@ -138,6 +138,7 @@ func startServerHttpServe() { | ||
138 | http.HandleFunc("/api/gambling/autoChoose", AutoChoose) //自动选号码 | 138 | http.HandleFunc("/api/gambling/autoChoose", AutoChoose) //自动选号码 |
139 | http.HandleFunc("/api/gambling/removeCat", RemoveCat) //清除猫 | 139 | http.HandleFunc("/api/gambling/removeCat", RemoveCat) //清除猫 |
140 | http.HandleFunc("/api/user/info", UserInfo) //个人信息 | 140 | http.HandleFunc("/api/user/info", UserInfo) //个人信息 |
141 | + http.HandleFunc("api/ad/add", AddAd) //看广告 | ||
141 | 142 | ||
142 | /////---------------------------------------------------------------------old | 143 | /////---------------------------------------------------------------------old |
143 | //http.HandleFunc("/happycat/exchangetwoPos", ExchangePos) //交换位置 | 144 | //http.HandleFunc("/happycat/exchangetwoPos", ExchangePos) //交换位置 |
@@ -1110,6 +1111,24 @@ func UserInfo(w http.ResponseWriter, r *http.Request) { | @@ -1110,6 +1111,24 @@ func UserInfo(w http.ResponseWriter, r *http.Request) { | ||
1110 | HandlerUserInfo(w, s, Uuid) | 1111 | HandlerUserInfo(w, s, Uuid) |
1111 | } | 1112 | } |
1112 | 1113 | ||
1114 | +func AddAd(w http.ResponseWriter, r *http.Request) { | ||
1115 | + Uuid := 0 | ||
1116 | + if len(r.Header) > 0 { | ||
1117 | + Uuid, _ = strconv.Atoi(r.Header.Get("uid")) | ||
1118 | + } | ||
1119 | + if Uuid == 0 { | ||
1120 | + SetHeader(w) | ||
1121 | + return | ||
1122 | + } | ||
1123 | + result, _ := ioutil.ReadAll(r.Body) | ||
1124 | + r.Body.Close() | ||
1125 | + | ||
1126 | + s := string(result) | ||
1127 | + logger.Info("AddAd , body:%v,uuid=%v", s, Uuid) | ||
1128 | + | ||
1129 | + HandlerAddAd(w, s, Uuid) | ||
1130 | +} | ||
1131 | + | ||
1113 | func TestaddCat(w http.ResponseWriter, r *http.Request) { | 1132 | func TestaddCat(w http.ResponseWriter, r *http.Request) { |
1114 | Uuid := 0 | 1133 | Uuid := 0 |
1115 | if len(r.Header) > 0 { | 1134 | if len(r.Header) > 0 { |
src/HttpServer/logic/logic.go
@@ -230,6 +230,24 @@ func HandlerDoBuyCat(w http.ResponseWriter, data string, uuid int) { | @@ -230,6 +230,24 @@ func HandlerDoBuyCat(w http.ResponseWriter, data string, uuid int) { | ||
230 | fmt.Fprint(w, string(respstr)) | 230 | fmt.Fprint(w, string(respstr)) |
231 | } | 231 | } |
232 | 232 | ||
233 | +func HandlerAddAd(w http.ResponseWriter, data string, uuid int) { | ||
234 | + SetHeader(w) | ||
235 | + var resp AddAdResp | ||
236 | + resp.Code = 0 | ||
237 | + resp.Message = "success" | ||
238 | + | ||
239 | + for { | ||
240 | + | ||
241 | + //暂时没处理 | ||
242 | + | ||
243 | + break | ||
244 | + } | ||
245 | + | ||
246 | + //回包 | ||
247 | + respstr, _ := json.Marshal(&resp) | ||
248 | + fmt.Fprint(w, string(respstr)) | ||
249 | +} | ||
250 | + | ||
233 | func HandlerUserInfo(w http.ResponseWriter, data string, uuid int) { | 251 | func HandlerUserInfo(w http.ResponseWriter, data string, uuid int) { |
234 | SetHeader(w) | 252 | SetHeader(w) |
235 | var resp UserInfoResp | 253 | var resp UserInfoResp |