mirror of
https://github.com/Hello-hao/Tbed.git
synced 2024-04-21 12:32:10 +00:00
2019-7-26更新 新增限制游客上传
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
package cn.hellohao.controller;
|
||||
|
||||
import cn.hellohao.pojo.Config;
|
||||
import cn.hellohao.pojo.EmailConfig;
|
||||
import cn.hellohao.pojo.Keys;
|
||||
import cn.hellohao.pojo.UploadConfig;
|
||||
import cn.hellohao.pojo.*;
|
||||
import cn.hellohao.service.*;
|
||||
import cn.hellohao.utils.Print;
|
||||
import cn.hellohao.utils.StringUtils;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@@ -16,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.HashMap;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/root")
|
||||
@@ -31,6 +29,8 @@ public class AdminRootController {
|
||||
private EmailConfigService emailConfigService;
|
||||
@Autowired
|
||||
private UploadConfigService uploadConfigService;
|
||||
@Autowired
|
||||
private NoticeService noticeService;
|
||||
|
||||
//返回对象存储界面
|
||||
@RequestMapping(value = "/touser")
|
||||
@@ -43,7 +43,7 @@ public class AdminRootController {
|
||||
public String tostorage(HttpSession session, Model model, HttpServletRequest request) {
|
||||
Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
|
||||
Keys key= keysService.selectKeys(config.getSourcekey());//然后根据类型再查询key
|
||||
Boolean b = StringUtils.doNull(key);//判断对象是否有空值
|
||||
Boolean b = StringUtils.doNull(config.getSourcekey(),key);//判断对象是否有空值
|
||||
Integer StorageType = 0;
|
||||
if(config.getSourcekey()!=5){
|
||||
if(b){
|
||||
@@ -80,6 +80,17 @@ public class AdminRootController {
|
||||
jsonArray.add(key);
|
||||
return jsonArray.toString();
|
||||
}
|
||||
//获取当前使用的对象存储
|
||||
@PostMapping("/getkeyourceype")
|
||||
@ResponseBody
|
||||
public Integer getkeyourceype() {
|
||||
Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
|
||||
Integer ret = 0;
|
||||
if(config.getSourcekey()!=null){
|
||||
ret = config.getSourcekey();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@PostMapping("/updatekey")
|
||||
@ResponseBody
|
||||
@@ -102,8 +113,14 @@ public class AdminRootController {
|
||||
@ResponseBody
|
||||
public String deleuser(HttpSession session, Integer id) {
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
Integer ret = userService.deleuser(id);
|
||||
jsonArray.add(ret);
|
||||
User u = (User) session.getAttribute("user");
|
||||
if(u.getId()==id){
|
||||
jsonArray.add("-1");
|
||||
}else{
|
||||
Integer ret = userService.deleuser(id);
|
||||
jsonArray.add(ret);
|
||||
}
|
||||
|
||||
return jsonArray.toString();
|
||||
}
|
||||
|
||||
@@ -166,4 +183,24 @@ public class AdminRootController {
|
||||
return ret;
|
||||
}
|
||||
|
||||
//关于系统
|
||||
@RequestMapping("/about")
|
||||
public String about(HttpSession session,Model model ) {
|
||||
//Integer ret = uploadConfigService.setUpdateConfig(updateConfig);
|
||||
User u = (User) session.getAttribute("user");
|
||||
model.addAttribute("level",u.getLevel());
|
||||
return "admin/about";
|
||||
}
|
||||
//检查更新
|
||||
@PostMapping("/sysupdate")
|
||||
@ResponseBody
|
||||
public Integer sysupdate(String dates) {
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
String urls ="http://tc.hellohao.cn/systemupdate";
|
||||
paramMap.put("dates",dates);
|
||||
String result= HttpUtil.post(urls, paramMap);
|
||||
System.out.println(Integer.parseInt( result ));
|
||||
return Integer.parseInt( result );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user