cuiqian2004
4 天以前 2af5f043b60c1f7ac38ecccc8f5bf44743134325
api/request.js
@@ -14,15 +14,24 @@
   apiCount: {
      agv_state: 0,
      laser_data: 0,
      current_teaching: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) {
@@ -32,14 +41,14 @@
               this.apiCount.agv_state = 1;
            }
            if (item.url.indexOf("get_current_teaching_data") > 0) {
               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) {
@@ -84,6 +93,7 @@
      }
      const list = session.getValue("request_log") || []
      list.unshift(item)
      if (list.length > 512) {
@@ -105,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 &&options.url.indexOf("get_current_teaching_data") < 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) => {
@@ -118,8 +128,10 @@
            method: options.method,
            dataType: options.dataType,
            success: (result) => {
               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) { //
               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("result", result)
               }