mirror of
https://github.com/Hello-hao/Tbed.git
synced 2024-04-21 12:32:10 +00:00
2021-03-25更新添加打印相关日志
删除无用注释代码
This commit is contained in:
@@ -12,9 +12,7 @@ public class WebMvcConfigurer extends WebMvcConfigurerAdapter {
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
String filePath =File.separator + "HellohaoData" + File.separator;
|
||||
//和页面有关的静态目录都放在项目的static目录下
|
||||
//registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
|
||||
//上传的图片在D盘下的OTA目录下,访问路径如:http://localhost:8081/OTA/d3cf0281-bb7f-40e0-ab77-406db95ccf2c.jpg
|
||||
System.out.println(filePath);
|
||||
//其中OTA表示访问的前缀。"file:D:/OTA/"是文件真实的存储路径
|
||||
//registry.addResourceHandler("/test/**").addResourceLocations("file:C:/test/");
|
||||
registry.addResourceHandler("/links/**").addResourceLocations("file:"+filePath);
|
||||
|
||||
@@ -72,19 +72,8 @@ public class GroupController {
|
||||
@RequestMapping(value = "/addisgroup")
|
||||
@ResponseBody
|
||||
public Integer addisgroup(Group group) {
|
||||
//boolean b =false;
|
||||
//if(group.getKeyid()==5){
|
||||
// b =true;
|
||||
//}else{
|
||||
//Keys key = keysService.selectKeys(group.getKeyid());
|
||||
//b = StringUtils.doNull(group.getKeyid(),key);
|
||||
//}
|
||||
Integer ret = 0;
|
||||
//if(b){
|
||||
ret = groupService.addgroup(group);
|
||||
//}else{
|
||||
// ret = -1;
|
||||
//}
|
||||
ret = groupService.addgroup(group);
|
||||
return ret;
|
||||
}
|
||||
@RequestMapping(value = "/delegroup")
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
@Component
|
||||
public class InterceptorConfig implements HandlerInterceptor {
|
||||
//private static final Logger log = LoggerFactory.getLogger(InterceptorConfig.class);
|
||||
|
||||
/**
|
||||
* 进入controller层之前拦截请求
|
||||
@@ -33,32 +32,7 @@ public class InterceptorConfig implements HandlerInterceptor {
|
||||
//这个方法是在访问接口之前执行的,我们只需要在这里写验证登陆状态的业务逻辑,就可以在用户调用指定接口之前验证登陆状态了
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
UserServiceImpl userService = SpringContextHolder.getBean(UserServiceImpl.class);
|
||||
HttpSession session = request.getSession();
|
||||
//这里的User是登陆时放入session的
|
||||
// User user = (User) session.getAttribute("user");
|
||||
// if(user==null){
|
||||
// Cookie[] cookies = request.getCookies();
|
||||
// String Hellohao_UniqueUserKey = "";
|
||||
// for (Cookie cookie : cookies) {
|
||||
// if(cookie.getName().equals("Hellohao_UniqueUserKey") && Hellohao_UniqueUserKey.equals("")){
|
||||
// Hellohao_UniqueUserKey = URLDecoder.decode(cookie.getValue(), "GBK");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if(Hellohao_UniqueUserKey!=null && !Hellohao_UniqueUserKey.equals("")){
|
||||
// //String basepass = Base64Encryption.encryptBASE64(pass.getBytes());
|
||||
// Integer ret = userService.login(null, null,Hellohao_UniqueUserKey);
|
||||
// if (ret > 0) {
|
||||
// User u = userService.getUsersMail(Hellohao_UniqueUserKey);
|
||||
// if (u.getIsok() == 1) {
|
||||
// session.setAttribute("user", u);
|
||||
// session.setAttribute("email", u.getEmail());
|
||||
// //request.getRequestDispatcher("/admin/goadmin").forward(request, response);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
HttpSession session = request.getSession();
|
||||
User suser = (User) session.getAttribute("user");
|
||||
String email = null;
|
||||
Integer level = 0;
|
||||
|
||||
@@ -6,8 +6,6 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
|
||||
@Configuration
|
||||
|
||||
Reference in New Issue
Block a user