将前端上传的文件同步到sftp服务器

将前端上传的文件同步到sftp服务器

配置

        <!--连接ssh-->
        <dependency>
            <groupId>com.jcraft</groupId>
            <artifactId>jsch</artifactId>
            <version>0.1.55</version> <!-- 检查最新版本 -->
        </dependency>
    @PostMapping("/voice/file/upload")
    @ApiOperation("文件--上传录音文件")
    public Result uploadFile(UploadVoiceFileReq req, @RequestParam("uploadFile") MultipartFile uploadFile) {
        if (CommonUtil.isEmpty(req.getContent())) {
            return Result.fail("语音内容不能为空");
        }
        if (CommonUtil.isEmpty(req.getLanguage())) {
            return Result.fail("语音语言类别不能为空");
        }
        if (CommonUtil.isEmpty(req.getFileName())) {
            return Result.fail("文件名称不能为空");
        }
        String filename = uploadFile.getOriginalFilename();
        if (CommonUtil.isEmpty(uploadFile)) {
            return Result.fail("上传文件不能为空!");
        }
        long fileSize = uploadFile.getSize();
        if (0 == fileSize) {
            return Result.fail("上传文件内容不能为空!");
        }
        String originalFilename = uploadFile.getOriginalFilename();
        String suffix = originalFilename.substring(originalFilename.lastIndexOf(".") + 1);
        if (ObjectUtil.isEmpty(suffix)) {
            return Result.fail("上传文件格式缺失!");
        }
        if (!suffix.equals("wav")) {
            return Result.fail("不支持的文件格式!");
        }

        VoiceFile voiceFile = new VoiceFile();
        // 存储绝对路径
        voiceFile.setFilePath(ctiConfig.getFlowFilePath() + filename);
        voiceFile.setFileName(filename);
        voiceFile.setContent(req.getContent());
        if (null == UserContext.getUser()) {
            voiceFile.setAuthor("local_test");
        } else {
            String username = UserContext.getUser().getUsername();
            voiceFile.setAuthor(username);
        }
        voiceFile.setLanguage(req.getLanguage());
        voiceFile.setStatus(0);
        voiceFile.setDuration(30);
        ChannelSftp channel = null;
        try {
            InputStream inputStream = uploadFile.getInputStream();
            channel = (ChannelSftp) SftpUtil.initialChannel(null, sftpCtiConfiguration.getAccountSftp(), sftpCtiConfiguration.getEntranceTicketSftp(), sftpCtiConfiguration.getServerIp(), sftpCtiConfiguration.getPortSftp(), "180000");
            if (channel == null) {
                log.error(this.getClass().getSimpleName() + "#callVoiceFileList, step0:初始化连接sftp服务器失败!");
                return Result.fail("连接服务器(CTI)失败,请排查配置信息!");
            }
            channel.put(inputStream, ctiConfig.getFlowFilePath() + filename);

        } catch (Exception e) {
            log.error(getClassName() + "#uploadFile,上传失败!");
            e.printStackTrace();
            return Result.fail("uploadFile,文件上传发生异常!");
        } finally {
            SftpUtil.closeChannel(channel);
        }
        // 上传到sftp服务器
        voiceFileService.save(voiceFile);
        return Result.ok();
    }

sftp工具类


import com.jcraft.jsch.*;
import com.zhuao.constant.BusinessCode;
import com.zhuao.dto.SftpFile;
import com.zhuao.exception.FileBizException;
import lombok.extern.slf4j.Slf4j;
import java.io.*;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;

@Slf4j
public class SftpUtil {


    public static Channel initialChannel(String sshKnownHost, String sftpUsername, String sftpPassword, String sftpHost, String sftpPort, String sftpTimeOut) {
        Channel channel = null;
        try {
            JSch jsch = new JSch();
            if (sshKnownHost != null) {
                jsch.setKnownHosts(sshKnownHost);
            }
            Session session = jsch.getSession(sftpUsername, sftpHost, Integer.valueOf(sftpPort));

            if (sshKnownHost == null) {
                java.util.Properties config = new java.util.Properties();
                config.put("StrictHostKeyChecking", "no");
                session.setConfig(config);
            }

            if (sftpPassword != null) {
                session.setPassword(sftpPassword);
            }
            Integer timeout = 30000;
            if (sftpTimeOut != null) {
                timeout = Integer.valueOf(sftpTimeOut);
                session.setTimeout(timeout);
            }
            session.connect(timeout);
            channel = session.openChannel("sftp");
            channel.connect(timeout);
        } catch (Exception e) {
            log.error("", e);
        }
        return channel;
    }

