mirror of
https://github.com/Hello-hao/Tbed.git
synced 2024-04-21 12:32:10 +00:00
:art:修改系统配置表数据结构,添加数据库连接检测
This commit is contained in:
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
@RequestMapping("/admin/root")
|
||||
public class AdminRootController {
|
||||
@Autowired
|
||||
private ConfigService configService;
|
||||
private ConfdataService confdataService;
|
||||
@Autowired
|
||||
private KeysService keysService;
|
||||
@Autowired
|
||||
@@ -260,7 +260,7 @@ public class AdminRootController {
|
||||
User u = (User) subject.getPrincipal();
|
||||
try {
|
||||
UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
|
||||
Config config = configService.getSourceype();
|
||||
final Confdata confdata = confdataService.selectConfdata("config");
|
||||
SysConfig sysConfig = sysConfigService.getstate();
|
||||
AppClient appClientData = appClientService.getAppClientData("app");
|
||||
uploadConfig.setUsermemory(Long.toString(Long.valueOf(uploadConfig.getUsermemory()) / 1024 / 1024));
|
||||
@@ -268,7 +268,7 @@ public class AdminRootController {
|
||||
uploadConfig.setFilesizetourists(Long.toString(Long.valueOf(uploadConfig.getFilesizetourists()) / 1024 / 1024));
|
||||
uploadConfig.setFilesizeuser(Long.toString(Long.valueOf(uploadConfig.getFilesizeuser()) / 1024 / 1024));
|
||||
jsonObject.put("uploadConfig", uploadConfig);
|
||||
jsonObject.put("config", config);
|
||||
jsonObject.put("config", JSONObject.parseObject(confdata.getJsondata()));
|
||||
jsonObject.put("sysConfig", sysConfig);
|
||||
jsonObject.put("appClient", appClientData);
|
||||
msg.setData(jsonObject);
|
||||
@@ -296,7 +296,7 @@ public class AdminRootController {
|
||||
msg.setCode("500");
|
||||
return msg;
|
||||
}
|
||||
Config config = JSON.toJavaObject((JSON) jsonObject.get("config"), Config.class);
|
||||
// Config config = JSON.toJavaObject((JSON) jsonObject.get("config"), Config.class);
|
||||
SysConfig sysConfig = JSON.toJavaObject((JSON) jsonObject.get("sysConfig"), SysConfig.class);
|
||||
AppClient appClient = JSON.toJavaObject((JSON) jsonObject.get("appClient"), AppClient.class);
|
||||
if (Integer.valueOf(vm) == -1) {
|
||||
@@ -308,7 +308,10 @@ public class AdminRootController {
|
||||
uploadConfig.setUsermemory(Long.toString(Long.valueOf(uploadConfig.getUsermemory()) * 1024 * 1024));
|
||||
uploadConfig.setFilesizeuser(Long.toString(Long.valueOf(uploadConfig.getFilesizeuser()) * 1024 * 1024));
|
||||
uploadConfigService.setUpdateConfig(uploadConfig);
|
||||
configService.setSourceype(config);
|
||||
Confdata confdata = new Confdata();
|
||||
confdata.setKey("config");
|
||||
confdata.setJsondata(jsonObject.getJSONObject("config").toJSONString());
|
||||
confdataService.updateConfdata(confdata);
|
||||
sysConfigService.setstate(sysConfig);
|
||||
if (!appClient.getIsuse().equals("on")) {
|
||||
appClient.setIsuse("off");
|
||||
|
||||
@@ -3,7 +3,6 @@ package cn.hellohao.controller;
|
||||
import cn.hellohao.auth.token.JWTUtil;
|
||||
import cn.hellohao.pojo.*;
|
||||
import cn.hellohao.service.*;
|
||||
import cn.hellohao.service.impl.AlbumServiceImpl;
|
||||
import cn.hellohao.service.impl.UploadServicel;
|
||||
import cn.hellohao.service.impl.deleImages;
|
||||
import cn.hellohao.utils.GetIPS;
|
||||
@@ -34,7 +33,7 @@ import java.util.UUID;
|
||||
public class IndexController {
|
||||
@Autowired private ImgService imgService;
|
||||
@Autowired private SysConfigService sysConfigService;
|
||||
@Autowired private ConfigService configService;
|
||||
@Autowired private ConfdataService confdataService;
|
||||
@Autowired private UploadConfigService uploadConfigService;
|
||||
@Autowired private UploadServicel uploadServicel;
|
||||
@Autowired private deleImages deleimages;
|
||||
@@ -54,21 +53,21 @@ public class IndexController {
|
||||
@ResponseBody
|
||||
public Msg webInfo() {
|
||||
Msg msg = new Msg();
|
||||
Config config = configService.getSourceype();
|
||||
final Confdata confdata = confdataService.selectConfdata("config");
|
||||
JSONObject cd = JSONObject.parseObject(confdata.getJsondata());
|
||||
UploadConfig updateConfig = uploadConfigService.getUpdateConfig();
|
||||
SysConfig sysConfig = sysConfigService.getstate();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
AppClient appClient = appClientService.getAppClientData("app");
|
||||
jsonObject.put("webname", config.getWebname());
|
||||
jsonObject.put("websubtitle", config.getWebsubtitle());
|
||||
jsonObject.put("keywords", config.getWebkeywords());
|
||||
jsonObject.put("description", config.getWebms());
|
||||
jsonObject.put("explain", config.getExplain());
|
||||
jsonObject.put("favicon", config.getWebfavicons());
|
||||
jsonObject.put("baidu", config.getBaidu());
|
||||
jsonObject.put("links", config.getLinks());
|
||||
jsonObject.put("aboutinfo", config.getAboutinfo());
|
||||
jsonObject.put("logo", config.getLogo());
|
||||
jsonObject.put("webname", cd.getString("webname"));
|
||||
jsonObject.put("websubtitle", cd.getString("websubtitle"));
|
||||
jsonObject.put("keywords", cd.getString("keywords"));
|
||||
jsonObject.put("description", cd.getString("description"));
|
||||
jsonObject.put("explain", cd.getString("explain"));
|
||||
jsonObject.put("baidu", cd.getString("baidu"));
|
||||
jsonObject.put("links", cd.getString("links"));
|
||||
jsonObject.put("aboutinfo", cd.getString("aboutinfo"));
|
||||
jsonObject.put("logo", cd.getString("logo"));
|
||||
jsonObject.put("api", updateConfig.getApi());
|
||||
jsonObject.put("register", sysConfig.getRegister());
|
||||
jsonObject.put("isuse", appClient.getIsuse());
|
||||
|
||||
@@ -5,8 +5,10 @@ import cn.hellohao.auth.token.JWTUtil;
|
||||
import cn.hellohao.config.SysName;
|
||||
import cn.hellohao.pojo.*;
|
||||
import cn.hellohao.service.*;
|
||||
import cn.hellohao.utils.*;
|
||||
import cn.hutool.captcha.ShearCaptcha;
|
||||
import cn.hellohao.utils.Base64Encryption;
|
||||
import cn.hellohao.utils.NewSendEmail;
|
||||
import cn.hellohao.utils.Print;
|
||||
import cn.hellohao.utils.SetText;
|
||||
import cn.hutool.core.util.HexUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
@@ -35,7 +37,7 @@ public class UserController {
|
||||
@Autowired
|
||||
private EmailConfigService emailConfigService;
|
||||
@Autowired
|
||||
private ConfigService configService;
|
||||
private ConfdataService confdataService;
|
||||
@Autowired
|
||||
private UploadConfigService uploadConfigService;
|
||||
@Autowired
|
||||
@@ -109,14 +111,15 @@ public class UserController {
|
||||
user.setUsername(username);
|
||||
user.setPassword(password);
|
||||
user.setToken(UUID.randomUUID().toString().replace("-", ""));
|
||||
Config config = configService.getSourceype();
|
||||
final Confdata confdata = confdataService.selectConfdata("config");
|
||||
JSONObject jsonObject = JSONObject.parseObject(confdata.getJsondata());
|
||||
Integer type = 0;
|
||||
if(emailConfig.getUsing()==1){
|
||||
user.setIsok(0);
|
||||
//注册完发激活链接
|
||||
Thread thread = new Thread() {
|
||||
public void run() {
|
||||
Integer a = NewSendEmail.sendEmail(emailConfig,user.getUsername(), uid, user.getEmail(),config);
|
||||
Integer a = NewSendEmail.sendEmail(emailConfig,user.getUsername(), uid, user.getEmail(),jsonObject);
|
||||
}
|
||||
};
|
||||
thread.start();
|
||||
@@ -222,7 +225,6 @@ public class UserController {
|
||||
|
||||
@RequestMapping(value = "/activation", method = RequestMethod.GET)
|
||||
public String activation(Model model, HttpServletRequest request, HttpSession session, String activation, String username) {
|
||||
Config config = configService.getSourceype();
|
||||
Integer ret = 0;
|
||||
User u2 = new User();
|
||||
u2.setUid(activation);
|
||||
@@ -288,10 +290,11 @@ public class UserController {
|
||||
msg.setInfo("当前用户已被冻结,禁止操作");
|
||||
return msg;
|
||||
}
|
||||
Config config = configService.getSourceype();
|
||||
final Confdata confdata = confdataService.selectConfdata("config");
|
||||
JSONObject jsonObject = JSONObject.parseObject(confdata.getJsondata());
|
||||
Thread thread = new Thread() {
|
||||
public void run() {
|
||||
Integer a = NewSendEmail.sendEmailFindPass(emailConfig,user.getUsername(), user.getUid(), user.getEmail(),config);
|
||||
Integer a = NewSendEmail.sendEmailFindPass(emailConfig,user.getUsername(), user.getUid(), user.getEmail(),jsonObject);
|
||||
}
|
||||
};
|
||||
thread.start();
|
||||
|
||||
Reference in New Issue
Block a user