百度GL地图实现某一段路的路况(new BMapGL.DrivingRouteLine)

功能描述:

1.百度地图实现点击地图出现起点,再次点击出现终点(起点终点能拖动)绘制完终点后获取该路的路况并且起点和终点可以拖动实现实时更新(新绘制的路段的)路况

2.地点搜索

效果如下: 

 关键代码:

new BMapGL.DrivingRouteLine(this.bdMap, {
        renderOptions: {
          map: this.bdMap,
          enableDragging: true,
          autoViewport: true,
          lineLayerStyle: {
            // strokeTextureUrl: null,
            showTraffic: true
          }
        },
        onSearchComplete: searchComplete,
        onPolylinesSet: () => {
          this.drivingTime = drivingTime;
          this.drivingDistance = this.convertDistance(drivingDistance);
          this.pointsArr = deepClone(pointsArr);
        },
      });

完整代码:

<!--
 * @Description: 百度地图自动获取路段点位 页面
 * @Author: mhf
 * @Date: 2024/2/21 11:55
-->
<template>
  <el-dialog
    width="1300px"
    v-dialog-out
    destroy-on-close
    append-to-body
    v-if="dialogVisible"
    :title="title"
    :visible.sync="dialogVisible"
    :before-close="hideDialog"
    :close-on-click-modal="false"
  >
    <div class="dialog-body">
      <div id="map-container"></div>

      <div class="dialog-body-search">
        <el-input
          @input="searchPlace"
          @clear="searchPlace"
          clearable
          v-model="searchText"
          size="small"
          placeholder="输入关键字查询"
        ></el-input>
      </div>

      <div>
        <div class="dialog-body-res" v-if="searchRes.length > 0">
          <div
            v-for="(item, index) in searchRes"
            :key="index"
            @click="chooseIt(item)"
          >
            <el-tooltip
              effect="light"
              :content="item.address + item.title"
              placement="right-end"
              overflow
            >
              <span> {{ item.address + item.title }} </span>
            </el-tooltip>
          </div>
        </div>
        <div
          class="dialog-body-none"
          v-else-if="searchRes.length === 0 && searchText"
        >
          <em> 没有搜索结果... </em>
        </div>
      </div>
    </div>

    <lineH />
    <div class="dialog-footer">
      <el-button @click="hideDialog">取 消</el-button>
      <el-button type="primary" @click="submitPoints">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { deepClone } from "@/utils/deepClone";

