Browse Source

send im msg

kk 2 months ago
parent
commit
0427fc5d07

+ 18 - 1
game-business/src/main/java/com/game/business/task/AppGameBettingTask.java

@@ -428,10 +428,27 @@ public class AppGameBettingTask {
         if(userIdList == null || userIdList.isEmpty()){
             return;
         }
+
         JSONObject paramJson = new JSONObject();
         paramJson.put("type", "UserSystemNotify");
         paramJson.put("subType", "UserRefreshBalance");
         paramJson.put("content", "刷新余额");
-        TencentCloudImUtil.imPushBatchSendMsg(userIdList, paramJson.toString());
+
+        List<String> sendUsers = new ArrayList<>();
+        if(userIdList.size() > 500){
+            for(String userId : userIdList){
+                if(sendUsers.size() >= 500){
+                    TencentCloudImUtil.imPushBatchSendMsg(sendUsers, paramJson.toString());
+                    sendUsers.clear();
+                }
+                sendUsers.add(userId);
+            }
+            // 剩余不超过500
+            if(!sendUsers.isEmpty()){
+                TencentCloudImUtil.imPushBatchSendMsg(sendUsers, paramJson.toString());
+            }
+        }else{
+            TencentCloudImUtil.imPushBatchSendMsg(userIdList, paramJson.toString());
+        }
     }
 }