This commit is contained in:
landaiqing 2023-12-27 16:47:54 +08:00
parent 64173c1afa
commit 9f198edd1e
20 changed files with 110 additions and 65 deletions

1
.gitignore vendored
View File

@ -31,3 +31,4 @@ build/
### VS Code ### ### VS Code ###
.vscode/ .vscode/
/src/main/resources/static/qr/

View File

@ -1,13 +1,19 @@
package com.lovenav; package com.lovenav;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration;
@SpringBootApplication @SpringBootApplication(exclude = {MultipartAutoConfiguration.class})
@MapperScan({"com.lovenav.dao"})
public class LoveNavApplication { public class LoveNavApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(LoveNavApplication.class, args); SpringApplication.run(LoveNavApplication.class, args);
} }
} }

View File

@ -0,0 +1,24 @@
package com.lovenav.configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.MultipartResolver;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
@Configuration
public class UploadConfig {
//显示声明CommonsMultipartResolver为mutipartResolver
@Bean(name = "multipartResolver")
public MultipartResolver multipartResolver() {
CommonsMultipartResolver resolver = new CommonsMultipartResolver();
resolver.setDefaultEncoding("UTF-8");
//resolveLazily属性启用是为了推迟文件解析以在在UploadAction中捕获文件大小异常
resolver.setResolveLazily(true);
resolver.setMaxInMemorySize(40960);
//上传文件大小 5M 5*1024*1024
resolver.setMaxUploadSize(5 * 1024 * 1024);
return resolver;
}
}

View File