    public static void closeChannel(Channel channel) {
        try {
            Session session = null;
            if (channel != null && channel.isConnected()) {
                session = channel.getSession();
                channel.disconnect();
            }
            if (session != null && session.isConnected()) {
                session.disconnect();
            }
        } catch (JSchException e) {
            log.error("", e);
        }
    }

    /**
     * Download single file from remote to local
     */
    public static File download(ChannelSftp channelSftp, String local, String remote) throws SftpException, IOException {
        File localFile = new File(local);
        FileOutputStream fio = null;
        try {
            if (!channelSftp.isConnected() || channelSftp.stat(remote) == null) {
                return localFile;
            }
        } catch (Exception e) {
            // TODO: handle exception
            log.error("", e);
            throw e;
        }

        if (localFile.exists() && localFile.isDirectory()) {
            Path filePath = Paths.get(remote);
            String fileName = filePath.getFileName().toString();
            localFile = new File(localFile, fileName);

        } else if (!localFile.exists()) {
            try {
                localFile.createNewFile();
            } catch (Exception e) {
                log.error("", e);
                throw e;
            }
        }
        try {
            fio = new FileOutputStream(localFile);
            channelSftp.get(remote, fio);

        } catch (Exception e) {
            log.error("", e);
            throw e;
        } finally {
            if (fio != null) {
                try {
                    fio.flush();
                    fio.close();
                } catch (Exception e) {
                    log.error("", e);
                }
            }
        }
        return localFile;
    }

    /**
     * Download single file from remote to local by OutputStream
     */
    public static void download(ChannelSftp channelSftp, OutputStream fio, String remote) throws SftpException {
        try {
            if (!channelSftp.isConnected() || channelSftp.stat(remote) == null) {
                return;
            }
        } catch (Exception e) {
            log.error("", e);
            throw new SftpException(BusinessCode.BusinessStatus.FILE_NOT_EXIST.getCode(), "文件不存在!");
        }

        try {
            channelSftp.get(remote, fio);
        } catch (Exception e) {
            log.error("", e);
            throw new SftpException(BusinessCode.BusinessStatus.FILE_NOT_EXIST.getCode(), "文件不存在");
        } finally {
            if (fio != null) {
                try {
                    fio.flush();
                    fio.close();
                } catch (Exception e) {
                    log.error("", e);
                    throw new SftpException(BusinessCode.BusinessStatus.FILE_DOWNLOAD_FAILED.getCode(), BusinessCode.BusinessStatus.FILE_DOWNLOAD_FAILED.getValue());
                }
            }
        }
    }


    /**
     * Download file folder from remote to local
     */
    public static File downloadAll(ChannelSftp channelSftp, String localDir, String remoteDir) {
        File localFile = new File(localDir);
        FileOutputStream fio = null;
        try {
            if (!channelSftp.isConnected() || channelSftp.stat(remoteDir) == null) {
                return localFile;
            }
        } catch (Exception e) {
            // TODO: handle exception
            log.error("", e);
        }

        try {
            Vector<ChannelSftp.LsEntry> entries = channelSftp.ls(remoteDir);
            log.info("entries->" + entries);

            //download all from root folder
            for (ChannelSftp.LsEntry en : entries) {
                if (en.getFilename().equals(".") || en.getFilename().equals("..") || en.getAttrs().isDir()) {
                    continue;
                }

                System.out.println(en.getFilename());
                File localDownloadedFile = new File(localDir + en.getFilename());
                if (!localDownloadedFile.exists()) {
                    localDownloadedFile.createNewFile();

                    try {
                        fio = new FileOutputStream(localDownloadedFile);
                        channelSftp.get(remoteDir + en.getFilename(), fio);
//		    		    logger.debug(String.format("Complete get remote file to '%s'", localFile.getName().toString()));

                    } catch (Exception e) {
                        log.error("", e);
                    } finally {
                        if (fio != null) {
                            try {
                                fio.flush();
                                fio.close();
                            } catch (Exception e) {
                                log.error("", e);
                            }
                        }
                    }

                }

            }

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (fio != null) {
                try {
                    fio.flush();
                    fio.close();
                } catch (Exception e) {
                    log.error("", e);
                }
            }
        }
        return localFile;
    }

