Browse Source

feat:解锁

wangchuanjin 1 year ago
parent
commit
53a9839a5b

+ 2 - 0
resourceBrushLibrary/entity/order.go

@@ -24,6 +24,7 @@ func OrderResource() {
 }
 
 func OrderResourceRun(now time.Time, end int64) {
+	log.Println("OrderResourceRun 任务开始。。。")
 	grantDateStr := time.Now().Format("200601")
 	grantDate := gconv.Int64(grantDateStr)
 	pool := make(chan bool, Config.GivePool)
@@ -152,4 +153,5 @@ func OrderResourceRun(now time.Time, end int64) {
 		m = make(map[string]interface{})
 	}
 	wait.Wait()
+	log.Println("OrderResourceRun 任务结束。。。")
 }

+ 2 - 2
resourceBrushLibrary/entity/purchaseBalance.go

@@ -34,13 +34,13 @@ func init() {
 // 资源新增
 // 查询数据有没有新增过
 func (this *PurchaseBalance) PurchaseUserBalance(inteReq resourcesCenterclient.Resources) {
-	key := fmt.Sprintf("%s_%s_%s_%d", inteReq.UserId, inteReq.ResourceType, inteReq.EndTime, inteReq.Model)
 	allGivenLock.Lock()
+	defer allGivenLock.Unlock()
+	key := fmt.Sprintf("%s_%s_%s_%d", inteReq.UserId, inteReq.ResourceType, inteReq.EndTime, inteReq.Model)
 	if allGiven[key] > 0 {
 		return
 	}
 	allGiven[key] = time.Now().Unix()
-	allGivenLock.Unlock()
 	//判断资源之前有没有新增
 	_resp, err := ResourcesRpc.PurchaseUserBalance(context.Background(), &inteReq)
 	if err != nil {