@ -6,6 +6,7 @@ import com.lovenav.service.AttachmentService;
import com.lovenav.service.ConfigService; import com.lovenav.service.ConfigService;
import org.apache.catalina.core.ApplicationContext; import org.apache.catalina.core.ApplicationContext;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*; import org.springframework.http.*;
import org.springframework.ui.Model; import org.springframework.ui.Model;
@ -35,8 +36,8 @@ public class AttachmentController {
//上传附件 //上传附件
@RequestMapping(value = "/uploadfile",method = RequestMethod.POST) @RequestMapping(value = "/uploadfile",method = RequestMethod.POST)
public HashMap<String, String> uploadFile(MultipartFile multipartFile, String cate, Config config) throws IOException {//@RequestPart("photos") MultipartFile multipartFile public HashMap<String, Object> uploadFile(MultipartFile multipartFile, String cate, Config config) throws IOException {//@RequestPart("photos") MultipartFile multipartFile
HashMap<String,String> map=new HashMap<>(); HashMap<String,Object> map=new HashMap<>();
if (multipartFile==null){ if (multipartFile==null){
map.put("msg","文件不能为空!"); map.put("msg","文件不能为空!");
return map; return map;
@ -45,9 +46,10 @@ public class AttachmentController {
if (config1==null){ if (config1==null){
map=attachmentService.upload(multipartFile,cate); map=attachmentService.upload(multipartFile,cate);
// out.println(map.get("id")); // out.println(map.get("id"));
config.setValue(map.get("id")); config.setValue(map.get("id").toString());
config.setType("image"); config.setType("image");
map.put("msg",configService.addConfig(config)); map.put("msg",configService.addConfig(config));
map.put("code",200);
}else { }else {
out.println(config1.getValue()); out.println(config1.getValue());
configService.updateConfig(config1); configService.updateConfig(config1);
@ -88,7 +90,14 @@ public class AttachmentController {
headers.setContentType(MediaType.IMAGE_PNG); headers.setContentType(MediaType.IMAGE_PNG);
}else if (attachment.getSuffix().replace(".","").equals("jpeg")){ }else if (attachment.getSuffix().replace(".","").equals("jpeg")){
headers.setContentType(MediaType.IMAGE_JPEG); headers.setContentType(MediaType.IMAGE_JPEG);
}else{ }
else if (attachment.getSuffix().replace(".","").equals("jpg")){
headers.setContentType(MediaType.IMAGE_JPEG);
}
else if (attachment.getSuffix().replace(".","").equals("gif")){
headers.setContentType(MediaType.IMAGE_GIF);
}
else{
bytes= "没有该文件!".getBytes(); bytes= "没有该文件!".getBytes();
headers.setContentType(MediaType.APPLICATION_JSON); headers.setContentType(MediaType.APPLICATION_JSON);
return new ResponseEntity<byte[]>(bytes, headers, HttpStatus.NOT_FOUND); return new ResponseEntity<byte[]>(bytes, headers, HttpStatus.NOT_FOUND);

View File

@ -13,27 +13,28 @@ import org.springframework.web.bind.annotation.RestController;
public class BannersController { public class BannersController {
@Autowired @Autowired
private BannersService bannersService; private BannersService bannersService;
// 跳转链接
@RequestMapping(method = RequestMethod.GET, value = "/jump_url") // 跳转链接
public String jump(int id){ @RequestMapping(method = RequestMethod.GET, value = "/jump_url")
return bannersService.Jump_url(id); public String jump(int id) {
return bannersService.Jump_url(id);
} }
// 添加banner // 添加banner
@RequestMapping(method = RequestMethod.POST, value = "/add_banner") @RequestMapping(method = RequestMethod.POST, value = "/add_banner")
public String add(@RequestBody Banners banners){ public String add(@RequestBody Banners banners) {
return bannersService.Add_banner(banners); return bannersService.Add_banner(banners);
} }
// 删除banner // 删除banner
@RequestMapping(method = RequestMethod.GET, value = "/delete_url") @RequestMapping(method = RequestMethod.GET, value = "/delete_url")
public String delete(int id){ public String delete(int id) {
return bannersService.Delete_banner(id); return bannersService.Delete_banner(id);
} }
// 首页显示banner // 首页显示banner
@RequestMapping(method = RequestMethod.GET, value = "/view_banner") @RequestMapping(method = RequestMethod.GET, value = "/view_banner")
public String view(){ public String view() {
return bannersService.View_banner(); return bannersService.View_banner();
} }
} }

View File

@ -19,7 +19,7 @@ public class QRCodeController {
private QRCService qrcService; private QRCService qrcService;
@RequestMapping(method = RequestMethod.POST, value = "/qrc_return") @RequestMapping(method = RequestMethod.POST, value = "/qrc_return")
public String QRCode(@RequestBody int url_id) throws Exception { public String QRCode(Integer url_id) throws Exception {
return qrcService.QR(url_id); return qrcService.QR(url_id);
} }
} }

View File

@ -33,7 +33,7 @@ public class SearchController {
//非法敏感词汇判断 //非法敏感词汇判断
SensitiveFilter filter = SensitiveFilter.getInstance(); SensitiveFilter filter = SensitiveFilter.getInstance();
String s = filter.replaceSensitiveWord(searchKey, 1, placeholder); String s = filter.replaceSensitiveWord(searchKey, 1, placeholder);
System.out.println(s); //System.out.println(s);
int n = filter.CheckSensitiveWord(searchKey,0,2); int n = filter.CheckSensitiveWord(searchKey,0,2);
//存在非法字符 //存在非法字符
if(n > 0){ if(n > 0){

View File

@ -80,7 +80,7 @@ public class UrlAndCateController {
JsonNode sonNode = rootNode.get(i); JsonNode sonNode = rootNode.get(i);
if(String.valueOf(sonNode.get("type")).equals("\"folder\"")){ if(String.valueOf(sonNode.get("type")).equals("\"folder\"")){
String icon = String.valueOf(sonNode.get("icon")); String icon = String.valueOf(sonNode.get("icon"));
System.out.println(icon.length()); //System.out.println(icon.length());
if (icon.length() == 2) icon ="https://imgbed.landaiqing.space/img/1/2023/12/25/1_6588644cb1f03_1703437387965_20231225.webp"; if (icon.length() == 2) icon ="https://imgbed.landaiqing.space/img/1/2023/12/25/1_6588644cb1f03_1703437387965_20231225.webp";
else{ else{
icon=icon.substring(1,icon.length()-1); icon=icon.substring(1,icon.length()-1);
@ -202,7 +202,7 @@ public class UrlAndCateController {
} }
Collections.sort(integers); Collections.sort(integers);
for (Integer str : integers) { for (Integer str : integers) {
System.out.println(str); //System.out.println(str);
UrlCateList urlCateList =urlCateListService.selectByPrimaryKey(Integer.valueOf(str)); UrlCateList urlCateList =urlCateListService.selectByPrimaryKey(Integer.valueOf(str));
CateAndUrl cateAndUrl = new CateAndUrl(); CateAndUrl cateAndUrl = new CateAndUrl();
cateAndUrl.setFloder("true"); cateAndUrl.setFloder("true");
@ -222,7 +222,7 @@ public class UrlAndCateController {
// cateAndUrlList.add(cateAndUrl); // cateAndUrlList.add(cateAndUrl);
// } // }
System.out.println(cateAndUrlList); //System.out.println(cateAndUrlList);
List<CateAndUrl> parentsList = new ArrayList<>(); List<CateAndUrl> parentsList = new ArrayList<>();
//声明返回集合 //声明返回集合
List<CateAndUrl> resultList = new ArrayList<>(); List<CateAndUrl> resultList = new ArrayList<>();
@ -330,6 +330,8 @@ public class UrlAndCateController {
* @throws IOException * @throws IOException
*/ */
public HSSFWorkbook jsonToExcel(JSONArray jsonArray) throws IOException { public HSSFWorkbook jsonToExcel(JSONArray jsonArray) throws IOException {
Set<String> keys = new HashSet<>(); Set<String> keys = new HashSet<>();
// 创建HSSFWorkbook对象 // 创建HSSFWorkbook对象
HSSFWorkbook wb = new HSSFWorkbook(); HSSFWorkbook wb = new HSSFWorkbook();
@ -353,10 +355,9 @@ public class UrlAndCateController {
HSSFCell cell = row.createCell(0); HSSFCell cell = row.createCell(0);
String temp = jsonObjects.get(i).keySet().toString(); String temp = jsonObjects.get(i).keySet().toString();
String target = temp.substring(1,temp.length()-1); String target = temp.substring(1,temp.length()-1);
String target1 = temp.substring(2,temp.length()-2); cell.setCellValue(target);
cell.setCellValue(target1);
cell = row.createCell(1); cell = row.createCell(1);
cell.setCellValue(jsonObjects.get(i).get(target).toString().substring(2,temp.length()-2)); cell.setCellValue(jsonObjects.get(i).get(target).toString());
} }
return wb; return wb;
@ -481,7 +482,7 @@ public class UrlAndCateController {
List<String> ls=Arrays.asList(parentSet.toArray(new String[0])); List<String> ls=Arrays.asList(parentSet.toArray(new String[0]));
Collections.sort(ls); Collections.sort(ls);
for (String str : ls) { for (String str : ls) {
System.out.println(str); // System.out.println(str);
UrlCateList urlCateList =urlCateListService.selectByPrimaryKey(Integer.valueOf(str)); UrlCateList urlCateList =urlCateListService.selectByPrimaryKey(Integer.valueOf(str));
CateAndUrl cateAndUrl = new CateAndUrl(); CateAndUrl cateAndUrl = new CateAndUrl();
cateAndUrl.setFloder("true"); cateAndUrl.setFloder("true");
@ -571,7 +572,7 @@ public class UrlAndCateController {
cateAndUrlList.add(cateAndUrl); cateAndUrlList.add(cateAndUrl);
} }
System.out.println(cateAndUrlList); // System.out.println(cateAndUrlList);
List<CateAndUrl> parentsList = new ArrayList<>(); List<CateAndUrl> parentsList = new ArrayList<>();
//声明返回集合 //声明返回集合
List<CateAndUrl> resultList = new ArrayList<>(); List<CateAndUrl> resultList = new ArrayList<>();

View File

@ -35,7 +35,7 @@ public class UrlListController {
UrlList urlList = urlListService.selectUrlListByUrlId(Long.valueOf(urlId)); UrlList urlList = urlListService.selectUrlListByUrlId(Long.valueOf(urlId));
String parentString = urlCateListService.selectUrListCateByUrlCateId(urlList.getCateId()); String parentString = urlCateListService.selectUrListCateByUrlCateId(urlList.getCateId());
String [] parentList = parentString.split(","); String [] parentList = parentString.split(",");
System.out.println(parentString); //System.out.println(parentString);
for(String parent : parentList) for(String parent : parentList)
{ {
if(parent.equals("0")){ if(parent.equals("0")){
@ -72,7 +72,7 @@ public class UrlListController {
flag = urlListService.insertUrlByUser(urlList); flag = urlListService.insertUrlByUser(urlList);
String parentString = urlCateListService.selectUrListCateByUrlCateId(urlList.getCateId()); String parentString = urlCateListService.selectUrListCateByUrlCateId(urlList.getCateId());
String [] parentList = parentString.split(","); String [] parentList = parentString.split(",");
System.out.println(parentString); // System.out.println(parentString);
for(String parent : parentList) for(String parent : parentList)
{ {
if(parent.equals("0")){ if(parent.equals("0")){

View File

@ -65,7 +65,7 @@ public class UserController {
@Override @Override
public void run() { public void run() {
session.removeAttribute(user.getUserEmail()); session.removeAttribute(user.getUserEmail());
System.out.println(session.getAttribute(user.getUserEmail())); // System.out.println(session.getAttribute(user.getUserEmail()));
} }
},60, TimeUnit.SECONDS); },60, TimeUnit.SECONDS);
return "发送验证码成功!"; return "发送验证码成功!";
@ -79,8 +79,8 @@ public class UserController {
if (!user.getActiveCode().equals((String) session.getAttribute(user.getUserEmail()))) { if (!user.getActiveCode().equals((String) session.getAttribute(user.getUserEmail()))) {
return "验证码不正确"; return "验证码不正确";
} }
System.out.println(user.getUserLogin()); // System.out.println(user.getUserLogin());
System.out.println(user.getUserEmail()); // System.out.println(user.getUserEmail());
// 用户注册之前根据用户名称查询该用户是否存在如果不存在的情况下才可以注册 如果存在的话就无法注册 // 用户注册之前根据用户名称查询该用户是否存在如果不存在的情况下才可以注册 如果存在的话就无法注册
User user1=userService.selectUserAlreadyExist(user); User user1=userService.selectUserAlreadyExist(user);
if (user1 != null) { if (user1 != null) {
@ -118,7 +118,7 @@ public class UserController {
String ip=IPutils.getIpAddress(request); String ip=IPutils.getIpAddress(request);
System.out.println(ip); // System.out.println(ip);
String locat= String.valueOf(IPutils.getLocation(ip)); String locat= String.valueOf(IPutils.getLocation(ip));
User user1 = userService.userLogin(user); User user1 = userService.userLogin(user);
@ -164,7 +164,7 @@ public class UserController {
Map<String,Object> map=new HashMap<>(); Map<String,Object> map=new HashMap<>();
User user1=userService.selectUserAlreadyExist(user); User user1=userService.selectUserAlreadyExist(user);
System.out.println(user1); // System.out.println(user1);
if (user1==null){ if (user1==null){
map.put("msg","无此邮箱"); map.put("msg","无此邮箱");
return map; return map;

View File

@ -40,7 +40,7 @@ public class UserInterceptor implements HandlerInterceptor {
// 拦截每个请求 // 拦截每个请求
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object obj) throws IOException { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object obj) throws IOException {
Map<String,Object> map=new HashMap<>(); Map<String,Object> map=new HashMap<>();
System.out.println("开始进入拦截器检验jwt头部是否含有Authorization方法"); //System.out.println("开始进入拦截器检验jwt头部是否含有Authorization方法");
// 通过url得到token请求头是否包含Authorization // 通过url得到token请求头是否包含Authorization
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
String jwt = request.getHeader("Authorization"); String jwt = request.getHeader("Authorization");

View File

@ -10,10 +10,10 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public interface AttachmentService { public interface AttachmentService {
HashMap<String,String> upload(MultipartFile file,String cate) throws IOException; HashMap<String,Object> upload(MultipartFile file,String cate) throws IOException;
public HashMap<String,String>storeFile(MultipartFile multipartFile,String cate) throws IOException; public HashMap<String,Object>storeFile(MultipartFile multipartFile,String cate) throws IOException;
public HashMap<String,String>updateFile(MultipartFile multipartFile,String cate,Config config) throws IOException; public HashMap<String,Object>updateFile(MultipartFile multipartFile,String cate,Config config) throws IOException;
public Attachment selectAttachment(Long id); public Attachment selectAttachment(Long id);

View File

@ -1,7 +1,8 @@
package com.lovenav.service; package com.lovenav.service;
import com.lovenav.entity.CollectIconList; import com.lovenav.entity.CollectIconList;
import org.springframework.web.bind.annotation.RequestBody;
public interface QRCService { public interface QRCService {
public String QR(int url_id) throws Exception; public String QR(@RequestBody Integer url_id) throws Exception;
} }

View File

@ -30,13 +30,13 @@ public class AttachmentServiceImpl implements AttachmentService {
AttachmentDao attachmentDao; AttachmentDao attachmentDao;
@Override @Override
public HashMap<String,String> upload(MultipartFile file,String cate) throws IOException { public HashMap<String,Object> upload(MultipartFile file,String cate) throws IOException {
HashMap<String, String> map = storeFile(file,cate); HashMap<String, Object> map = storeFile(file,cate);
return map; return map;
} }
@Override @Override
public HashMap<String, String> storeFile(MultipartFile multipartFile,String cate) throws IOException { public HashMap<String, Object> storeFile(MultipartFile multipartFile,String cate) throws IOException {
HashMap<String,String> map = new HashMap<>(); HashMap<String,Object> map = new HashMap<>();
Attachment attachment=new Attachment(); Attachment attachment=new Attachment();
File path = null; File path = null;
try { try {
@ -70,6 +70,7 @@ public class AttachmentServiceImpl implements AttachmentService {
// attachment.setId(id); // attachment.setId(id);
attachmentDao.insertSelective(attachment); attachmentDao.insertSelective(attachment);
map.put("id", String.valueOf(attachment.getId())); map.put("id", String.valueOf(attachment.getId()));
multipartFile.transferTo(fileUp); multipartFile.transferTo(fileUp);
map.put("url", "/img" + relPath); map.put("url", "/img" + relPath);
@ -83,8 +84,8 @@ public class AttachmentServiceImpl implements AttachmentService {
} }
@Override @Override
public HashMap<String, String> updateFile(MultipartFile multipartFile, String cate, Config config) throws IOException { public HashMap<String, Object> updateFile(MultipartFile multipartFile, String cate, Config config) throws IOException {
HashMap<String,String> map = new HashMap<>(); HashMap<String,Object> map = new HashMap<>();
Attachment attachment=new Attachment(); Attachment attachment=new Attachment();
File path = null; File path = null;
try { try {
@ -119,7 +120,7 @@ public class AttachmentServiceImpl implements AttachmentService {
// attachment.setId(id); // attachment.setId(id);
attachmentDao.updateByPrimaryKeySelective(attachment); attachmentDao.updateByPrimaryKeySelective(attachment);
// map.put("id", String.valueOf(attachment.getId())); // map.put("id", String.valueOf(attachment.getId()));
map.put("msg","更新成功!"); map.put("code",200);
map.put("id", String.valueOf(attachment.getId())); map.put("id", String.valueOf(attachment.getId()));
multipartFile.transferTo(fileUp); multipartFile.transferTo(fileUp);
map.put("url", "/img" + relPath); map.put("url", "/img" + relPath);

View File

@ -22,18 +22,21 @@ public class QRCServiceImpl implements QRCService{
@Autowired @Autowired
private CollectIconListDao collectIconListDao; private CollectIconListDao collectIconListDao;
public String QR(int url_id) throws Exception { public String QR(Integer url_id) throws Exception {
String logoPath = "src/main/resources/static/logo/NAV.png"; String logoPath = "src/main/resources/static/logo/NAV.png";
String destPath = "src/main/resources/static/qr"; String destPath = "src/main/resources/static/qr";
UrlList urlList = urlListDao.selectByPrimaryKey(Long.valueOf(url_id)); UrlList urlList = urlListDao.selectByPrimaryKey(Long.valueOf(url_id));
String url = urlList.getUrl();
String list = collectIconListDao.selectByUrlid(url_id);
CollectIconList collectIconList = new CollectIconList(); CollectIconList collectIconList = new CollectIconList();
String url = urlList.getUrl();
collectIconList.setUrl_id(url_id);
String list = collectIconListDao.selectByUrlid(url_id);
if (list == null) { if (list == null) {
String base64 = QRCodeUtil.ImageToBase64(QRCodeUtil.encode(url, logoPath, destPath, true)); String base64 = QRCodeUtil.ImageToBase64(QRCodeUtil.encode(url, logoPath, destPath, true));
collectIconList.setQr_url(base64); collectIconList.setQr_url(base64);
collectIconListDao.insertSelective(collectIconList); collectIconListDao.insertSelective(collectIconList);
return JSON.toJSONString(base64); // return JSON.toJSONString(collectIconListDao.selectByUrlid(url_id));
// return JSON.toJSONString(base64);
return null;
}else { }else {
return JSON.toJSONString(collectIconListDao.selectByUrlid(url_id)); return JSON.toJSONString(collectIconListDao.selectByUrlid(url_id));
} }

View File

@ -135,7 +135,7 @@ public class RedisServiceImpl implements RedisService {
if (result.size() > HOT_SEARCH_NUMBER) { if (result.size() > HOT_SEARCH_NUMBER) {
break; break;
} }
System.out.println(valueOperations.get(val)); // System.out.println(valueOperations.get(val));
Long time = Long.valueOf(Objects.requireNonNull(valueOperations.get("search:search-time:"+val))); Long time = Long.valueOf(Objects.requireNonNull(valueOperations.get("search:search-time:"+val)));
//返回最近一个月的数据 //返回最近一个月的数据
if ((now - time) < HOT_SEARCH_TIME) { if ((now - time) < HOT_SEARCH_TIME) {

View File

@ -111,7 +111,7 @@ public class UrlCateListServiceImpl implements UrlCateListService {
if(urlCateList.getId() == Integer.valueOf(str)){ if(urlCateList.getId() == Integer.valueOf(str)){
int cateNum = CateNumber.get(urlCateList.getName())+1; int cateNum = CateNumber.get(urlCateList.getName())+1;
CateNumber.put(urlCateList.getName(),cateNum); CateNumber.put(urlCateList.getName(),cateNum);
System.out.println(urlCateList.getName()); // System.out.println(urlCateList.getName());
break; break;
} }
} }
@ -146,13 +146,11 @@ public class UrlCateListServiceImpl implements UrlCateListService {
int parentId = urlCateList.getId(); int parentId = urlCateList.getId();
for(UrlList urlList : urlLists) for(UrlList urlList : urlLists)
{ {
if(urlList.getCateId() == parentId) if(!String.valueOf(urlList.getCateId()).equals(parentId+"")) continue ;
{
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put(urlList.getName(),urlList.getUrl()); jsonObject.put(urlList.getName(),urlList.getUrl());
jsonArray.add(jsonObject); jsonArray.add(jsonObject);
break;
}
} }
} }
return jsonArray; return jsonArray;

View File

@ -117,7 +117,7 @@ public class UserServiceImpl implements UserService {
@Override @Override
public User selectUserAlreadyExist(User user) { public User selectUserAlreadyExist(User user) {
System.out.println(user.getUserEmail()); // System.out.println(user.getUserEmail());
User user1=userDao.selectByEmail(user.getUserEmail()); User user1=userDao.selectByEmail(user.getUserEmail());
return user1; return user1;
} }

File diff suppressed because one or more lines are too long

View File

@ -62,7 +62,7 @@ public class UrlCheckUtil {
}catch (SocketException e) { }catch (SocketException e) {
return "404"; return "404";
} catch (IOException e) { } catch (IOException e) {
System.out.println("报错"); System.out.println("报错");
return "404"; return "404";
} }
return String.valueOf(statusCode); return String.valueOf(statusCode);
@ -74,7 +74,7 @@ public class UrlCheckUtil {
public static boolean CheckHttp(String address) throws URISyntaxException, MalformedURLException { public static boolean CheckHttp(String address) throws URISyntaxException, MalformedURLException {
URL url = new URL(address); URL url = new URL(address);
URI uri = url.toURI(); URI uri = url.toURI();
System.out.println(uri.getScheme()); // System.out.println(uri.getScheme());
if(uri.getScheme().equals("https")){ if(uri.getScheme().equals("https")){
return true; return true;
}else }else