export default {
  name: "bdMapDrawLinesDialog",
  components: {},
  props: {},
  dicts: [],
  data() {
    return {
      dialogVisible: false,
      title: "",
      bdMap: null,
      mapCenter: {
        lng: 120.73957130336815, // 经度
        lat: 30.748406263284365,
      }, // 地图中心点
      mapZoom: 14, // 地图缩放级别
      startPoint: {
        lng: 120.72532015906316,
        lat: 30.747761317225542,
      },
      endPoint: {
        lng: 120.73105566952,
        lat: 30.74805738479023,
      },
      drivingTime: 0, // 驾驶时间 分钟
      drivingDistance: 0, // 行驶距离 公里
      pointsArr: [
        // {
        //   lat: 30.748406263284365,
        //   lng: 120.73957130336815
        // },
        // {
        //   lat: 30.748406263284365,
        //   lng: 120.73957130336815
        // },
        // {
        //   lat: 30.748406263284365,
        //   lng: 120.73957130336815
        // }
      ], // 最终保存的点位信息 (路段中的所有点位[包含:起点,终点])
      mapClickListener: null, // 地图点击事件监听器
      searchText: undefined, // 查询的关键字
      searchPoint: {}, // 查找到的点位
      searchRes: [], // 查到结果
    };
  },
  methods: {
    showDialog(data) {
      this.dialogVisible = true;
      this.title = data.title;
      if (data.data) {
        // 回显线段和起点终点
        let pointsArr = JSON.parse(data.data);
        this.pointsArr = pointsArr;
        this.startPoint = pointsArr[0];
        this.endPoint = pointsArr[pointsArr.length - 1];
      } else {
      }
      this.initBdMap(data.data);
    },

    hideDialog() {
      // this.mapCenter = {
      //   lng: 120.73957130336815,
      //   lat: 30.748406263284365
      // }
      this.bdMap.destroy();
      this.bdMap = null;
      removeEventListener("click", this.mapClickListener);
      this.mapClickListener = null;
      this.dialogVisible = false;
      this.removeSearch();
    },

    removeSearch() {
      // if (this.searchPoint) {
      //   this.removeMarker("searchPoint")
      // }
      this.searchPoint = {};
      this.searchText = undefined;
      this.searchRes = [];
    },

    submitPoints() {
      if (this.pointsArr.length < 2) this.$message.warning("请先绘制线路");
      this.$emit("on-response", {
        pointsArr: this.pointsArr,
        km: this.drivingDistance,
      });
      this.hideDialog();
    },

    initBdMap(flag) {
      this.$nextTick(() => {
        this.bdMap = new BMapGL.Map("map-container");
        this.bdMap.centerAndZoom(
          new BMapGL.Point(this.mapCenter.lng, this.mapCenter.lat),
          this.mapZoom,
        );
        this.bdMap.enableScrollWheelZoom(true);
        if (!flag) {
          // 新增则绘制起点和终点
          this.drawMarker();
        } else {
          // 编辑或者详情则回显绘制的路线
          this.drawRouteLine();
        }
        setTimeout(() => {
          this.setViewport([this.startPoint, this.endPoint]);
        }, 500);
      });
    },

    /**
     * @Event 绘制路线
     * @description:
     * @author: mhf
     * @time: 2024-02-01 11:41:40
     **/
    drawRouteLine() {
      let drivingTime = 0;
      let drivingDistance = 0;
      let pointsArr = [];
      let that = this;
      var searchComplete = function (results) {
        if (transit.getStatus() == BMAP_STATUS_SUCCESS) {
          var plan = results.getPlan(0);
          drivingTime = plan.getDuration(true); //获取时间
          drivingDistance = plan.getDistance(true); //获取距离
          pointsArr = that.makePointsArr(plan._lines); // 路段中所有的点位数组
          that.removeMarker();
        }
      };
      var transit = new BMapGL.DrivingRouteLine(this.bdMap, {
        renderOptions: {
          map: this.bdMap,
          enableDragging: true,
          autoViewport: true,
          lineLayerStyle: {
            // strokeTextureUrl: null,
            showTraffic: true
          }
        },
        onSearchComplete: searchComplete,
        onPolylinesSet: () => {
          this.drivingTime = drivingTime;
          this.drivingDistance = this.convertDistance(drivingDistance);
          this.pointsArr = deepClone(pointsArr);
        },
      });
      let start = new BMapGL.Point(this.startPoint.lng, this.startPoint.lat);
      let end = new BMapGL.Point(this.endPoint.lng, this.endPoint.lat);
      transit.search(start, end);
    },

    /**
     * @Event 调整地图到最佳视野
     * @param: portArr 点位数组 [pot1, pot2, pot3]
     * @description:
     * @author: mhf
     * @time: 2024-02-01 10:12:24
     **/
    setViewport(portArr) {
      this.bdMap.setViewport(portArr);
    },

    /**
     * @Event 将路径单位统一成千米
     * @description: 15.9公里 -> 15.9; 500米 -> 0.5
     * @author: mhf
     * @time: 2024-02-01 10:43:07
     **/
    convertDistance(distance) {
      let resKm = 0;
      if (distance.indexOf("公里") > -1) {
        resKm = distance.substring(0, distance.indexOf("公里"));
      } else if (distance.indexOf("米") > -1) {
        resKm = distance.substring(0, distance.indexOf("米")) / 1000;
      } else {
        resKm = distance;
      }
      return resKm;
    },

    /**
     * @Event 绘制点位
     * @param: obj 点位对象,
     * @param: myIcon 自定义图标,
     *  @param: customObj 自定义参数,
     * @description: this.makePoint({lng: 116.404, lat: 39.119})
     * @author: mhf
     * @time: 2024-02-01 13:43:13
     **/
    makePoint(obj, myIcon, customObj) {
      let point = new BMapGL.Point(obj.lng, obj.lat); // 创建点
      let marker = new BMapGL.Marker(point, {
        icon: myIcon ? myIcon : null,
      }); // 创建标注
      marker.customObj = customObj;
      this.bdMap.addOverlay(marker);
      marker.addEventListener("click", (e) => {});
    },

    /**
     * @Event 将指定数组嵌套的数据转成扁平化的点位数据
     * @description:
     * @author: mhf
     * @time: 2024-02-01 13:57:20
     **/
    makePointsArr(arr) {
      return arr.flatMap((item) => item.points);
    },

    /**
     * @Event: 点击地图绘制点位
     * @description:
     * @author: mhf
     * @time: 2024-02-01 17:24:04
     **/
    drawMarker() {
      let num = 0;
      this.mapClickListener = this.bdMap.addEventListener("click", (e) => {
        num++;
        let obj = {
          lng: e.latlng.lng,
          lat: e.latlng.lat,
        };
        if (num === 1) {
          this.startPoint = obj;
          var myIcon = new BMapGL.Icon(
            "/img/startPoint.png",
            new BMapGL.Size(25, 40),
          );
          this.makePoint(obj, myIcon, { name: "startPoint" });
        } else if (num === 2) {
          this.endPoint = obj;
          this.drawRouteLine();
        }
      });
    },

    /**
     * @Event 移除点位
     * @description:
     * @author: mhf
     * @time: 2024-02-01 19:36:52
     **/
    removeMarker(name = "startPoint") {
      let makerArr = this.bdMap.getOverlays();
      for (let i = 0; i < makerArr.length; i++) {
        if (makerArr[i].customObj?.name === name) {
          this.bdMap.removeOverlay(makerArr[i]); // 移除指定点位
        }
      }
      // this.bdMap.clearOverlays() // 移除所有点位
    },

    /**
     * @Event 输入关键字查询地点
     * @description:
     * @author: mhf
     * @time: 2024-02-21 15:56:42
     **/
    searchPlace(e) {
      this.searchRes = [];
      if (e) {
        const myFun = () => {
          this.searchRes = local.getResults()._pois;
        };
        var local = new BMapGL.LocalSearch(this.bdMap, {
          onSearchComplete: myFun,
        });
        local.search(e);
      } else {
        this.removeMarker("searchPoint");
      }
    },

    chooseIt(item) {
      this.searchPoint = item.point;
      if (this.searchPoint) {
        this.removeMarker("searchPoint");
      }
      this.makePoint(
        { lng: this.searchPoint.lng, lat: this.searchPoint.lat },
        null,
        { name: "searchPoint" },
        false,
      );
      this.bdMap.centerAndZoom(item.point, 18);
    },
  },
  created() {},
  mounted() {},
};
</script>

