From 9cf8c49dcf960743f22baaec737bfb0c134d5683 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期一, 16 三月 2026 09:46:18 +0800
Subject: [PATCH] ios 调整clientiD 获取逻辑

---
 utils/getuiUtils.js |   53 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 48 insertions(+), 5 deletions(-)

diff --git a/utils/getuiUtils.js b/utils/getuiUtils.js
index c9e8e10..5c8b201 100644
--- a/utils/getuiUtils.js
+++ b/utils/getuiUtils.js
@@ -9,12 +9,55 @@
 
     getClientID(Userbm, UserName) {
         // #ifdef APP-PLUS
-        const info = plus.push.getClientInfo()
-        this.cid = info["clientid"]
-        console.log('cid: ', this.cid);
-        this.setUserClientIDRelative(Userbm, UserName, this.cid, 1)
+        // 瀹氫箟閲嶈瘯鍙傛暟锛氭渶澶氶噸璇�5娆★紝姣忔闂撮殧1.5绉掞紙鍙牴鎹疄闄呮儏鍐佃皟鏁达級
+        const maxRetry = 5;
+        const retryInterval = 1500;
+        let retryCount = 0;
+    
+        // 灏佽鑾峰彇clientid鐨勬牳蹇冮�昏緫
+        const tryGetClientId = () => {
+            try {
+                const info = plus.push.getClientInfo();
+                // 鍏煎iOS涓嶅悓SDK鐗堟湰鐨勫瓧娈靛悕锛坈lientid / clientId锛�
+                const clientid = info?.clientid || info?.clientId;
+                
+                // 鎴愬姛鑾峰彇鍒癱lientid
+                if (clientid) {
+                    this.cid = clientid;
+                    console.log('鎴愬姛鑾峰彇cid: ', this.cid);
+                    this.setUserClientIDRelative(Userbm, UserName, this.cid, 1);
+                    return;
+                }
+    
+                // 鏈幏鍙栧埌锛屼笖杩樻湁閲嶈瘯娆℃暟
+                if (retryCount < maxRetry) {
+                    retryCount++;
+                    console.log(`绗�${retryCount}娆¢噸璇曡幏鍙朿id锛堟殏鏈幏鍙栧埌锛夛紝鍓╀綑閲嶈瘯娆℃暟锛�${maxRetry - retryCount}`);
+                    setTimeout(tryGetClientId, retryInterval);
+                    return;
+                }
+    
+                // 閲嶈瘯鑰楀敖浠嶆湭鑾峰彇鍒�
+                console.error('閲嶈瘯娆℃暟鑰楀敖锛宨OS鐜涓嬫湭鑾峰彇鍒癱lientid');
+                this.cid = '';
+                // 鍙�夛細姝ゅ鍙坊鍔犺幏鍙栧け璐ョ殑鍏滃簳閫昏緫锛堟瘮濡傝褰曟棩蹇椼�佹彁绀虹敤鎴风瓑锛�
+                this.setUserClientIDRelative(Userbm, UserName, this.cid, 1);
+    
+            } catch (error) {
+                console.error('鑾峰彇clientid杩囩▼涓嚭鐜板紓甯革細', error);
+                if (retryCount < maxRetry) {
+                    retryCount++;
+                    setTimeout(tryGetClientId, retryInterval);
+                }
+            }
+        };
+    
+        // 鍚姩绗竴娆¤幏鍙�
+        tryGetClientId();
         // #endif
-    };
+    }
+    
+    
 
     async setUserClientIDRelative(Userbm, UserName, ClientID, Online) {
         try {

--
Gitblit v1.9.1