From 2af5f043b60c1f7ac38ecccc8f5bf44743134325 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期五, 12 十二月 2025 18:08:00 +0800
Subject: [PATCH] test

---
 api/request.js |   50 ++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/api/request.js b/api/request.js
index 7a144b3..7f74ded 100644
--- a/api/request.js
+++ b/api/request.js
@@ -14,14 +14,24 @@
 	apiCount: {
 		agv_state: 0,
 		laser_data: 0,
+		current_teaching: 0
+	},
+
+	parseJson(str) {
+		try {
+			const obj = JSON.parse(str)
+			return obj
+		} catch (ex) {
+			return undefined
+		}
 	},
 	addLog(item) {
 		if (!getApp().globalData.withLog) {
 			return
 		}
 		if (item.statusCode == 200) {
-			const ret = JSON.parse(item.data)
-			if (ret.code == 0) {
+			const ret = this.parseJson(item.data)
+			if (ret?.code === 0) {
 				if (item.url.indexOf("get_agv_state") > 0) {
 
 					if (this.apiCount.agv_state % 20 != 0) {
@@ -30,18 +40,27 @@
 					}
 					this.apiCount.agv_state = 1;
 				}
-				if (item.url.indexOf("laser_data") > 0) {
+				if (item.url.indexOf("get_current_teaching_data") > 0) {
 
-					if (ret.data?.base_map?.image_base64) {
-						this.apiCount.laser_data++;
-					} else {
-						if (this.apiCount.laser_data % 20 != 0) {
-							this.apiCount.laser_data++;
-							return
-						}
-						this.apiCount.laser_data = 1;
+					if (this.apiCount.current_teaching % 20 != 0) {
+						this.apiCount.current_teaching++;
+						return
 					}
+					this.apiCount.current_teaching = 1;
 				}
+
+				// if (item.url.indexOf("laser_data") > 0) {
+
+				// 	if (ret.data?.base_map?.image_base64) {
+				// 		this.apiCount.laser_data++;
+				// 	} else {
+				// 		if (this.apiCount.laser_data % 20 != 0) {
+				// 			this.apiCount.laser_data++;
+				// 			return
+				// 		}
+				// 		this.apiCount.laser_data = 1;
+				// 	}
+				// }
 				const res = ret.data
 				if (res) {
 					if (item.url.indexOf("getMapUrl") > 0) {
@@ -74,6 +93,7 @@
 		}
 		const list = session.getValue("request_log") || []
 
+
 		list.unshift(item)
 
 		if (list.length > 512) {
@@ -95,8 +115,8 @@
 		options.method = options.method || this.common.method;
 		options.dataType = options.dataType || this.common.dataType;
 
-		if (options.url.indexOf("get_agv_state") < 0 && options.url.indexOf("laser_data") < 0 && options.url.indexOf(
-				"taskGroupStatus") < 0) {
+		if (options.url.indexOf("get_agv_state") < 0 && options.url.indexOf("laser_data") < 0 &&
+			options.url.indexOf("taskGroupStatus") < 0 && options.url.indexOf("get_current_teaching_data") < 0) {
 			console.log("url", options.url, options.data)
 		}
 		return new Promise((resolve, reject) => {
@@ -109,7 +129,9 @@
 				dataType: options.dataType,
 				success: (result) => {
 					if (options.url.indexOf("get_agv_state") < 0 && options.url.indexOf(
-							"laser_data") < 0) { //
+							"laser_data") < 0 &&
+						options.url.indexOf("taskGroupStatus") < 0 && options.url.indexOf(
+							"get_current_teaching_data") < 0) { //
 						console.log("result", result)
 					}
 

--
Gitblit v1.9.1