<style lang="scss" scoped>
::v-deep .el-dialog__body {
  padding: 20px 0 0 !important;
}

.dialog-body {
  padding: 0 20px 20px;
  min-height: 60vh;
  max-height: 65vh;
  overflow-y: auto;
  position: relative;

  #map-container {
    min-height: 60vh;
    width: 100%;

    ::v-deep .anchorBL img {
      display: none;
    }

    ::v-deep .BMap_cpyCtrl span {
      display: none !important;
    }
  }

  &-search {
    width: 300px;
    position: absolute;
    top: 20px;
    left: 40px;
    z-index: 999 !important;
  }

  &-res {
    width: 300px;
    max-height: 400px;
    position: absolute;
    top: 50px;
    left: 40px;
    z-index: 999 !important;
    padding: 10px;
    background: #fff;
    border: 1px solid #eee;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    overflow-y: auto;

    span {
      display: block;
      width: 278px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      line-height: 30px;

      &:hover {
        cursor: pointer;
        border: 1px solid #409eff;
      }
    }
  }

  &-none {
    width: 300px;
    position: absolute;
    top: 54px;
    left: 40px;
    z-index: 999 !important;
    padding: 10px;
    background: #fff;
    line-height: 40px;
    border: 1px solid #eee;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  }
}

.dialog-footer {
  text-align: center;
  padding: 10px 0 18px;
}
</style>

图标:

示例数据(点击保存之后的数据)

