sym 图片由项目目录下修改到本地

修改程序

sym 图片域名存储访问

修改历史数据

update symphony_revision set  revisionData=REPLACE(revisionData, 'https://qiankunpingtai.cn/symphony/mnt','https://qkpt.top/mnt'); 
update symphony_user set  userAvatarURL=REPLACE(userAvatarURL, 'https://qiankunpingtai.cn/symphony/mnt','https://qkpt.top/mnt'); 
update symphony_article set  articleContent=REPLACE(articleContent, 'https://qiankunpingtai.cn/symphony/mnt','https://qkpt.top/mnt'); 
update symphony_article set  articleImg1URL=REPLACE(articleImg1URL, 'https://qiankunpingtai.cn/symphony/mnt','https://qkpt.top/mnt'); 
update symphony_link set  linkAddr=REPLACE(linkAddr,'https://qiankunpingtai.cn/symphony/mnt','https://qkpt.top/mnt'); 

修改文章中引用的文章地址为之前的地址

update symphony_revision set  revisionData=REPLACE(revisionData, 'https://qkpt.top/mnt/article','https://qiankunpingtai.cn/symphony/article'); 
update symphony_user set  userAvatarURL=REPLACE(userAvatarURL, 'https://qkpt.top/mnt/article','https://qiankunpingtai.cn/symphony/article'); 
update symphony_article set  articleContent=REPLACE(articleContent, 'https://qkpt.top/mnt/article','https://qiankunpingtai.cn/symphony/article'); 
update symphony_article set  articleImg1URL=REPLACE(articleImg1URL, 'https://qkpt.top/mnt/article','https://qiankunpingtai.cn/symphony/article'); 
update symphony_link set  linkAddr=REPLACE(linkAddr,'https://qkpt.top/mnt/article','https://qiankunpingtai.cn/symphony/article'); 

修改不成功数据回滚

update symphony_revision set  revisionData=REPLACE(revisionData, 'https://qkpt.top/mnt','https://qiankunpingtai.cn/symphony/mnt'); 
update symphony_user set  userAvatarURL=REPLACE(userAvatarURL, 'https://qkpt.top/mnt','https://qiankunpingtai.cn/symphony/mnt'); 
update symphony_article set  articleContent=REPLACE(articleContent, 'https://qkpt.top/mnt','https://qiankunpingtai.cn/symphony/mnt'); 
update symphony_article set  articleImg1URL=REPLACE(articleImg1URL, 'https://qkpt.top/mnt','https://qiankunpingtai.cn/symphony/mnt'); 
update symphony_link set  linkAddr=REPLACE(linkAddr,'https://qkpt.top/mnt','https://qiankunpingtai.cn/symphony/mnt'); 

nginx 设置

user  root;
server {
     listen 443 ssl;
     server_name qkpt.top; # 你的域名
     #ssl on;
     ssl_certificate  /usr/local/nginx/cert/2009734_qkpt.top.pem; # 改成你的证书的名字
     ssl_certificate_key /usr/local/nginx/cert/2009734_qkpt.top.key; # 你的证书的名字
     ssl_session_timeout 5m;
     ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
     ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
     ssl_prefer_server_ciphers on;
     location / {
             proxy_pass        https://qiankunpingtai.cn;
             proxy_redirect default;
             #proxy_set_header Host $host;
             proxy_set_header Host $host:$server_port;
             proxy_set_header REMOTE-HOST $remote_addr;
             proxy_set_header X-Real-IP $remote_addr;
             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      }

	location /mnt/{
			root   /;
			autoindex on;
		}
     error_page   500 502 503 504  /50x.html;
     location = /50x.html {
         root   html;
     }
}


修改标题 + 摘要部分显示图片显示的设置

修改 ArticleQueryService.java

private String getArticleThumbnail(final JSONObject article) {
        final int articleType = article.optInt(Article.ARTICLE_TYPE);
        if (Article.ARTICLE_TYPE_C_THOUGHT == articleType) {
            return "";
        }

        final String content = article.optString(Article.ARTICLE_CONTENT);
        if (StringUtils.isBlank(content)) {
            return "";
        }

        final String html = Markdowns.toHTML(content);
        final String[] imgs = StringUtils.substringsBetween(html, "<img", ">");
        if (null == imgs || 0 == imgs.length) {
            return "";
        }

        String ret = null;
        for (int i = 0; i < imgs.length; i++) {
            ret = StringUtils.substringBetween(imgs[i], "data-src=\"", "\"");
            if (StringUtils.isBlank(ret)) {
                ret = StringUtils.substringBetween(imgs[i], "src=\"", "\"");
            }

            if (!StringUtils.containsIgnoreCase(ret, ".ico")) {
                break;
            }
        }
        if (StringUtils.isBlank(ret)) {
            return "";
        }

        if (Symphonys.QN_ENABLED) {
            final String qiniuDomain = Symphonys.UPLOAD_QINIU_DOMAIN;
            if (StringUtils.startsWith(ret, qiniuDomain)) {
                ret = StringUtils.substringBefore(ret, "?");
                ret += "?imageView2/1/w/" + 180 + "/h/" + 135 + "/format/jpg/interlace/1/q";
            } else {
                ret = "";
            }
        } else {
            /**
             * create by: qiankunpingtai
             * create time: 2019/4/28 9:58
             * website:https://qiankunpingtai.cn
             * description:
             * 修改图片单独域名储存时,在标题+摘要模式下,列表中图片不显示的问题
             *
             */
            if (!(StringUtils.startsWith(ret, Latkes.getServePath())||StringUtils.startsWith(ret, "https://qkpt.top"))) {
                ret = "";
            }
        }

        if (StringUtils.isBlank(ret)) {
            ret = "";
        }

        return ret;
    }

不修改显示效果
clipboard.png

修改后显示效果
clipboard.png