    /**
     * 指定路径下的所有文件上传到服务器
     *
     * @param channelSftp
     * @param local
     * @param remote
     * @throws FileNotFoundException
     * @throws SftpException
     */
    public static void uploads(ChannelSftp channelSftp, String local, String remote)
            throws FileNotFoundException, SftpException {
        File localFile = new File(local);
        SftpATTRS attrs = null;
        if (!localFile.exists()) {
            throw new FileNotFoundException();
        }
        if (!localFile.isDirectory()) {
            upload(channelSftp, local, remote);
            return;
        }
        queryAndCreateFolders(channelSftp, remote);
        try {
            attrs = channelSftp.stat(remote);
        } catch (SftpException e) {
            channelSftp.mkdir(remote);
            attrs = channelSftp.stat(remote);
//            e.printStackTrace();
        }
        if (attrs != null && !attrs.isDir()) {
            // Cannot copy directory contains multiple files to a single file, but move to same directory.
            remote = Paths.get(remote).getParent().toString();
        }
        for (File file : localFile.listFiles()) {
            if (file.isDirectory()) {
                uploads(channelSftp, file.getPath(),
                        String.format("%s/%s", remote, file.getName()));
                continue;
            }
            FileInputStream fis = null;
            try {
                fis = new FileInputStream(localFile);
                channelSftp.put(fis, String.format("%s/%s", remote, file.getName()));
//				logger.debug(String.format("Complete put '%s' to remote", file.getName().toString()));
            } catch (FileNotFoundException | SftpException e) {
                log.error("", e);
            } finally {
                if (fis != null) {
                    try {
                        fis.close();
                    } catch (IOException e) {
                        log.error("fis close error...", e);
                    }
                }
            }
        }
        return;
    }


