函数this

startRecording() {
    // 创建WebSocket连接
    this.ws = new WebSocket('ws://20.33.15.6:8841/bank/audio/detection?deviceNo=1');

    // 初始化AudioContext
    this.audioContext = new AudioContext({ sampleRate: this.sampleRate });
    const that = this;
    that.ws.onmessage = uploadComplete;
    function uploadComplete(msg) {
      console.info(msg)
      //通过正则表达式,将“呼叫xxx的电话”中的“xxx”提取出来。
      // 示例文本,假设它包含中文名字
      that.text = msg.data;
        if (matchSecond) {
          // match[1] 是月份,match[2] 是日期
          const monthMap = {
          };
          const dayMap = {
          };
          const month = monthMap[matchSecond[1]];
          const day = dayMap[matchSecond[2]];
          // 构造格式化的日期字符串
          const startTime = `2024-${month}-${day} 00:00:00`;
          const endTime = `2024-${month}-${day} 23:59:59`;
          console.log(`开始时间: ${startTime}`);
          console.log(`开始时间: ${endTime}`);
          // that.dataService.pushNewTips('匹配语音查询开始时间' + startTime + ',结束时间的数据' + endTime, 'info');
          const queryParam = {
            startTime: startTime,
            endTime: endTime
          }
          let subscribeIncidentData = that.incidentService.getJqCaseData(queryParam).subscribe(data => {
            if (data) {
              that.dataService.openConformTipDialog();
              subscribeIncidentData.unsubscribe();
              subscribeIncidentData = null;
            } else {
                subscribeIncidentData.unsubscribe();
                subscribeIncidentData = null;
            }
        })
      } else {
      }
    } else {
    }
  }
posted @ 2024-06-18 15:17  chinadba  阅读(3)  评论(0编辑  收藏  举报