[{"lng":112.318041,"lat":32.43625},{"lng":112.321216,"lat":32.43549},{"lng":112.322844,"lat":32.435137},{"lng":112.322844,"lat":32.435137},{"lng":112.322534,"lat":32.434416},{"lng":112.322334,"lat":32.433945},{"lng":112.322184,"lat":32.433594},{"lng":112.321984,"lat":32.433123},{"lng":112.321864,"lat":32.432823},{"lng":112.321695,"lat":32.432432},{"lng":112.321675,"lat":32.432402},{"lng":112.321395,"lat":32.431731},{"lng":112.321145,"lat":32.431129},{"lng":112.321025,"lat":32.430889},{"lng":112.321025,"lat":32.430889},{"lng":112.321055,"lat":32.430629},{"lng":112.321045,"lat":32.430529},{"lng":112.320725,"lat":32.428517},{"lng":112.320495,"lat":32.427496},{"lng":112.320114,"lat":32.425573},{"lng":112.319914,"lat":32.424242},{"lng":112.319914,"lat":32.424242},{"lng":112.319743,"lat":32.422991},{"lng":112.319713,"lat":32.422771},{"lng":112.319543,"lat":32.421839},{"lng":112.319503,"lat":32.421279},{"lng":112.319503,"lat":32.421279},{"lng":112.319652,"lat":32.42127},{"lng":112.319682,"lat":32.42127},{"lng":112.321639,"lat":32.42116},{"lng":112.323108,"lat":32.421076},{"lng":112.323467,"lat":32.421057},{"lng":112.324716,"lat":32.420989},{"lng":112.325616,"lat":32.420941},{"lng":112.325866,"lat":32.420921},{"lng":112.326286,"lat":32.420891},{"lng":112.327006,"lat":32.420841},{"lng":112.327606,"lat":32.42079},{"lng":112.329307,"lat":32.420657},{"lng":112.333542,"lat":32.420308},{"lng":112.33704,"lat":32.42002},{"lng":112.337712,"lat":32.419964},{"lng":112.342698,"lat":32.419576},{"lng":112.347669,"lat":32.419163},{"lng":112.348653,"lat":32.419088},{"lng":112.351527,"lat":32.41884},{"lng":112.355014,"lat":32.41855},{"lng":112.356984,"lat":32.418395},{"lng":112.361145,"lat":32.418023},{"lng":112.365686,"lat":32.417648},{"lng":112.365937,"lat":32.417624},{"lng":112.368237,"lat":32.41742},{"lng":112.370245,"lat":32.417242},{"lng":112.372091,"lat":32.417068},{"lng":112.372292,"lat":32.417056},{"lng":112.375782,"lat":32.416648},{"lng":112.376264,"lat":32.416594},{"lng":112.377186,"lat":32.416486},{"lng":112.377186,"lat":32.416486},{"lng":112.377146,"lat":32.416176},{"lng":112.377095,"lat":32.415837},{"lng":112.376964,"lat":32.414867},{"lng":112.376964,"lat":32.414677},{"lng":112.377054,"lat":32.414186},{"lng":112.377184,"lat":32.413855},{"lng":112.377274,"lat":32.413704},{"lng":112.377424,"lat":32.413473},{"lng":112.377704,"lat":32.413171},{"lng":112.377975,"lat":32.412949},{"lng":112.378375,"lat":32.412716},{"lng":112.378485,"lat":32.412605},{"lng":112.378616,"lat":32.412564},{"lng":112.379337,"lat":32.412329},{"lng":112.380539,"lat":32.411971},{"lng":112.380829,"lat":32.41193},{"lng":112.381119,"lat":32.411848},{"lng":112.3816,"lat":32.411706},{"lng":112.38198,"lat":32.411594},{"lng":112.38198,"lat":32.411594},{"lng":112.382671,"lat":32.411392},{"lng":112.385042,"lat":32.410685},{"lng":112.385802,"lat":32.410505},{"lng":112.386362,"lat":32.410414},{"lng":112.388041,"lat":32.410235},{"lng":112.393126,"lat":32.409744},{"lng":112.393126,"lat":32.409744},{"lng":112.395311,"lat":32.409538},{"lng":112.398492,"lat":32.409237},{"lng":112.398632,"lat":32.409229},{"lng":112.401771,"lat":32.408945},{"lng":112.403674,"lat":32.40877},{"lng":112.404162,"lat":32.408737},{"lng":112.405217,"lat":32.408642},{"lng":112.405715,"lat":32.40859},{"lng":112.406631,"lat":32.408513},{"lng":112.410264,"lat":32.408192},{"lng":112.41108,"lat":32.408036},{"lng":112.411587,"lat":32.407894},{"lng":112.412223,"lat":32.407645},{"lng":112.412631,"lat":32.407442},{"lng":112.413029,"lat":32.407219},{"lng":112.413625,"lat":32.406789},{"lng":112.417751,"lat":32.403011},{"lng":112.41954,"lat":32.401372},{"lng":112.423258,"lat":32.397945},{"lng":112.424034,"lat":32.397258},{"lng":112.42476,"lat":32.39677},{"lng":112.425496,"lat":32.396401},{"lng":112.427029,"lat":32.395895},{"lng":112.427567,"lat":32.395733},{"lng":112.428542,"lat":32.395427},{"lng":112.428901,"lat":32.395322},{"lng":112.429498,"lat":32.39514},{"lng":112.430145,"lat":32.394939},{"lng":112.430345,"lat":32.394872},{"lng":112.432596,"lat":32.394179},{"lng":112.434968,"lat":32.393445},{"lng":112.439626,"lat":32.391953},{"lng":112.439706,"lat":32.391933},{"lng":112.440205,"lat":32.391766},{"lng":112.441383,"lat":32.391392},{"lng":112.442541,"lat":32.391017},{"lng":112.44343,"lat":32.390739},{"lng":112.44343,"lat":32.390739},{"lng":112.44369,"lat":32.39111},{"lng":112.44382,"lat":32.3913},{"lng":112.44432,"lat":32.392032},{"lng":112.44447,"lat":32.392242},{"lng":112.444931,"lat":32.392913},{"lng":112.445721,"lat":32.394044},{"lng":112.446362,"lat":32.394954},{"lng":112.446662,"lat":32.395384},{"lng":112.447333,"lat":32.396344},{"lng":112.450169,"lat":32.400389},{"lng":112.451843,"lat":32.402783},{"lng":112.452676,"lat":32.403949},{"lng":112.452786,"lat":32.404118},{"lng":112.452786,"lat":32.404118},{"lng":112.452946,"lat":32.404347},{"lng":112.452946,"lat":32.404347},{"lng":112.453619,"lat":32.405183},{"lng":112.45423,"lat":32.405819},{"lng":112.454882,"lat":32.406415},{"lng":112.455554,"lat":32.40694},{"lng":112.455795,"lat":32.407128},{"lng":112.45735,"lat":32.408364},{"lng":112.459147,"lat":32.409776},{"lng":112.460965,"lat":32.411216},{"lng":112.463807,"lat":32.413459},{"lng":112.465757,"lat":32.414982},{"lng":112.465837,"lat":32.415041},{"lng":112.466581,"lat":32.415619},{"lng":112.468883,"lat":32.417414},{"lng":112.470884,"lat":32.418981},{"lng":112.471175,"lat":32.419206},{"lng":112.47204,"lat":32.419872},{"lng":112.47371,"lat":32.421283},{"lng":112.475128,"lat":32.422699},{"lng":112.475188,"lat":32.422768},{"lng":112.47559,"lat":32.423221},{"lng":112.476405,"lat":32.424196},{"lng":112.477411,"lat":32.425419},{"lng":112.479573,"lat":32.428022},{"lng":112.480287,"lat":32.428879},{"lng":112.481413,"lat":32.43026},{"lng":112.483684,"lat":32.433102},{"lng":112.484127,"lat":32.433635},{"lng":112.486678,"lat":32.436775},{"lng":112.488646,"lat":32.439206},{"lng":112.490654,"lat":32.441659},{"lng":112.491617,"lat":32.442796},{"lng":112.492078,"lat":32.44343},{"lng":112.492439,"lat":32.444146},{"lng":112.49295,"lat":32.44525},{"lng":112.493221,"lat":32.445177},{"lng":112.494034,"lat":32.444928},{"lng":112.494175,"lat":32.444886},{"lng":112.496552,"lat":32.444163},{"lng":112.505896,"lat":32.441478},{"lng":112.506616,"lat":32.441268},{"lng":112.507536,"lat":32.441008},{"lng":112.515655,"lat":32.439135},{"lng":112.520611,"lat":32.438025},{"lng":112.524467,"lat":32.437186},{"lng":112.524835,"lat":32.437111},{"lng":112.52602,"lat":32.436848},{"lng":112.526518,"lat":32.436746},{"lng":112.527424,"lat":32.43683},{"lng":112.529076,"lat":32.436977},{"lng":112.529256,"lat":32.43564},{"lng":112.529246,"lat":32.435289},{"lng":112.529226,"lat":32.435109},{"lng":112.529962,"lat":32.434991},{"lng":112.530957,"lat":32.434898},{"lng":112.530838,"lat":32.434166},{"lng":112.530718,"lat":32.431144}]

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/616731.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