    /**
     * @param channelSftp
     * @param local
     * @param remote
     * @throws FileNotFoundException
     * @throws SftpException
     * @Description 指定文件(单个)上传到服务器
     */
    public static void upload(ChannelSftp channelSftp, String local, String remote) throws FileNotFoundException, SftpException {
        File localFile = new File(local);
        SftpATTRS attrs = null;
        if (!localFile.exists()) {
            throw new FileNotFoundException();
        }
        if (localFile.isDirectory()) {
            uploads(channelSftp, local, remote);
            return;
        }
        queryAndCreateFolders(channelSftp, remote);
        try {
            attrs = channelSftp.stat(remote);
        } catch (SftpException e) {
//            channelSftp.mkdir(remote);
//            e.printStackTrace();
            log.error("", e);
        }
        if (attrs != null && attrs.isDir()) {
            // Cannot replace existing directory by file, copy to that directory
            Path filePath = Paths.get(local);
            String fileName = filePath.getFileName().toString();
            remote = String.format("%s/%s", remote, fileName);
        }
        FileInputStream fis = null;
        try {
            fis = new FileInputStream(localFile);
            channelSftp.put(fis, remote);
//		    logger.debug(String.format("Complete put '%s' to remote", localFile.getName().toString()));
        } catch (FileNotFoundException | SftpException e) {
            log.error("", e);
        } finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (IOException e) {
                    log.error("fis close error...", e);
                }
            }
        }
        return;
    }

    /**
     * Upload single file to remote path
     */
    public static void upload(ChannelSftp channelSftp, File localFile, String remote)
            throws FileNotFoundException, SftpException {
        log.info("execute upload start-->");
        SftpATTRS attrs = null;
        if (!localFile.exists()) {
            throw new FileNotFoundException();
        }
        queryAndCreateFolders(channelSftp, remote);
        try {
            attrs = channelSftp.stat(remote);
        } catch (SftpException e) {

            log.error("channelSftp.stat() error...", e);
        }
        if (attrs != null && attrs.isDir()) {
            // Cannot replace existing directory by file, copy to that directory
            String fileName = localFile.getName();
            remote = String.format("%s/%s", remote, fileName);
        }
        log.info("remote-->" + remote);
        FileInputStream fis = null;
        try {
            fis = new FileInputStream(localFile);
            channelSftp.put(fis, remote);
//		    logger.debug(String.format("Complete put '%s' to remote", localFile.getName().toString()));
        } catch (FileNotFoundException | SftpException e) {
            log.error("", e);
            throw new FileBizException(BusinessCode.BusinessStatus.FILE_NOT_EXIST.getCode(), "上傳文件失敗");
        } finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (IOException e) {
                    log.error("fis close error...", e);
                }
            }
        }
        log.info("execute upload end");
        return;
    }

    /**
     * linux環境,判斷是否存在路徑,不存在則創建
     *
     * @param channelSftp
     * @param filePath
     * @throws SftpException
     */
    private static void queryAndCreateFolders(ChannelSftp channelSftp, String filePath) throws SftpException {
        String[] paths = filePath.split("/");
        StringBuilder sb = new StringBuilder();
        for (String p : paths) {
            if (CommonUtil.isEmpty(p)) {
                continue;
            }
            sb.append("/" + p);
            String nextPath = sb.toString();
            try {
                channelSftp.ls(nextPath);
            } catch (Exception e) {
                channelSftp.mkdir(nextPath);
            }
        }
    }

    public static boolean isExistFile(ChannelSftp sftp, String path) throws SftpException {
        boolean isExist = false;
        try {
            SftpATTRS sftpATTRS = sftp.stat(path);
            isExist = true;
        } catch (Exception e) {
            String errMsg = e.getMessage();
            if (!CommonUtil.isEmpty(errMsg) && errMsg.toLowerCase().equals("no such file")) {
                isExist = false;
            } else {
                throw e;
            }
        }
        return isExist;

    }

    public static void main(String[] args) {
        ChannelSftp channelSftp = (ChannelSftp) initialChannel(null, "root", "ZHyjzx@2023!#", "10.152.245.14", "22", "180000");
        if (channelSftp == null) {
            return;
        }
        try {
            //upload(channelSftp, "C:\\Users\\nigel.szeto\\Desktop\\testFolder", "/mnt/c/Users/nigel.szeto/Desktop/testDes");
            //listAllFiles(channelSftp, "/usr/local/isoftcall/data/user/0/flow/");

            System.err.println("*******************************************************************");
            listAllFileNames(channelSftp, "/usr/local/isoftcall/data/user/0/flow/");
        } catch (Exception e) {
            // TODO Auto-generated catch block
            log.error("", e);
        }
        closeChannel(channelSftp);
    }

    public static List<SftpFile> listAllFiles(ChannelSftp sftp, String remoteDir) {
        List<SftpFile> sftpFileList = new ArrayList<>();
        try {
            sftp.ls(remoteDir).forEach(vector -> {
                SftpFile sftpFile = new SftpFile();
                ChannelSftp.LsEntry lsEntry = (ChannelSftp.LsEntry) vector;
                sftpFile.setFilename(lsEntry.getFilename());
                sftpFile.setLongname(lsEntry.getLongname());
                sftpFile.setSize(lsEntry.getAttrs().getSize());
                sftpFile.setAtime(lsEntry.getAttrs().getATime());
                sftpFile.setMtime(lsEntry.getAttrs().getMTime());
                sftpFile.setFlags(lsEntry.getAttrs().getFlags());
                sftpFile.setGid(lsEntry.getAttrs().getGId());

                sftpFileList.add(sftpFile);
            });
        } catch (SftpException e) {
            log.error("", e);
        }
        try {
            sftp.getSession().disconnect();
        } catch (JSchException e) {
            log.error("", e);
        }
        sftpFileList.stream().forEach(System.out::println);
        return sftpFileList;
    }


    public static List<String> listAllFileNames(ChannelSftp sftp, String remoteDir) {
        List<String> fileNameList = new ArrayList<>();
        try {
            sftp.ls(remoteDir).forEach(vector -> {
                ChannelSftp.LsEntry lsEntry = (ChannelSftp.LsEntry) vector;
                if (!lsEntry.getAttrs().isDir() && lsEntry.getFilename().endsWith(".wav")) {
                    fileNameList.add(lsEntry.getFilename());
                }
            });
        } catch (SftpException e) {
            log.error("", e);
        }
        closeChannel(sftp);
        fileNameList.stream().forEach(System.out::println);
        return fileNameList;
    }
}

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

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

