:fire:优化代码

This commit is contained in:
tiansh
2024-03-11 09:27:07 +08:00
parent f0dd1d0db8
commit 0ede684acb
7 changed files with 1 additions and 17 deletions
@@ -35,7 +35,6 @@ public class SubjectFilter extends BasicHttpAuthenticationFilter {
String serviceName = httpServletRequest.getServletPath();//获取接口
String Users_Origin = httpServletRequest.getHeader("usersOrigin");
String token = httpServletRequest.getHeader("Authorization");
//验证前端域名
if(httpServletRequest.getMethod().equals("POST") && !serviceName.contains("/api") && !serviceName.contains("/verifyCode")
&& !serviceName.contains("/getClientVersion") && !serviceName.contains("/client")){
try{
@@ -75,7 +74,6 @@ public class SubjectFilter extends BasicHttpAuthenticationFilter {
Subject subject = SecurityUtils.getSubject();
UsernamePasswordToken tokenOBJ = new UsernamePasswordToken(userData.getEmail(),userData.getPassword());
tokenOBJ.setRememberMe(true);
//执行登录方法,如果没有异常,说明登录成功
subject.login(tokenOBJ);
SecurityUtils.getSubject().getSession().setTimeout(3600000);
User loginUser = (User) SecurityUtils.getSubject().getPrincipal();
@@ -102,7 +100,6 @@ public class SubjectFilter extends BasicHttpAuthenticationFilter {
subject.login(tokenOBJ);
SecurityUtils.getSubject().getSession().setTimeout(3600000);//一小时
} catch (Exception e) {
// System.err.println("拦截器,登录失败,false");
this.CODE = "403";
return false;
}
@@ -9,13 +9,9 @@ import java.util.List;
@Mapper
public interface CodeMapper {
//查询扩容码
List<Code> selectCode(@Param("code") String code);
Code selectCodekey(@Param("code") String code);
//Integer selectCodekey(@Param("value") String value);
//添加
Integer addCode(Code code);
//删除扩容码
Integer deleteCode(@Param("code") String code);
}
@@ -9,11 +9,9 @@ import java.util.List;
@Mapper
public interface KeysMapper {
//查询密钥
Keys selectKeys(@Param("id") Integer id);
List<Keys> getStorageName();
List<Keys> getStorage();
//修改key
Integer updateKey(Keys key);
List<Keys> getKeys();
-4
View File
@@ -11,16 +11,12 @@ public class Msg implements Serializable {
private static final long serialVersionUID = 5196249482551119279L;
//返回码
private String code ="200";
//提示信息
private String info="操作成功";
//返回数据
private Object data;
//异常
private String exceptions;
@@ -415,8 +415,6 @@ public class UploadServicel {
public static String plusDay(int setday) {
Date d = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String currdate = format.format(d);
System.out.println("现在的日期是:" + currdate);
Calendar ca = Calendar.getInstance();
ca.setTime(d);
ca.add(Calendar.DATE, setday); // num为增加的天数,可以改变的
@@ -145,7 +145,6 @@ public class FirstRun implements InitializingBean {
//检查表是否存在,后边加'imgdata' and column_name = 'explains' 检查字段是否存在
private String isTableName = "SELECT count(table_name) FROM information_schema.TABLES WHERE TABLE_SCHEMA='tbed' and table_name =";
private String judgeTable = "select count(*) from information_schema.columns where TABLE_SCHEMA='tbed' and table_name = ";
//创建blacklist 2019-11-29
private String sql0 =
"alter table `keys` add (Region varchar(255) DEFAULT null,RootPath varchar(255) DEFAULT '/');";
private String sql1 = "select count(*) from information_schema.columns where table_name = 'uploadconfig' and column_name = 'blacklist'";
@@ -75,7 +75,7 @@ public class ImgUrlUtil {
throw new Exception("ResponseCode is not begin with 2,code="+code);
}
map.put("Check","true");
System.out.println("连接正常");
// System.out.println("连接正常");
}catch(Exception ex){
System.out.println(ex.getMessage());
}