From 70f5b82bc3fceafac2faf470280876b0eca6fac8 Mon Sep 17 00:00:00 2001
From: zhaojs <349234519@qq.com>
Date: 星期四, 13 七月 2023 09:40:23 +0800
Subject: [PATCH] no message

---
 uniapp/App.vue |   44 ++++++++++++++++++++++++++++++++++++++------
 1 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/uniapp/App.vue b/uniapp/App.vue
index 5cb1d20..4077376 100644
--- a/uniapp/App.vue
+++ b/uniapp/App.vue
@@ -13,10 +13,11 @@
 		onLaunch: function() {
 			// #ifdef APP-PLUS
 			//鎺ㄩ�佸紑濮�
-			var info = plus.push.getClientInfo()
+			/* var info = plus.push.getClientInfo()
 			console.log(info);
 			// 鑾峰彇褰撳墠璁惧鐨勫鎴风id,浼犵粰鍚庡彴,瀹炵幇鎸囧畾鐢ㄦ埛
-			info && uni.setStorageSync('clientInfo', info)
+			info && uni.setStorageSync('clientInfo', info) */
+			this.getPushCid();
 			// 浣跨敤5+App鐨勬柟寮忚繘琛岀洃鍚秷鎭帹閫�
 			//娑堟伅鐐瑰嚮浜嬩欢  
 			//銆怉PP鍦ㄧ嚎銆戯紝鏀跺埌閫忎紶娑堟伅閫氳繃锛屼笉浼氭彁閱掕嚦閫氱煡鏍忕洰锛岄渶瑕佸彂閫佹湰鍦版秷鎭紝鍐嶈繘琛岀偣鍑昏Е鍙戠殑鐐瑰嚮浜嬩欢銆�  
@@ -57,6 +58,7 @@
 			//鏀跺埌閫忎紶娑堟伅  
 			//鍙湁APP鍦ㄧ嚎鏃讹紝鎵嶄細瑙﹀彂receive浜嬩欢锛岄�忎紶娑堟伅涓嶄細瑙﹀彂绯荤粺娑堟伅,闇�瑕佸垱寤烘湰鍦版秷鎭�  
 			plus.push.addEventListener("receive", function(msg) {
+				console.log('receive', JSON.stringify(msg))
 				//涓氬姟浠g爜
 				// IOS
 				if (uni.getSystemInfoSync().platform == 'ios') {
@@ -154,7 +156,6 @@
 							content: '妫�娴嬪埌缃戠粶鏉冮檺鍙兘璁剧疆涓哄叧闂紝鎮ㄥ彲浠ュ湪鈥滆缃�濅腑妫�鏌ユ棤绾挎暟鎹強铚傜獫绉诲姩缃戠粶'
 						})
 					}else{
-						console.log("鏄惁璇锋眰杩囷細"+that.globalData.hasinit)
 						if(!that.globalData.hasinit)
 						{
 							that.getAppInfo();
@@ -189,11 +190,9 @@
 			 bcInit:function()
 			{
 				var that = this;
-				console.log(uni.getSystemInfoSync().platform);
 				if (uni.getSystemInfoSync().platform == 'ios')
 				{
 					const plug = uni.requireNativePlugin('xiguazhu-baichuan');
-					console.log(plug)
 					plug.init({}, result => {
 						//console.log('1111111111111111111');
 						console.log(result);	// code绛変簬0灏辨槸鍒濆鍖栨垚鍔�
@@ -206,6 +205,40 @@
 				else{
 					that.globalData.hasbcinit=true;
 				}
+			},
+			getPushCid:function()
+			{
+				// #ifdef APP-PLUS
+				var info = plus.push.getClientInfo()
+				if(info&&info.clientid!='null')
+				{// 鑾峰彇褰撳墠璁惧鐨勫鎴风id,浼犵粰鍚庡彴,瀹炵幇鎸囧畾鐢ㄦ埛
+					uni.setStorageSync('clientInfo', info);
+					this.updatePushCid();
+				}
+				else{
+					console.log('娌℃湁鑾峰彇鍒�');
+					setTimeout(() => {
+						this.getPushCid();
+					}, 1000)
+				}
+				// #endif
+			},
+			updatePushCid:function()
+			{
+				let clientInfo = uni.getStorageSync('clientInfo');
+				if(clientInfo&&clientInfo!='null'&&clientInfo.clientid)
+				{
+					console.log('寮�濮嬫洿鏂�');
+					this.$u.api.updateCid({
+						pushcid:clientInfo.clientid
+					}).then(e => {
+					}).catch(function (err) {
+					})
+				}
+				else{
+					this.getPushCid();
+				}
+				
 			},
 			getAppInfo: function() {
 				var that = this;
@@ -238,7 +271,6 @@
 						if (plus.runtime.isApplicationExist({pname:'com.tencent.mm',
 								action: 'weixin://'
 							})) {
-								console.log("瀹夊崜绔凡瀹夎寰俊")
 							that.globalData.ifwt = 1 //鏄惁瀹夎寰俊 1浠h〃瀹夎
 						} else {
 							console.log("瀹夊崜绔湭瀹夎寰俊")

--
Gitblit v1.9.3