b397102b by chentao

no message

1 parent 06266bf1
package com.lego.web.controller.core;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.lego.common.annotation.RepeatSubmit;
import com.lego.common.core.controller.BaseController;
import com.lego.common.core.domain.R;
import com.lego.common.core.page.TableDataInfo;
import com.lego.common.utils.EncryptUtils;
import com.lego.common.utils.MessageUtils;
import com.lego.core.domin.bo.UpgradeBo;
import com.lego.core.domin.bo.UpgradeQueryBo;
import com.lego.core.domin.vo.ResourceVo;
......@@ -40,8 +43,16 @@ public class UpgradeController extends BaseController {
}
@GetMapping("/list")
public R<ResourceVo> list() {
return R.ok(service.list());
public R<String> list() {
try {
ResourceVo resourceVo = service.list();
ObjectMapper objectMapper = new ObjectMapper();
String json = objectMapper.writeValueAsString(resourceVo);
return R.ok(MessageUtils.message("system.success"),EncryptUtils.encryptByAes(json));
}
catch(Exception e){
return R.fail();
}
}
/**
......
......@@ -58,29 +58,19 @@ public class SaTokenConfig implements WebMvcConfigurer {
.check(() -> {
// 检查是否登录 是否有token
SaRequest request = SaHolder.getRequest();
String version = request.getHeader("version");
System.out.println("versioncode:"+version);
if(StringUtils.isNotBlank(version)) {
String token = request.getHeader("token");
System.out.println("token:"+token);
SaTokenDao plusSaTokenDao = saTokenDao();
String secret = CacheUtils.get(CacheNames.VERSION_CODE,version);
System.out.println("secret:"+secret);
String appSecret = EncryptUtils.decryptByAes(secret);
System.out.println("appSecret"+appSecret);
String explicitToken = EncryptUtils.decryptByAes(token,appSecret);
System.out.println("explicitToken"+explicitToken);
List<String> list = Arrays.asList(explicitToken.split("&"));
if(!CollectionUtils.isEmpty(list)){
long time = System.currentTimeMillis();
long period = time-Long.valueOf(list.get(0));
System.out.println("period:"+period);
if(period<60000 && period>0){
String token = request.getHeader("token");
System.out.println("token:"+token);
if(StringUtils.isNotBlank(token)) {
String timestamp = EncryptUtils.decryptByAes(token);
System.out.println("timestamp:"+timestamp);
long time = System.currentTimeMillis();
long period = time-Long.valueOf(timestamp);
System.out.println("period:"+period);
if(period<=60000 && period>=0){
}
else{
throw NotLoginException.newInstance("", "-2", "token 无效", token).setCode(403);
}
}
else{
throw NotLoginException.newInstance("", "-2", "token 无效", token).setCode(403);
}
}
else{
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!