Commit 738472bece5330aff8dfee52cd6564e1e8c59f8a
1 parent
62901e9a
Exists in
master
增加新的接口
Showing
7 changed files
with
339 additions
and
37 deletions
Show diff stats
src/HttpServer/jsonconf/CatConfig.json
@@ -8,7 +8,8 @@ | @@ -8,7 +8,8 @@ | ||
8 | "gold_get": "1", | 8 | "gold_get": "1", |
9 | "ratio": 1.07, | 9 | "ratio": 1.07, |
10 | "increse_limit": 100, | 10 | "increse_limit": 100, |
11 | - "interval": 1 | 11 | + "interval": 1, |
12 | + "redpacket": 0 | ||
12 | }, | 13 | }, |
13 | { | 14 | { |
14 | "id": 2, | 15 | "id": 2, |
@@ -19,7 +20,8 @@ | @@ -19,7 +20,8 @@ | ||
19 | "gold_get": "3", | 20 | "gold_get": "3", |
20 | "ratio": 1.1, | 21 | "ratio": 1.1, |
21 | "increse_limit": 70, | 22 | "increse_limit": 70, |
22 | - "interval": 1 | 23 | + "interval": 1, |
24 | + "redpacket": 1.2 | ||
23 | }, | 25 | }, |
24 | { | 26 | { |
25 | "id": 3, | 27 | "id": 3, |
@@ -30,7 +32,8 @@ | @@ -30,7 +32,8 @@ | ||
30 | "gold_get": "7", | 32 | "gold_get": "7", |
31 | "ratio": 1.12, | 33 | "ratio": 1.12, |
32 | "increse_limit": 60, | 34 | "increse_limit": 60, |
33 | - "interval": 1 | 35 | + "interval": 1, |
36 | + "redpacket": 1.2 | ||
34 | }, | 37 | }, |
35 | { | 38 | { |
36 | "id": 4, | 39 | "id": 4, |
@@ -41,7 +44,8 @@ | @@ -41,7 +44,8 @@ | ||
41 | "gold_get": "15", | 44 | "gold_get": "15", |
42 | "ratio": 1.17, | 45 | "ratio": 1.17, |
43 | "increse_limit": 40, | 46 | "increse_limit": 40, |
44 | - "interval": 1 | 47 | + "interval": 1, |
48 | + "redpacket": 1.16 | ||
45 | }, | 49 | }, |
46 | { | 50 | { |
47 | "id": 5, | 51 | "id": 5, |
@@ -52,7 +56,8 @@ | @@ -52,7 +56,8 @@ | ||
52 | "gold_get": "30", | 56 | "gold_get": "30", |
53 | "ratio": 1.17, | 57 | "ratio": 1.17, |
54 | "increse_limit": 35, | 58 | "increse_limit": 35, |
55 | - "interval": 1.5 | 59 | + "interval": 1.5, |
60 | + "redpacket": 1.06 | ||
56 | }, | 61 | }, |
57 | { | 62 | { |
58 | "id": 6, | 63 | "id": 6, |
@@ -63,7 +68,8 @@ | @@ -63,7 +68,8 @@ | ||
63 | "gold_get": "61", | 68 | "gold_get": "61", |
64 | "ratio": 1.17, | 69 | "ratio": 1.17, |
65 | "increse_limit": 30, | 70 | "increse_limit": 30, |
66 | - "interval": 1.5 | 71 | + "interval": 1.5, |
72 | + "redpacket": 1.02 | ||
67 | }, | 73 | }, |
68 | { | 74 | { |
69 | "id": 7, | 75 | "id": 7, |
@@ -74,7 +80,8 @@ | @@ -74,7 +80,8 @@ | ||
74 | "gold_get": "124", | 80 | "gold_get": "124", |
75 | "ratio": 1.17, | 81 | "ratio": 1.17, |
76 | "increse_limit": 25, | 82 | "increse_limit": 25, |
77 | - "interval": 1.5 | 83 | + "interval": 1.5, |
84 | + "redpacket": 0.86 | ||
78 | }, | 85 | }, |
79 | { | 86 | { |
80 | "id": 8, | 87 | "id": 8, |
@@ -85,7 +92,8 @@ | @@ -85,7 +92,8 @@ | ||
85 | "gold_get": "250", | 92 | "gold_get": "250", |
86 | "ratio": 1.17, | 93 | "ratio": 1.17, |
87 | "increse_limit": 24, | 94 | "increse_limit": 24, |
88 | - "interval": 1.5 | 95 | + "interval": 1.5, |
96 | + "redpacket": 0.66 | ||
89 | }, | 97 | }, |
90 | { | 98 | { |
91 | "id": 9, | 99 | "id": 9, |
@@ -96,7 +104,8 @@ | @@ -96,7 +104,8 @@ | ||
96 | "gold_get": "504", | 104 | "gold_get": "504", |
97 | "ratio": 1.17, | 105 | "ratio": 1.17, |
98 | "increse_limit": 23, | 106 | "increse_limit": 23, |
99 | - "interval": 2 | 107 | + "interval": 2, |
108 | + "redpacket": 0.64 | ||
100 | }, | 109 | }, |
101 | { | 110 | { |
102 | "id": 10, | 111 | "id": 10, |
@@ -107,7 +116,8 @@ | @@ -107,7 +116,8 @@ | ||
107 | "gold_get": "1015", | 116 | "gold_get": "1015", |
108 | "ratio": 1.17, | 117 | "ratio": 1.17, |
109 | "increse_limit": 22, | 118 | "increse_limit": 22, |
110 | - "interval": 2 | 119 | + "interval": 2, |
120 | + "redpacket": 0.86 | ||
111 | }, | 121 | }, |
112 | { | 122 | { |
113 | "id": 11, | 123 | "id": 11, |
@@ -118,7 +128,8 @@ | @@ -118,7 +128,8 @@ | ||
118 | "gold_get": "2043", | 128 | "gold_get": "2043", |
119 | "ratio": 1.17, | 129 | "ratio": 1.17, |
120 | "increse_limit": 21, | 130 | "increse_limit": 21, |
121 | - "interval": 2 | 131 | + "interval": 2, |
132 | + "redpacket": 0.42 | ||
122 | }, | 133 | }, |
123 | { | 134 | { |
124 | "id": 12, | 135 | "id": 12, |
@@ -129,7 +140,8 @@ | @@ -129,7 +140,8 @@ | ||
129 | "gold_get": "4112", | 140 | "gold_get": "4112", |
130 | "ratio": 1.17, | 141 | "ratio": 1.17, |
131 | "increse_limit": 20, | 142 | "increse_limit": 20, |
132 | - "interval": 2 | 143 | + "interval": 2, |
144 | + "redpacket": 0.36 | ||
133 | }, | 145 | }, |
134 | { | 146 | { |
135 | "id": 13, | 147 | "id": 13, |
@@ -140,7 +152,8 @@ | @@ -140,7 +152,8 @@ | ||
140 | "gold_get": "8276", | 152 | "gold_get": "8276", |
141 | "ratio": 1.17, | 153 | "ratio": 1.17, |
142 | "increse_limit": 19, | 154 | "increse_limit": 19, |
143 | - "interval": 2.5 | 155 | + "interval": 2.5, |
156 | + "redpacket": 0.32 | ||
144 | }, | 157 | }, |
145 | { | 158 | { |
146 | "id": 14, | 159 | "id": 14, |
@@ -151,7 +164,8 @@ | @@ -151,7 +164,8 @@ | ||
151 | "gold_get": "16657", | 164 | "gold_get": "16657", |
152 | "ratio": 1.17, | 165 | "ratio": 1.17, |
153 | "increse_limit": 18, | 166 | "increse_limit": 18, |
154 | - "interval": 2.5 | 167 | + "interval": 2.5, |
168 | + "redpacket": 0.28 | ||
155 | }, | 169 | }, |
156 | { | 170 | { |
157 | "id": 15, | 171 | "id": 15, |
@@ -162,7 +176,8 @@ | @@ -162,7 +176,8 @@ | ||
162 | "gold_get": "33523", | 176 | "gold_get": "33523", |
163 | "ratio": 1.17, | 177 | "ratio": 1.17, |
164 | "increse_limit": 15, | 178 | "increse_limit": 15, |
165 | - "interval": 2.5 | 179 | + "interval": 2.5, |
180 | + "redpacket": 0.28 | ||
166 | }, | 181 | }, |
167 | { | 182 | { |
168 | "id": 16, | 183 | "id": 16, |
@@ -173,7 +188,8 @@ | @@ -173,7 +188,8 @@ | ||
173 | "gold_get": "67466", | 188 | "gold_get": "67466", |
174 | "ratio": 1.17, | 189 | "ratio": 1.17, |
175 | "increse_limit": 16, | 190 | "increse_limit": 16, |
176 | - "interval": 2.5 | 191 | + "interval": 2.5, |
192 | + "redpacket": 0.22 | ||
177 | }, | 193 | }, |
178 | { | 194 | { |
179 | "id": 17, | 195 | "id": 17, |
@@ -184,7 +200,8 @@ | @@ -184,7 +200,8 @@ | ||
184 | "gold_get": "135778", | 200 | "gold_get": "135778", |
185 | "ratio": 1.17, | 201 | "ratio": 1.17, |
186 | "increse_limit": 15, | 202 | "increse_limit": 15, |
187 | - "interval": 3 | 203 | + "interval": 3, |
204 | + "redpacket": 0.18 | ||
188 | }, | 205 | }, |
189 | { | 206 | { |
190 | "id": 18, | 207 | "id": 18, |
@@ -195,7 +212,8 @@ | @@ -195,7 +212,8 @@ | ||
195 | "gold_get": "273255", | 212 | "gold_get": "273255", |
196 | "ratio": 1.17, | 213 | "ratio": 1.17, |
197 | "increse_limit": 14, | 214 | "increse_limit": 14, |
198 | - "interval": 3 | 215 | + "interval": 3, |
216 | + "redpacket": 0.48 | ||
199 | }, | 217 | }, |
200 | { | 218 | { |
201 | "id": 19, | 219 | "id": 19, |
@@ -206,7 +224,8 @@ | @@ -206,7 +224,8 @@ | ||
206 | "gold_get": "549930", | 224 | "gold_get": "549930", |
207 | "ratio": 1.17, | 225 | "ratio": 1.17, |
208 | "increse_limit": 13, | 226 | "increse_limit": 13, |
209 | - "interval": 3 | 227 | + "interval": 3, |
228 | + "redpacket": 0.18 | ||
210 | }, | 229 | }, |
211 | { | 230 | { |
212 | "id": 20, | 231 | "id": 20, |
@@ -217,7 +236,8 @@ | @@ -217,7 +236,8 @@ | ||
217 | "gold_get": "1106700", | 236 | "gold_get": "1106700", |
218 | "ratio": 1.17, | 237 | "ratio": 1.17, |
219 | "increse_limit": 12, | 238 | "increse_limit": 12, |
220 | - "interval": 3 | 239 | + "interval": 3, |
240 | + "redpacket": 0.18 | ||
221 | }, | 241 | }, |
222 | { | 242 | { |
223 | "id": 21, | 243 | "id": 21, |
@@ -228,7 +248,8 @@ | @@ -228,7 +248,8 @@ | ||
228 | "gold_get": "2273000", | 248 | "gold_get": "2273000", |
229 | "ratio": 1.17, | 249 | "ratio": 1.17, |
230 | "increse_limit": 11, | 250 | "increse_limit": 11, |
231 | - "interval": 3.5 | 251 | + "interval": 3.5, |
252 | + "redpacket": 0.18 | ||
232 | }, | 253 | }, |
233 | { | 254 | { |
234 | "id": 22, | 255 | "id": 22, |
@@ -239,7 +260,8 @@ | @@ -239,7 +260,8 @@ | ||
239 | "gold_get": "4482600", | 260 | "gold_get": "4482600", |
240 | "ratio": 1.17, | 261 | "ratio": 1.17, |
241 | "increse_limit": 10, | 262 | "increse_limit": 10, |
242 | - "interval": 3.5 | 263 | + "interval": 3.5, |
264 | + "redpacket": 0.18 | ||
243 | }, | 265 | }, |
244 | { | 266 | { |
245 | "id": 23, | 267 | "id": 23, |
@@ -250,7 +272,8 @@ | @@ -250,7 +272,8 @@ | ||
250 | "gold_get": "9021200", | 272 | "gold_get": "9021200", |
251 | "ratio": 1.17, | 273 | "ratio": 1.17, |
252 | "increse_limit": 9, | 274 | "increse_limit": 9, |
253 | - "interval": 3.5 | 275 | + "interval": 3.5, |
276 | + "redpacket": 0.18 | ||
254 | }, | 277 | }, |
255 | { | 278 | { |
256 | "id": 24, | 279 | "id": 24, |
@@ -261,7 +284,8 @@ | @@ -261,7 +284,8 @@ | ||
261 | "gold_get": "18155000", | 284 | "gold_get": "18155000", |
262 | "ratio": 1.17, | 285 | "ratio": 1.17, |
263 | "increse_limit": 8, | 286 | "increse_limit": 8, |
264 | - "interval": 3.5 | 287 | + "interval": 3.5, |
288 | + "redpacket": 0.18 | ||
265 | }, | 289 | }, |
266 | { | 290 | { |
267 | "id": 25, | 291 | "id": 25, |
@@ -272,7 +296,8 @@ | @@ -272,7 +296,8 @@ | ||
272 | "gold_get": "36538000", | 296 | "gold_get": "36538000", |
273 | "ratio": 1.17, | 297 | "ratio": 1.17, |
274 | "increse_limit": 8, | 298 | "increse_limit": 8, |
275 | - "interval": 4 | 299 | + "interval": 4, |
300 | + "redpacket": 0.18 | ||
276 | }, | 301 | }, |
277 | { | 302 | { |
278 | "id": 26, | 303 | "id": 26, |
@@ -283,7 +308,8 @@ | @@ -283,7 +308,8 @@ | ||
283 | "gold_get": "73533000", | 308 | "gold_get": "73533000", |
284 | "ratio": 1.17, | 309 | "ratio": 1.17, |
285 | "increse_limit": 8, | 310 | "increse_limit": 8, |
286 | - "interval": 4 | 311 | + "interval": 4, |
312 | + "redpacket": 0.18 | ||
287 | }, | 313 | }, |
288 | { | 314 | { |
289 | "id": 27, | 315 | "id": 27, |
@@ -294,7 +320,8 @@ | @@ -294,7 +320,8 @@ | ||
294 | "gold_get": "147990000", | 320 | "gold_get": "147990000", |
295 | "ratio": 1.17, | 321 | "ratio": 1.17, |
296 | "increse_limit": 8, | 322 | "increse_limit": 8, |
297 | - "interval": 4 | 323 | + "interval": 4, |
324 | + "redpacket": 0.18 | ||
298 | }, | 325 | }, |
299 | { | 326 | { |
300 | "id": 28, | 327 | "id": 28, |
@@ -305,7 +332,8 @@ | @@ -305,7 +332,8 @@ | ||
305 | "gold_get": "297830000", | 332 | "gold_get": "297830000", |
306 | "ratio": 1.17, | 333 | "ratio": 1.17, |
307 | "increse_limit": 8, | 334 | "increse_limit": 8, |
308 | - "interval": 4 | 335 | + "interval": 4, |
336 | + "redpacket": 0.18 | ||
309 | }, | 337 | }, |
310 | { | 338 | { |
311 | "id": 29, | 339 | "id": 29, |
@@ -316,7 +344,8 @@ | @@ -316,7 +344,8 @@ | ||
316 | "gold_get": "599380000", | 344 | "gold_get": "599380000", |
317 | "ratio": 1.17, | 345 | "ratio": 1.17, |
318 | "increse_limit": 8, | 346 | "increse_limit": 8, |
319 | - "interval": 4.5 | 347 | + "interval": 4.5, |
348 | + "redpacket": 0.18 | ||
320 | }, | 349 | }, |
321 | { | 350 | { |
322 | "id": 30, | 351 | "id": 30, |
@@ -327,7 +356,8 @@ | @@ -327,7 +356,8 @@ | ||
327 | "gold_get": "1206300000", | 356 | "gold_get": "1206300000", |
328 | "ratio": 1.17, | 357 | "ratio": 1.17, |
329 | "increse_limit": 8, | 358 | "increse_limit": 8, |
330 | - "interval": 4.5 | 359 | + "interval": 4.5, |
360 | + "redpacket": 0.18 | ||
331 | }, | 361 | }, |
332 | { | 362 | { |
333 | "id": 31, | 363 | "id": 31, |
@@ -338,7 +368,8 @@ | @@ -338,7 +368,8 @@ | ||
338 | "gold_get": "2427600000", | 368 | "gold_get": "2427600000", |
339 | "ratio": 1.17, | 369 | "ratio": 1.17, |
340 | "increse_limit": 8, | 370 | "increse_limit": 8, |
341 | - "interval": 4.5 | 371 | + "interval": 4.5, |
372 | + "redpacket": 0.18 | ||
342 | }, | 373 | }, |
343 | { | 374 | { |
344 | "id": 32, | 375 | "id": 32, |
@@ -349,7 +380,8 @@ | @@ -349,7 +380,8 @@ | ||
349 | "gold_get": "4885600000", | 380 | "gold_get": "4885600000", |
350 | "ratio": 1.17, | 381 | "ratio": 1.17, |
351 | "increse_limit": 8, | 382 | "increse_limit": 8, |
352 | - "interval": 4.5 | 383 | + "interval": 4.5, |
384 | + "redpacket": 0.18 | ||
353 | }, | 385 | }, |
354 | { | 386 | { |
355 | "id": 33, | 387 | "id": 33, |
@@ -360,7 +392,8 @@ | @@ -360,7 +392,8 @@ | ||
360 | "gold_get": "9832400000", | 392 | "gold_get": "9832400000", |
361 | "ratio": 1.17, | 393 | "ratio": 1.17, |
362 | "increse_limit": 8, | 394 | "increse_limit": 8, |
363 | - "interval": 5 | 395 | + "interval": 5, |
396 | + "redpacket": 0.18 | ||
364 | }, | 397 | }, |
365 | { | 398 | { |
366 | "id": 34, | 399 | "id": 34, |
@@ -371,7 +404,8 @@ | @@ -371,7 +404,8 @@ | ||
371 | "gold_get": "19788000000", | 404 | "gold_get": "19788000000", |
372 | "ratio": 1.17, | 405 | "ratio": 1.17, |
373 | "increse_limit": 8, | 406 | "increse_limit": 8, |
374 | - "interval": 5 | 407 | + "interval": 5, |
408 | + "redpacket": 0.18 | ||
375 | }, | 409 | }, |
376 | { | 410 | { |
377 | "id": 35, | 411 | "id": 35, |
@@ -382,7 +416,8 @@ | @@ -382,7 +416,8 @@ | ||
382 | "gold_get": "39823000000", | 416 | "gold_get": "39823000000", |
383 | "ratio": 1.17, | 417 | "ratio": 1.17, |
384 | "increse_limit": 8, | 418 | "increse_limit": 8, |
385 | - "interval": 5 | 419 | + "interval": 5, |
420 | + "redpacket": 0.18 | ||
386 | }, | 421 | }, |
387 | { | 422 | { |
388 | "id": 36, | 423 | "id": 36, |
@@ -393,7 +428,8 @@ | @@ -393,7 +428,8 @@ | ||
393 | "gold_get": "80145000000", | 428 | "gold_get": "80145000000", |
394 | "ratio": 1.17, | 429 | "ratio": 1.17, |
395 | "increse_limit": 8, | 430 | "increse_limit": 8, |
396 | - "interval": 5 | 431 | + "interval": 5, |
432 | + "redpacket": 0.18 | ||
397 | }, | 433 | }, |
398 | { | 434 | { |
399 | "id": 37, | 435 | "id": 37, |
@@ -404,6 +440,7 @@ | @@ -404,6 +440,7 @@ | ||
404 | "gold_get": "80145000000", | 440 | "gold_get": "80145000000", |
405 | "ratio": 1.17, | 441 | "ratio": 1.17, |
406 | "increse_limit": 8, | 442 | "increse_limit": 8, |
407 | - "interval": 5 | 443 | + "interval": 5, |
444 | + "redpacket": 0.18 | ||
408 | } | 445 | } |
409 | ] | 446 | ] |
410 | \ No newline at end of file | 447 | \ No newline at end of file |
src/HttpServer/jsonconf/jsonconf.go
@@ -29,6 +29,7 @@ type CatDesc struct { | @@ -29,6 +29,7 @@ type CatDesc struct { | ||
29 | Ratio float32 `json:"ratio"` | 29 | Ratio float32 `json:"ratio"` |
30 | Increse_limit int `json:"increse_limit"` | 30 | Increse_limit int `json:"increse_limit"` |
31 | Interval float32 `json:"interval"` | 31 | Interval float32 `json:"interval"` |
32 | + Redpacket float32 `json:"redpacket"` | ||
32 | } | 33 | } |
33 | 34 | ||
34 | type RedCatDesc struct { | 35 | type RedCatDesc struct { |
src/HttpServer/logic/constdef.go
@@ -67,6 +67,7 @@ const ( | @@ -67,6 +67,7 @@ const ( | ||
67 | DOUBLETIMELAST = 300 //金币加速持续时间 | 67 | DOUBLETIMELAST = 300 //金币加速持续时间 |
68 | FLYBOXNUMLIMIT = 6 //飞天宝箱每日次数限制 | 68 | FLYBOXNUMLIMIT = 6 //飞天宝箱每日次数限制 |
69 | EMPTYBOXLIMIT = 20 //空格宝箱每日限制次数 | 69 | EMPTYBOXLIMIT = 20 //空格宝箱每日限制次数 |
70 | + SHAKETIMELIMIT = 20 //摇一摇每日次数 | ||
70 | ) | 71 | ) |
71 | 72 | ||
72 | var CATNAMELIST = []string{ | 73 | var CATNAMELIST = []string{ |
src/HttpServer/logic/datadef.go
@@ -109,6 +109,7 @@ type GetUserDataData struct { | @@ -109,6 +109,7 @@ type GetUserDataData struct { | ||
109 | Coin string `json:"coin"` | 109 | Coin string `json:"coin"` |
110 | Now int `json:"now"` | 110 | Now int `json:"now"` |
111 | TimingRewardTimes int `json:"timingRewardTimes"` | 111 | TimingRewardTimes int `json:"timingRewardTimes"` |
112 | + Shakeleftcnt int `json:"shakeleftcnt"` | ||
112 | } | 113 | } |
113 | 114 | ||
114 | type GetUserDataResp struct { | 115 | type GetUserDataResp struct { |
@@ -237,6 +238,18 @@ type GethorsemessageResp struct { | @@ -237,6 +238,18 @@ type GethorsemessageResp struct { | ||
237 | Data GethorsemessageData `json:"data"` | 238 | Data GethorsemessageData `json:"data"` |
238 | } | 239 | } |
239 | 240 | ||
241 | +type QuertlvredbagData struct { | ||
242 | + Catlv int `json:"catlv"` | ||
243 | + Redbag float32 `json:"redbag"` | ||
244 | + Canfetch int `json:"canfetch"` | ||
245 | +} | ||
246 | + | ||
247 | +type QuertlvredbagResp struct { | ||
248 | + Code int `json:"code"` | ||
249 | + Message string `json:"message"` | ||
250 | + Data QuertlvredbagData `json:"data"` | ||
251 | +} | ||
252 | + | ||
240 | type AddAdData struct { | 253 | type AddAdData struct { |
241 | } | 254 | } |
242 | 255 | ||
@@ -540,6 +553,35 @@ type DoBuyCatResp struct { | @@ -540,6 +553,35 @@ type DoBuyCatResp struct { | ||
540 | Data DoBuyCatData `json:"data"` | 553 | Data DoBuyCatData `json:"data"` |
541 | } | 554 | } |
542 | 555 | ||
556 | +type UploadusercostReq struct { | ||
557 | + Rtype int `json:"rtype"` | ||
558 | + Value int `json:"value"` | ||
559 | +} | ||
560 | + | ||
561 | +type UploadusercostData struct { | ||
562 | + Lefttime int `json:"lefttime"` | ||
563 | +} | ||
564 | + | ||
565 | +type UploadusercostResp struct { | ||
566 | + Code int `json:"code"` | ||
567 | + Message string `json:"message"` | ||
568 | + Data UploadusercostData `json:"data"` | ||
569 | +} | ||
570 | + | ||
571 | +type FetchlvredbagReq struct { | ||
572 | + Catlv int `json:"catlv"` | ||
573 | +} | ||
574 | + | ||
575 | +type FetchlvredbagData struct { | ||
576 | + Redbag float32 `json:"redbag"` | ||
577 | +} | ||
578 | + | ||
579 | +type FetchlvredbagResp struct { | ||
580 | + Code int `json:"code"` | ||
581 | + Message string `json:"message"` | ||
582 | + Data FetchlvredbagData `json:"data"` | ||
583 | +} | ||
584 | + | ||
543 | type QueryWareHouseData struct { | 585 | type QueryWareHouseData struct { |
544 | CatList []int `json:"catList"` | 586 | CatList []int `json:"catList"` |
545 | CatCapacity int `json:"catCapacity"` | 587 | CatCapacity int `json:"catCapacity"` |
@@ -991,6 +1033,8 @@ type UserData struct { | @@ -991,6 +1033,8 @@ type UserData struct { | ||
991 | LeftOfflineTimes int //离线奖励剩余领取次数 | 1033 | LeftOfflineTimes int //离线奖励剩余领取次数 |
992 | EmptyBoxLeftTime int //空格宝箱生意领取次数 | 1034 | EmptyBoxLeftTime int //空格宝箱生意领取次数 |
993 | IsResetToday int //当天中午十二点是否重置 0表示未 1表示已重置 | 1035 | IsResetToday int //当天中午十二点是否重置 0表示未 1表示已重置 |
1036 | + ShakeTime int //摇一摇次数 | ||
1037 | + WaitFetchLv []int //当前可领取的等级红包等级 | ||
994 | WaitFetchList []LimitListDesc //待领取的分红猫列表 领取完删除 | 1038 | WaitFetchList []LimitListDesc //待领取的分红猫列表 领取完删除 |
995 | CatShopInfo CatShopData //猫咖门店数据 | 1039 | CatShopInfo CatShopData //猫咖门店数据 |
996 | Taskinfo TaskData //任务数据 | 1040 | Taskinfo TaskData //任务数据 |
src/HttpServer/logic/function.go
@@ -557,6 +557,7 @@ func (u *UserData) HandlePassDay() { | @@ -557,6 +557,7 @@ func (u *UserData) HandlePassDay() { | ||
557 | u.LeftTimingRewardTimes = TIMEINGREWARDLIMIT | 557 | u.LeftTimingRewardTimes = TIMEINGREWARDLIMIT |
558 | u.LeftOfflineTimes = OFFLINETIMESLIMIT | 558 | u.LeftOfflineTimes = OFFLINETIMESLIMIT |
559 | u.EmptyBoxLeftTime = EMPTYBOXLIMIT | 559 | u.EmptyBoxLeftTime = EMPTYBOXLIMIT |
560 | + u.ShakeTime = SHAKETIMELIMIT | ||
560 | 561 | ||
561 | u.IsResetToday = 0 | 562 | u.IsResetToday = 0 |
562 | /*randint := rand.Intn(100) | 563 | /*randint := rand.Intn(100) |
@@ -642,6 +643,7 @@ func InitUserInfo(data *UserLoginReq, resp *UserLoginResp, uuid int) { | @@ -642,6 +643,7 @@ func InitUserInfo(data *UserLoginReq, resp *UserLoginResp, uuid int) { | ||
642 | udata.LeftTimingRewardTimes = TIMEINGREWARDLIMIT | 643 | udata.LeftTimingRewardTimes = TIMEINGREWARDLIMIT |
643 | udata.LeftOfflineTimes = OFFLINETIMESLIMIT | 644 | udata.LeftOfflineTimes = OFFLINETIMESLIMIT |
644 | udata.EmptyBoxLeftTime = EMPTYBOXLIMIT | 645 | udata.EmptyBoxLeftTime = EMPTYBOXLIMIT |
646 | + udata.ShakeTime = SHAKETIMELIMIT | ||
645 | /*randint := rand.Intn(100) | 647 | /*randint := rand.Intn(100) |
646 | floatval := float32(randint) / 100 | 648 | floatval := float32(randint) / 100 |
647 | udata.TodayZhaocai = 180 + floatval*/ | 649 | udata.TodayZhaocai = 180 + floatval*/ |
src/HttpServer/logic/httpserver.go
@@ -186,6 +186,9 @@ func startServerHttpServe() { | @@ -186,6 +186,9 @@ func startServerHttpServe() { | ||
186 | http.HandleFunc("/api/happycat/getcash", Getcash) // 请求提现 | 186 | http.HandleFunc("/api/happycat/getcash", Getcash) // 请求提现 |
187 | http.HandleFunc("/api/happycat/getcashrecord", Getcashrecord) // 请求提现 | 187 | http.HandleFunc("/api/happycat/getcashrecord", Getcashrecord) // 请求提现 |
188 | http.HandleFunc("/api/happycat/gethorsemessage", Gethorsemessage) // 请求跑马灯 | 188 | http.HandleFunc("/api/happycat/gethorsemessage", Gethorsemessage) // 请求跑马灯 |
189 | + http.HandleFunc("/api/happycat/uploadusercost", Uploadusercost) // 上报玩家消耗次数(摇一摇) | ||
190 | + http.HandleFunc("/api/happycat/quertlvredbag", Quertlvredbag) // 上报玩家消耗次数(摇一摇) | ||
191 | + http.HandleFunc("/api/happycat/fetchlvredbag", Fetchlvredbag) // 请求领取等级红包 | ||
189 | 192 | ||
190 | /////---------------------------------------------------------------------old | 193 | /////---------------------------------------------------------------------old |
191 | //http.HandleFunc("/happycat/exchangetwoPos", ExchangePos) //交换位置 | 194 | //http.HandleFunc("/happycat/exchangetwoPos", ExchangePos) //交换位置 |
@@ -1196,6 +1199,60 @@ func AddAd(w http.ResponseWriter, r *http.Request) { | @@ -1196,6 +1199,60 @@ func AddAd(w http.ResponseWriter, r *http.Request) { | ||
1196 | HandlerAddAd(w, s, Uuid) | 1199 | HandlerAddAd(w, s, Uuid) |
1197 | } | 1200 | } |
1198 | 1201 | ||
1202 | +func Fetchlvredbag(w http.ResponseWriter, r *http.Request) { | ||
1203 | + Uuid := 0 | ||
1204 | + if len(r.Header) > 0 { | ||
1205 | + Uuid, _ = strconv.Atoi(r.Header.Get("uid")) | ||
1206 | + } | ||
1207 | + if Uuid == 0 { | ||
1208 | + SetHeader(w) | ||
1209 | + return | ||
1210 | + } | ||
1211 | + result, _ := ioutil.ReadAll(r.Body) | ||
1212 | + r.Body.Close() | ||
1213 | + | ||
1214 | + s := string(result) | ||
1215 | + logger.Info("Fetchlvredbag , body:%v,uuid=%v", s, Uuid) | ||
1216 | + | ||
1217 | + HandlerFetchlvredbag(w, s, Uuid) | ||
1218 | +} | ||
1219 | + | ||
1220 | +func Quertlvredbag(w http.ResponseWriter, r *http.Request) { | ||
1221 | + Uuid := 0 | ||
1222 | + if len(r.Header) > 0 { | ||
1223 | + Uuid, _ = strconv.Atoi(r.Header.Get("uid")) | ||
1224 | + } | ||
1225 | + if Uuid == 0 { | ||
1226 | + SetHeader(w) | ||
1227 | + return | ||
1228 | + } | ||
1229 | + result, _ := ioutil.ReadAll(r.Body) | ||
1230 | + r.Body.Close() | ||
1231 | + | ||
1232 | + s := string(result) | ||
1233 | + logger.Info("Quertlvredbag , body:%v,uuid=%v", s, Uuid) | ||
1234 | + | ||
1235 | + HandlerQuertlvredbag(w, s, Uuid) | ||
1236 | +} | ||
1237 | + | ||
1238 | +func Uploadusercost(w http.ResponseWriter, r *http.Request) { | ||
1239 | + Uuid := 0 | ||
1240 | + if len(r.Header) > 0 { | ||
1241 | + Uuid, _ = strconv.Atoi(r.Header.Get("uid")) | ||
1242 | + } | ||
1243 | + if Uuid == 0 { | ||
1244 | + SetHeader(w) | ||
1245 | + return | ||
1246 | + } | ||
1247 | + result, _ := ioutil.ReadAll(r.Body) | ||
1248 | + r.Body.Close() | ||
1249 | + | ||
1250 | + s := string(result) | ||
1251 | + logger.Info("Uploadusercost , body:%v,uuid=%v", s, Uuid) | ||
1252 | + | ||
1253 | + HandlerUploadusercost(w, s, Uuid) | ||
1254 | +} | ||
1255 | + | ||
1199 | func Gethorsemessage(w http.ResponseWriter, r *http.Request) { | 1256 | func Gethorsemessage(w http.ResponseWriter, r *http.Request) { |
1200 | Uuid := 0 | 1257 | Uuid := 0 |
1201 | if len(r.Header) > 0 { | 1258 | if len(r.Header) > 0 { |
src/HttpServer/logic/logic.go
@@ -9,6 +9,7 @@ import ( | @@ -9,6 +9,7 @@ import ( | ||
9 | "fmt" | 9 | "fmt" |
10 | "math/rand" | 10 | "math/rand" |
11 | "net/http" | 11 | "net/http" |
12 | + "sort" | ||
12 | "strconv" | 13 | "strconv" |
13 | "sync" | 14 | "sync" |
14 | "time" | 15 | "time" |
@@ -626,6 +627,160 @@ func HandlerGetflyboxreward(w http.ResponseWriter, data string, uuid int) { | @@ -626,6 +627,160 @@ func HandlerGetflyboxreward(w http.ResponseWriter, data string, uuid int) { | ||
626 | fmt.Fprint(w, string(respstr)) | 627 | fmt.Fprint(w, string(respstr)) |
627 | } | 628 | } |
628 | 629 | ||
630 | +func HandlerFetchlvredbag(w http.ResponseWriter, data string, uuid int) { | ||
631 | + SetHeader(w) | ||
632 | + var resp FetchlvredbagResp | ||
633 | + resp.Code = 0 | ||
634 | + resp.Message = "success" | ||
635 | + var rdata FetchlvredbagReq | ||
636 | + err := json.Unmarshal([]byte(data), &rdata) | ||
637 | + for { | ||
638 | + if err != nil { | ||
639 | + logger.Error("HandlerFetchlvredbag json unmarshal failed=%v", err) | ||
640 | + resp.Code = 1 | ||
641 | + resp.Message = "json failed" | ||
642 | + break | ||
643 | + } | ||
644 | + uinfo, err := GetUserInfo(strconv.Itoa(uuid)) | ||
645 | + if err != nil || uinfo == nil { | ||
646 | + logger.Error("HandlerFetchlvredbag getuserinfo failed=%v", err) | ||
647 | + resp.Code = 1 | ||
648 | + resp.Message = "get userinfo failed" | ||
649 | + break | ||
650 | + } | ||
651 | + | ||
652 | + if rdata.Catlv != uinfo.WaitFetchLv[0] { | ||
653 | + //请求领取的等级红包不正确 | ||
654 | + logger.Error("HandlerFetchlvredbag catlv failed=%v", err) | ||
655 | + resp.Code = 1 | ||
656 | + resp.Message = "请求领取的等级红包不正确" | ||
657 | + break | ||
658 | + } | ||
659 | + | ||
660 | + cfg := jsonconf.GetCatConfig(rdata.Catlv) | ||
661 | + if cfg == nil { | ||
662 | + logger.Error("HandlerFetchlvredbag GetCatConfig failed=%v", err) | ||
663 | + resp.Code = 1 | ||
664 | + resp.Message = "获取配置失败" | ||
665 | + break | ||
666 | + } | ||
667 | + | ||
668 | + newgold, err := uinfo.AddRedPackect(cfg.Redpacket, 100) | ||
669 | + if err != nil { | ||
670 | + logger.Error("HandlerFetchlvredbag GetCatConfig failed=%v", err) | ||
671 | + resp.Code = 1 | ||
672 | + resp.Message = "后台加红包失败!" | ||
673 | + break | ||
674 | + } | ||
675 | + | ||
676 | + uinfo.WaitFetchLv = uinfo.WaitFetchLv[1:] | ||
677 | + | ||
678 | + resp.Data.Redbag = float32(newgold) / 100 | ||
679 | + resp.Code = 0 | ||
680 | + //保存 | ||
681 | + SaveUserInfo(uinfo, strconv.Itoa(uuid)) | ||
682 | + | ||
683 | + break | ||
684 | + | ||
685 | + } | ||
686 | + //回包 | ||
687 | + respstr, _ := json.Marshal(&resp) | ||
688 | + fmt.Fprint(w, string(respstr)) | ||
689 | +} | ||
690 | + | ||
691 | +func HandlerUploadusercost(w http.ResponseWriter, data string, uuid int) { | ||
692 | + SetHeader(w) | ||
693 | + var resp UploadusercostResp | ||
694 | + resp.Code = 0 | ||
695 | + resp.Message = "success" | ||
696 | + var rdata UploadusercostReq | ||
697 | + err := json.Unmarshal([]byte(data), &rdata) | ||
698 | + for { | ||
699 | + if err != nil { | ||
700 | + logger.Error("HandlerUploadusercost json unmarshal failed=%v", err) | ||
701 | + resp.Code = 1 | ||
702 | + resp.Message = "json failed" | ||
703 | + break | ||
704 | + } | ||
705 | + uinfo, err := GetUserInfo(strconv.Itoa(uuid)) | ||
706 | + if err != nil || uinfo == nil { | ||
707 | + logger.Error("HandlerUploadusercost getuserinfo failed=%v", err) | ||
708 | + resp.Code = 1 | ||
709 | + resp.Message = "get userinfo failed" | ||
710 | + break | ||
711 | + } | ||
712 | + | ||
713 | + if rdata.Rtype == 1 { | ||
714 | + //摇一摇次数 | ||
715 | + uinfo.ShakeTime -= rdata.Value | ||
716 | + if uinfo.ShakeTime < 0 { | ||
717 | + uinfo.ShakeTime = 0 | ||
718 | + } | ||
719 | + resp.Data.Lefttime = uinfo.ShakeTime | ||
720 | + } else { | ||
721 | + resp.Code = 1 | ||
722 | + resp.Message = "类型不正确!" | ||
723 | + break | ||
724 | + } | ||
725 | + resp.Code = 0 | ||
726 | + | ||
727 | + //保存 | ||
728 | + SaveUserInfo(uinfo, strconv.Itoa(uuid)) | ||
729 | + | ||
730 | + break | ||
731 | + | ||
732 | + } | ||
733 | + //回包 | ||
734 | + respstr, _ := json.Marshal(&resp) | ||
735 | + fmt.Fprint(w, string(respstr)) | ||
736 | +} | ||
737 | + | ||
738 | +func HandlerQuertlvredbag(w http.ResponseWriter, data string, uuid int) { | ||
739 | + SetHeader(w) | ||
740 | + var resp QuertlvredbagResp | ||
741 | + resp.Code = 0 | ||
742 | + resp.Message = "success" | ||
743 | + for { | ||
744 | + | ||
745 | + uinfo, err := GetUserInfo(strconv.Itoa(uuid)) | ||
746 | + if err != nil || uinfo == nil { | ||
747 | + logger.Error("HandlerQuertlvredbag getuserinfo failed=%v", err) | ||
748 | + resp.Code = 1 | ||
749 | + resp.Message = "get userinfo failed" | ||
750 | + break | ||
751 | + } | ||
752 | + | ||
753 | + if len(uinfo.WaitFetchLv) == 0 { | ||
754 | + //没有可领取的 | ||
755 | + | ||
756 | + if uinfo.Highestlv < 36 { | ||
757 | + resp.Data.Catlv = uinfo.Highestlv + 1 | ||
758 | + } else { | ||
759 | + resp.Data.Catlv = 0 | ||
760 | + } | ||
761 | + resp.Data.Redbag = 0.0 | ||
762 | + resp.Data.Canfetch = 0 | ||
763 | + | ||
764 | + } else { | ||
765 | + resp.Data.Canfetch = 1 | ||
766 | + resp.Data.Catlv = uinfo.WaitFetchLv[0] | ||
767 | + | ||
768 | + cfg := jsonconf.GetCatConfig(uinfo.WaitFetchLv[0]) | ||
769 | + if cfg == nil { | ||
770 | + logger.Error("HandlerQuertlvredbag getcatcfg failed lv=%v", uinfo.WaitFetchLv[0]) | ||
771 | + } else { | ||
772 | + resp.Data.Redbag = cfg.Redpacket | ||
773 | + } | ||
774 | + } | ||
775 | + | ||
776 | + break | ||
777 | + } | ||
778 | + | ||
779 | + //回包 | ||
780 | + respstr, _ := json.Marshal(&resp) | ||
781 | + fmt.Fprint(w, string(respstr)) | ||
782 | +} | ||
783 | + | ||
629 | func HandlerGethorsemessage(w http.ResponseWriter, data string, uuid int) { | 784 | func HandlerGethorsemessage(w http.ResponseWriter, data string, uuid int) { |
630 | SetHeader(w) | 785 | SetHeader(w) |
631 | var resp GethorsemessageResp | 786 | var resp GethorsemessageResp |
@@ -1272,6 +1427,7 @@ func HandlerGetUserData(w http.ResponseWriter, data string, uuid int) { | @@ -1272,6 +1427,7 @@ func HandlerGetUserData(w http.ResponseWriter, data string, uuid int) { | ||
1272 | 1427 | ||
1273 | //resp.Data.TimingReward = false | 1428 | //resp.Data.TimingReward = false |
1274 | resp.Data.TimingRewardTimes = uinfo.LeftTimingRewardTimes | 1429 | resp.Data.TimingRewardTimes = uinfo.LeftTimingRewardTimes |
1430 | + resp.Data.Shakeleftcnt = uinfo.ShakeTime | ||
1275 | 1431 | ||
1276 | //保存此次计算时间 | 1432 | //保存此次计算时间 |
1277 | nowtimestr := strconv.FormatInt(nowtime, 10) | 1433 | nowtimestr := strconv.FormatInt(nowtime, 10) |
@@ -2464,6 +2620,10 @@ func HandlerExchangePos(w http.ResponseWriter, data string, uuid int) { | @@ -2464,6 +2620,10 @@ func HandlerExchangePos(w http.ResponseWriter, data string, uuid int) { | ||
2464 | //翻拍次数+ | 2620 | //翻拍次数+ |
2465 | uinfo.FlopCardLefCnt++ | 2621 | uinfo.FlopCardLefCnt++ |
2466 | 2622 | ||
2623 | + //将等级红包加入待领取列表 | ||
2624 | + uinfo.WaitFetchLv = append(uinfo.WaitFetchLv, uinfo.Highestlv) | ||
2625 | + sort.Ints(uinfo.WaitFetchLv) | ||
2626 | + | ||
2467 | nowt := int(time.Now().Unix()) | 2627 | nowt := int(time.Now().Unix()) |
2468 | uinfo.CurentLevelCostTime = (nowt - uinfo.CurentLevelSec) / 3600 | 2628 | uinfo.CurentLevelCostTime = (nowt - uinfo.CurentLevelSec) / 3600 |
2469 | uinfo.CurentLevelSec = nowt | 2629 | uinfo.CurentLevelSec = nowt |