从文本日志到图形日志 图形化编程桌面产品的突破

在一个宽敞明亮的会议室里&#xff0c;阳光透过落地窗洒在会议桌上。卧龙和凤雏相对而坐&#xff0c;他们的面前摆放着一些关于图形化编程桌面产品的资料和测试报告。会议室里的气氛紧张而热烈&#xff0c;团队成员们围坐在一起&#xff0c;专注地倾听着卧龙和凤雏的讨论。 卧龙…

Rust编程语言的特点及其适合做什么

Rust编程语言的特点 Rust是一门系统级编程语言&#xff0c;它有如下特点。 1. 类C的语言语法 Rust的具体语法和C/C类似&#xff0c;都是由花括号限定代码块&#xff0c;还有一样的控制流关键字&#xff0c;例如if、else、while和for。然而&#xff0c;也并非所有的C或者C关键…

阿里云和AWS负载均衡服务对比分析

在云计算时代,负载均衡作为一种关键的网络基础设施,承担着在多个服务器之间分发网络流量的重要任务。作为全球两大主要的云服务提供商,阿里云和Amazon Web Services(AWS)都提供了强大的负载均衡解决方案。本文将从性能、功能、可用性和成本等方面对两者进行对比分析。我们九河云…

云南区块链商户平台:抓包技术自制开票工具(三)