相关文章

揭秘Semantic Kernel:用AI自动规划和执行用户请求

在我们日益高效的开发世界中&#xff0c;将任务自动化并智能规划变得越来越必要。今天&#xff0c;我要给大家介绍一个强大的概念——Semantic Kernel中的planner功能。通过这篇文章&#xff0c;我们会学习到planner的工作原理以及如何实现智能任务规划。 什么是planner&#x…

Spring GateWay自定义断言工厂

文章目录 概要整体架构流程最终的处理效果小结 概要 我们在线上系统部署了&#xff0c;灰度环境和生产环境时&#xff0c;可以通过自定义断言工厂去将请求需要路由到灰度环境的用户调用灰度的的服务集群&#xff0c;将正常的用户调用正常集群。 这样&#xff0c;我们可以在上线…

R语言论文插图模板第7期—分组散点图

在之前的文章中&#xff0c;分享过R语言折线图的绘制模板&#xff1a; 柱状图的绘制模板&#xff1a; 本期再来分享一下散点图&#xff08;分组&#xff09;的绘制方法。 先来看一下成品效果&#xff1a; 特别提示&#xff1a;本期内容『数据代码』已上传资源群中&#xff0c;…

碰撞检测 | 基于ROS Rviz插件的多边形碰撞检测仿真平台

目录 0 专栏介绍1 基于多边形的碰撞检测2 碰撞检测仿真平台搭建2.1 多边形实例2.2 外部服务接口2.3 Rviz插件化 3 案例演示3.1 功能介绍3.2 绘制多边形 0 专栏介绍 &#x1f525;课设、毕设、创新竞赛必备&#xff01;&#x1f525;本专栏涉及更高阶的运动规划算法轨迹优化实战…

【附源码】Python :PYQT界面点击按钮随机变色

系列文章目录 Python 界面学习&#xff1a;PYQT界面点击按钮随机变色 文章目录 系列文章目录一、项目需求二、源代码三、代码分析3.1 导入模块&#xff1a;3.2 定义App类&#xff1a;3.3 构造函数&#xff1a;3.4 初始化用户界面&#xff1a;3.5 设置窗口属性&#xff1a;3.6 …

基于距离度量学习的异常检测:一种通过相关距离度量的异常检测方法

异常通常被定义为数据集中与大多数其他项目非常不同的项目。或者说任何与所有其他记录(或几乎所有其他记录)显著不同的记录,并且与其他记录的差异程度超出正常范围,都可以合理地被认为是异常。 例如上图显示的数据集中,我们有四个簇(A、B、C和D)和三个位于这些簇之外的点:P1、P…

client网络模块的开发和client与server端的部分联动调试

客户端网络模块的开发 我们需要先了解socket通信的流程 socket通信 server端的流程 client端的流程 对于closesocket()函数来说 closesocket()是用来关闭套接字的,将套接字的描述符从内存清除,并不是删除了那个套接字,只是切断了联系,所以我们如果重复调用,不closesocket()…

Agentic Security:一款针对LLM模型的模糊测试与安全检测工具

关于Agentic Security Agentic Security是一款针对LLM模型的模糊测试与安全检测工具&#xff0c;该工具可以帮助广大研究人员针对任意LLM执行全面的安全分析与测试。 请注意 Agentic Security 是作为安全扫描工具设计的&#xff0c;而不是万无一失的解决方案。它无法保证完全防…

C++(11)类语法分析(2)

C(10)之类语法分析(2) Author: Once Day Date: 2024年8月17日 一位热衷于Linux学习和开发的菜鸟&#xff0c;试图谱写一场冒险之旅&#xff0c;也许终点只是一场白日梦… 漫漫长路&#xff0c;有人对你微笑过嘛… 全系列文章可参考专栏: 源码分析_Once-Day的博客-CSDN博客 …

Python数据结构:集合详解(创建、集合操作)④

