|
@@ -600,11 +600,11 @@ func DrawClues(positionId, count1, count2, count3 int64) int {
|
|
|
func batchDraw(data []map[string]interface{}, nowTime, seatNumber, name string, positionId int64) int {
|
|
|
wg := new(sync.WaitGroup)
|
|
|
ch := make(chan bool, 20)
|
|
|
- count := 0
|
|
|
+ chs := make(chan bool, 1000)
|
|
|
for _, v := range data {
|
|
|
wg.Add(1)
|
|
|
ch <- true
|
|
|
- go func(v map[string]interface{}, count int) {
|
|
|
+ go func(v map[string]interface{}) {
|
|
|
defer func() {
|
|
|
wg.Done()
|
|
|
<-ch
|
|
@@ -709,14 +709,14 @@ func batchDraw(data []map[string]interface{}, nowTime, seatNumber, name string,
|
|
|
return ok1 && recordId > 0 && recordId1 > 0 && recordId2 > 0 && recordId3 > -1 && recordId4 > -1
|
|
|
}) {
|
|
|
log.Println("领取线索成功")
|
|
|
- count++
|
|
|
+ chs <- true
|
|
|
} else {
|
|
|
log.Println("领取线索失败")
|
|
|
}
|
|
|
- }(v, count)
|
|
|
+ }(v)
|
|
|
}
|
|
|
wg.Wait()
|
|
|
- return count
|
|
|
+ return len(chs)
|
|
|
}
|
|
|
|
|
|
func getSeatNumber(positionId int64) (seatNumber, name string) {
|