前言 上节我们将登录的流程梳理完毕了&#xff0c;来到了本章重点&#xff0c;既然开发票就肯定要有以下参数&#xff1a; 原工具不支持识别历史记录&#xff0c;对于我们的小商店来说&#xff0c;开票的公司基本就是固定的几个&#xff0c;如果提供下拉支持选择将会大大降低…

EPAI手绘建模APP工程图顶部工具栏

7、工程图 图 302 工程图 工程图包括顶部常用工具栏、右侧工程图工具栏、左侧模型列表栏、中间的工程图。 (1) 常用工具栏 ① 删除&#xff0c;选中场景中工程图元素后&#xff0c;删除。可以选择多个工程图元素同时删除。 ② 设置&#xff0c;打开工程图设置页面&#xff0…

FreeRTOS的列表和列表项 list.c文件详解

列表、列表项的定义以及初始化 列表相当于链表&#xff0c;列表项相当于节点&#xff0c;FreeRTOS中的列表相当于一个双向环形链表。 列表使用指针指向列表项。一个列表&#xff08;list&#xff09;下面可能有很多个列表项&#xff08;list item&#xff09;&#xff0c;每个…

JavaEE技术之MySql主从复制及mycat[了解,不讲]

文章目录 1. 主从复制1.1. 主从同步的原理1.2. 检查数据库远程访问权限1.3. 主从配置1.3.1. master配置1.3.2. slave配置1.3.3. 主库创建同步用户1.3.4. 从库配置主从关系1.3.5. 重置主从关系 1.4. 测试主从复制 2. Mycat2.1. Mycat简介2.2. MyCat读写分离原理2.3. 不废话&…

Linux NFS共享目录配置漏洞

Linux NFS共享目录配置漏洞 一、实验目的二、实验原理三、复现准备四、漏洞复现4.1、复现前提4.2、正式复现 一、实验目的 利用 NFS共享目录配置漏洞读取目标主机的 /etc/passwd 文件内容NFS 服务配置漏洞&#xff0c;赋予了根目录远程可写权限&#xff0c;导致 /root/.ssh/au…

编写Ansible角色实现分布式LNMP安装

前言 本文将介绍如何使用 Ansible 编写角色&#xff0c;在分布式环境下完成 LNMP&#xff08;Linux、Nginx、MySQL、PHP&#xff09;的自动化&#xff08;编译&#xff09;安装和配置&#xff0c;并验证 PHP 与 MySQL 数据联通性&#xff0c;实现博客和论坛页面的展示。 常规…

初识C语言——第十八天

