Commit 0e7f8d702ba4a266d2bbd86f6bd80abc811522c0

Authored by 陆恒
1 parent f6b94539
Exists in master

提交

Showing 1 changed file with 11 additions and 0 deletions   Show diff stats
src/HttpServer/logic/logic.go
@@ -10,9 +10,12 @@ import ( @@ -10,9 +10,12 @@ import (
10 "math/rand" 10 "math/rand"
11 "net/http" 11 "net/http"
12 "strconv" 12 "strconv"
  13 + "sync"
13 "time" 14 "time"
14 ) 15 )
15 16
  17 +var llock sync.Mutex
  18 +
16 func HandlerQuerdrawinfo(w http.ResponseWriter, data string, uuid int) { 19 func HandlerQuerdrawinfo(w http.ResponseWriter, data string, uuid int) {
17 SetHeader(w) 20 SetHeader(w)
18 var resp QuerdrawinfoResp 21 var resp QuerdrawinfoResp
@@ -208,6 +211,8 @@ func HandlerGetcash(w http.ResponseWriter, data string, uuid int) { @@ -208,6 +211,8 @@ func HandlerGetcash(w http.ResponseWriter, data string, uuid int) {
208 211
209 func HandlerFetchredbag(w http.ResponseWriter, data string, uuid int) { 212 func HandlerFetchredbag(w http.ResponseWriter, data string, uuid int) {
210 SetHeader(w) 213 SetHeader(w)
  214 + llock.Lock()
  215 + defer llock.Unlock()
211 var resp FetchredbagResp 216 var resp FetchredbagResp
212 resp.Code = 0 217 resp.Code = 0
213 var rdata FetchredbagReq 218 var rdata FetchredbagReq
@@ -352,6 +357,8 @@ func HandlerFetchredbag(w http.ResponseWriter, data string, uuid int) { @@ -352,6 +357,8 @@ func HandlerFetchredbag(w http.ResponseWriter, data string, uuid int) {
352 357
353 func HandlerUploadspeciallevel(w http.ResponseWriter, data string, uuid int) { 358 func HandlerUploadspeciallevel(w http.ResponseWriter, data string, uuid int) {
354 SetHeader(w) 359 SetHeader(w)
  360 + llock.Lock()
  361 + defer llock.Unlock()
355 var resp UploadlevelResp 362 var resp UploadlevelResp
356 resp.Code = 0 363 resp.Code = 0
357 var rdata UploadlevelReq 364 var rdata UploadlevelReq
@@ -392,6 +399,8 @@ func HandlerUploadspeciallevel(w http.ResponseWriter, data string, uuid int) { @@ -392,6 +399,8 @@ func HandlerUploadspeciallevel(w http.ResponseWriter, data string, uuid int) {
392 399
393 func HandlerUploadbiglevel(w http.ResponseWriter, data string, uuid int) { 400 func HandlerUploadbiglevel(w http.ResponseWriter, data string, uuid int) {
394 SetHeader(w) 401 SetHeader(w)
  402 + llock.Lock()
  403 + defer llock.Unlock()
395 var resp UploadlevelResp 404 var resp UploadlevelResp
396 resp.Code = 0 405 resp.Code = 0
397 var rdata UploadlevelReq 406 var rdata UploadlevelReq
@@ -432,6 +441,8 @@ func HandlerUploadbiglevel(w http.ResponseWriter, data string, uuid int) { @@ -432,6 +441,8 @@ func HandlerUploadbiglevel(w http.ResponseWriter, data string, uuid int) {
432 441
433 func HandlerUploadlevel(w http.ResponseWriter, data string, uuid int) { 442 func HandlerUploadlevel(w http.ResponseWriter, data string, uuid int) {
434 SetHeader(w) 443 SetHeader(w)
  444 + llock.Lock()
  445 + defer llock.Unlock()
435 var resp UploadlevelResp 446 var resp UploadlevelResp
436 resp.Code = 0 447 resp.Code = 0
437 var rdata UploadlevelReq 448 var rdata UploadlevelReq