文章目录 1. Python集合概述2. 创建集合2.1 使用花括号 {} 创建集合2.2 使用 set() 函数创建集合2.3 创建空集合 3. 集合操作3.1 添加和删除元素3.2 集合的基本操作3.3 集合的比较操作3.4 不可变集合&#xff08;frozenset&#xff09; 4. 综合例子&#xff1a;图书管理系统 Py…

30秒内批量删除git本地分支

在开发过程中&#xff0c;我们经常需要对本地的 Git 分支进行管理。有时&#xff0c;由于各种原因&#xff0c;我们可能需要批量删除本地的分支。这可能是因为某些分支已经不再需要&#xff0c;或者是为了清理本地的分支列表&#xff0c;以保持整洁和易于管理。 要批量删除本地…

没有用的小技巧之---接入网线,有内网没有外网,但是可以登录微信

打开控制面板&#xff0c;找到网络和Internet 选择Internet选项 点击连接&#xff0c;选择局域网设置 取消勾选代理服务器

开放式耳机会打扰到别人吗?四款漏音处理做的好的蓝牙耳机

一般情况下&#xff0c;开放式耳机不会打扰到别人。 开放式耳机通常采用全开放设计&#xff0c;声音不会完全封闭在耳朵里&#xff0c;而是向四周扩散&#xff0c;相比封闭式耳机&#xff0c;其对外界环境的噪音影响更小 。而且现在的开放式耳机在技术上已经有了很大的进步&am…

[数据集][目标检测]工程机械车辆检测数据集VOC+YOLO格式3189张10类别

数据集格式&#xff1a;Pascal VOC格式YOLO格式(不包含分割路径的txt文件&#xff0c;仅仅包含jpg图片以及对应的VOC格式xml文件和yolo格式txt文件) 图片数量(jpg文件个数)&#xff1a;3189 标注数量(xml文件个数)&#xff1a;3189 标注数量(txt文件个数)&#xff1a;3189 标注…

springboot的自动配置和怎么做自动配置

目录 一、Condition 1、Condition的具体实现 2、Condition小结 &#xff08;1&#xff09;自定义条件 &#xff08;2&#xff09;SpringBoot 提供的常用条件注解 二、Enable注解 三、EnableAutoConfiguration 注解和自动配置 1、EnableAutoConfiguration的三个注解属性…

git 学习--GitHub Gitee码云 GitLab

1 集中式和分布式的区别 1.1 集中式 集中式VCS必须有一台电脑作为服务器&#xff0c;每台电脑都把代码提交到服务器上&#xff0c;再从服务器下载代码。如果网络出现问题或服务器宕机&#xff0c;系统就不能使用了。 1.2 分布式 分布式VCS没有中央服务器&#xff0c;每台电脑…

Python编码系列—Python SQL与NoSQL数据库交互:深入探索与实战应用

&#x1f31f;&#x1f31f; 欢迎来到我的技术小筑&#xff0c;一个专为技术探索者打造的交流空间。在这里&#xff0c;我们不仅分享代码的智慧&#xff0c;还探讨技术的深度与广度。无论您是资深开发者还是技术新手&#xff0c;这里都有一片属于您的天空。让我们在知识的海洋中…

预警先行,弯道哨兵让行车更安全

预警先行&#xff0c;弯道哨兵让行车更安全”这句话深刻体现了现代交通安全理念中预防为主、科技赋能的重要性。在道路交通中&#xff0c;尤其是复杂多变的弯道区域&#xff0c;交通事故的发生率往往较高&#xff0c;因此&#xff0c;采取有效的预警措施和引入先进的交通辅助设…

怎么管控终端电脑上的移动端口

管控终端电脑上的移动端口&#xff0c;尤其是USB等移动端口&#xff0c;是确保企业数据安全和提升网络管理效率的重要手段。 一、使用注册表编辑器禁用USB端口&#xff08;适用于Windows系统&#xff09; 打开注册表编辑器&#xff1a; 同时按下“WinR”组合键&#xff0c;打…

SEO优化:如何优化自己的文章,解决搜索引擎不收录的问题

可以使用bing的URL检查&#xff0c;来检查自己的文章是不是负荷收录准测&#xff0c;如果页面有严重的错误&#xff0c;搜索引擎是不会进行收录的&#xff0c;而且还会判定文章为低质量文章&#xff01; 检查是否有问题。下面的页面就是有问题&#xff0c;当然如果是误报你也可…