循环while/do while while 语法结构 while(表达式) 循环语句; break:在while循环中&#xff0c;break用于永久的终止循环 continue:在while循环中&#xff0c;continue的作用是跳过本次循环continue后面的代码 直接去判断部分&#xff0c;看是否进行下一次循环。 注意事项…

情感感知OCR:整合深度学习技术提升文字识别系统的情感理解能力

摘要&#xff1a;随着深度学习技术的发展&#xff0c;文字识别&#xff08;OCR&#xff09;系统在识别准确率和速度上取得了长足的进步。然而&#xff0c;在处理文本时&#xff0c;仅仅依靠字符和词语的识别并不足以满足用户对信息的全面理解需求。本文提出了一种新颖的方法&am…

nacos命名空间的配置

给微服务配置namespace 给微服务配置namespace只能通过修改配置来实现。 例如&#xff0c;修改order-service的application.yml文件&#xff1a; spring:cloud:nacos:server-addr: localhost:8848discovery:cluster-name: HZnamespace: 492a7d5d-237b-46a1-a99a-fa8e98e4b0f…

sscanf字符串解析

ATCIPSNTPTIME? //发生的指令 CIPSNTPTIME:Tue Oct 19 15:17:56 2021 //回复的数据 //接受数据缓存 char* recvStrBuf "CIPSNTPTIME:Tue Oct 19 15:17:56 2021"; char* weekStr; char* monthStr; int day,hour,minute,second,year; sscanf(recvStrBuf,""…

【效率开发】游戏开发Debug效率方法总结

"程序员的一半生命都浪费在了调试上。" ——Brian Kernighan&#xff08;计算机科学家&#xff0c;曾参与开发C语言&#xff09; &#xff08;图片来源&#xff1a;forbesindia&#xff09; Debug无疑是程序员最头疼&#xff0c;也是耗费时间最多的一个环节&#xf…

redis抖动问题导致延迟或者断开的处理方案

目录&#xff1a; 1、使用背景2、redis重试机制3、redis重连机制4、其他一些解决redis抖动问题方案 1、使用背景 客户反馈文件偶现打不开&#xff0c;报错现象是session not exist&#xff0c;最终定位是redis抖动导致的延迟/断开的现象&#xff0c;最终研发团方案是加入redis…

紫光计算机项目卓越中心负责人孙宇受邀为第十三届中国PMO大会演讲嘉宾

全国PMO专业人士年度盛会 紫光计算机科技有限公司信息技术中心项目总监&卓越中心负责人孙宇先生受邀为PMO评论主办的2024第十三届中国PMO大会演讲嘉宾&#xff0c;演讲议题为“PMO卓越中心核心能力拆解与落地-用创新绘制新蓝图”。大会将于6月29-30日在北京举办&#xff0c…

docker安装向量数据库milvus

Miluvs Milvus 向量数据库能够帮助用户轻松应对海量非结构化数据(图片 / 视频 / 语音 / 文本)检索。 单节点 Milvus 可以在秒内完成十亿级的向量搜索,分布式架构亦能满足用户的水平扩展需求。 Milvus 向量数据库的应用场景包括:互联网娱乐(图片搜索 / 视频搜索)、新零售…

二叉树的非递归遍历(c++)

前序 . - 力扣&#xff08;LeetCode&#xff09;. - 备战技术面试&#xff1f;力扣提供海量技术面试资源&#xff0c;帮助你高效提升编程技能,轻松拿下世界 IT 名企 Dream Offer。https://leetcode.cn/problems/binary-tree-preorder-traversal/description/ 1---2---4---5--…

CentOS7 安装 Kamailio

https://www.kamailio.org/wiki/packages/rpms 官方文档说 yum -y install yum-utils yum-config-manager --add-repo https://rpm.kamailio.org/centos/kamailio.repo 但目前这样其实行不通 需要这样做&#xff1a; yum install --disablerepokamailio --enablerepokamai…

Web3Tools - 助记词生成

Web3Tools - 助记词生成工具 本文介绍了一个简单的助记词生成工具&#xff0c;使用 React 和 Material-UI 构建。用户可以选择助记词的语言和长度&#xff0c;然后生成随机的助记词并显示在页面上 功能介绍 选择语言和长度&#xff1a; 用户可以在下拉菜单中选择助记词的语言&…