diff --git a/src/main/java/com/bonus/digitalSignage/system/service/impl/UserDetailsServiceImpl.java b/src/main/java/com/bonus/digitalSignage/system/service/impl/UserDetailsServiceImpl.java
index 30c33f9..01068b1 100644
--- a/src/main/java/com/bonus/digitalSignage/system/service/impl/UserDetailsServiceImpl.java
+++ b/src/main/java/com/bonus/digitalSignage/system/service/impl/UserDetailsServiceImpl.java
@@ -77,7 +77,6 @@ public class UserDetailsServiceImpl implements UserDetailsService {
throw new AuthenticationCredentialsNotFoundException("用户名/密码错误!");
}
-
long num=0L;
try{
num=redisUtil.countKeys();//在线用户
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 39453e0..399d5bd 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -1,11 +1,11 @@
server.port=11998
server.servlet.context-path=/gzDigitalSignage
-#spring.datasource.url=jdbc:mysql://192.168.0.16:4419/gz_digital_signage?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
-#spring.datasource.username=root
-#spring.datasource.password=Bonus@admin123!
-spring.datasource.url=jdbc:mysql://127.0.0.1:3306/gz_digital_signage?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
+spring.datasource.url=jdbc:mysql://192.168.0.16:4419/gz_digital_signage?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
spring.datasource.username=root
-spring.datasource.password=ccw1998@yyt1999
+spring.datasource.password=Bonus@admin123!
+#spring.datasource.url=jdbc:mysql://127.0.0.1:3306/gz_digital_signage?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
+#spring.datasource.username=root
+#spring.datasource.password=ccw1998@yyt1999
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.max-idle=10
spring.datasource.max-wait=60000
@@ -25,6 +25,8 @@ mybatis.type-aliases-package=com.bonus.digitalSignage.*.vo
spring.redis.host=127.0.0.1
spring.redis.port=6379
+spring.redis.database=6
+
# \u65E5\u5FD7
logging.config=classpath:logback-boot.xml
diff --git a/src/main/resources/static/js/jq.js b/src/main/resources/static/js/jq.js
index d6eb335..3df8aa2 100644
--- a/src/main/resources/static/js/jq.js
+++ b/src/main/resources/static/js/jq.js
@@ -1,7 +1,7 @@
$.ajaxSetup({
cache : false,
headers : {
- "token" : localStorage.getItem("token")
+ "token" : localStorage.getItem("gds-token")
},
error : function(xhr, textStatus, errorThrown) {
var msg = xhr.responseText;
@@ -11,7 +11,7 @@ $.ajaxSetup({
if (code == 400) {
layer.msg(message);
} else if (code == 401) {
- localStorage.removeItem("token");
+ localStorage.removeItem("gds-token")
location.href = '/login.html';
} else if (code == 403) {
console.log("未授权:" + message);
diff --git a/src/main/resources/static/js/login.js b/src/main/resources/static/js/login.js
index 897bbef..3cb7424 100644
--- a/src/main/resources/static/js/login.js
+++ b/src/main/resources/static/js/login.js
@@ -11,7 +11,33 @@ document.addEventListener('DOMContentLoaded', function() {
if (top != self) {
parent.location.href = '/digitalSignage/login.html';
}
-var token = localStorage.getItem("token");
+
+//自动登录
+window.onload = function() {
+ //获取浏览器路径
+ let hrefUrl = window.location.href;
+ const url = new URL(hrefUrl);
+ const urlParam = new URLSearchParams(url.search);
+ //解析路径参数
+ const params = urlParam.get('params');
+ if(params){
+ //对参数进行解密
+ const jiemi =bnsCloudDecrypt(params);
+ //解密参数继续解析
+ const logingParam = new URLSearchParams(jiemi);
+ //获取账号密码
+ const username = logingParam.get('username');
+ const password = logingParam.get('password');
+ if(username && password){
+ //自己系统登录的方法
+ authLogin(username,password);
+ }
+ }else{
+ console.log("无自动登录参数");
+ }
+};
+
+var token = localStorage.getItem("gds-token");
if (token != null && token.trim().length != 0) {
$.ajax({
type: 'get',
@@ -26,15 +52,13 @@ if (token != null && token.trim().length != 0) {
var code = response.code;
var message = response.message;
if (code == 401) {
- localStorage.removeItem("token");
+ localStorage.removeItem("gds-token");
}
}
});
}
-
function login(obj) {
$(obj).attr("disabled", true);
-
var username = $.trim($('#username').val());
var password = $.trim($('#password').val());
if (username == "" || password == "") {
@@ -50,7 +74,7 @@ function login(obj) {
_csrf: $('#csrfToken').val()
},
success: function (data) {
- localStorage.setItem("token", data.token);
+ localStorage.setItem("gds-token", data.token);
location.href = ctxPath + '/index.html';
},
error: function (xhr, textStatus, errorThrown) {
@@ -62,4 +86,27 @@ function login(obj) {
});
}
+}
+
+function authLogin(username,password) {
+ $.ajax({
+ type: 'post',
+ url: ctxPath + '/login',
+ data: {
+ username: encryptCBC(username),
+ password: encryptCBC(password),
+ _csrf: $('#csrfToken').val()
+ },
+ success: function (data) {
+ localStorage.setItem("gds-token", data.token);
+ location.href = ctxPath + '/index.html';
+ },
+ error: function (xhr, textStatus, errorThrown) {
+ var msg = xhr.responseText;
+ var response = JSON.parse(msg);
+ $("#info").html(response.message);
+ $(obj).attr("disabled", false);
+ }
+ });
+
}
\ No newline at end of file
diff --git a/src/main/resources/static/js/main.js b/src/main/resources/static/js/main.js
index 2e878f0..3859ef3 100644
--- a/src/main/resources/static/js/main.js
+++ b/src/main/resources/static/js/main.js
@@ -60,7 +60,7 @@ function initMenu(){
var status = response.status;
var code = response.code;
if (status == 401 || code == 401) {
- localStorage.removeItem("token");
+ localStorage.removeItem("gds-token");
}
}
});
@@ -70,7 +70,7 @@ function initsy() {
var $tabsTitle = $tabs.find('.layui-nav-item a');
$.each($tabsTitle,function(idx, ele){
var id=$(ele).attr("lay-id");
- $("#sy").attr("src","pages/home/home.html?token="+localStorage.getItem("token"));
+ $("#sy").attr("src","pages/home/home.html?token="+localStorage.getItem("gds-token"));
})
}
function setChild(parentElement, child){
@@ -148,7 +148,7 @@ function logout(){
_csrf: $('#csrfToken').val()
},
success : function(data) {
- localStorage.removeItem("token");
+ localStorage.removeItem("gds-token")
location.href= ctxPath + '/login.html';
}
});
@@ -183,7 +183,7 @@ var element ;
//新增一个Tab项
element.tabAdd('admin-tab', {
title: title,
- content: '',
+ content: '',
id: lay_id
});
element.tabChange("admin-tab", lay_id);
@@ -277,7 +277,7 @@ function parentOpen(url,lay_id,title){
}
element.tabAdd('admin-tab', {
title: title,
- content: '',
+ content: '',
id: lay_id
});
diff --git a/src/main/resources/static/js/my/aes.js b/src/main/resources/static/js/my/aes.js
index f538421..6eb38ef 100644
--- a/src/main/resources/static/js/my/aes.js
+++ b/src/main/resources/static/js/my/aes.js
@@ -68,4 +68,22 @@ function dateFtt(fmt, date) { //author: meizz
if(new RegExp("(" + k + ")").test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
-}
\ No newline at end of file
+}
+
+/**
+ * @param {Object} word解密
+ */
+function bnsCloudDecrypt(word){
+ var key = CryptoJS.enc.Utf8.parse("bonus@cloud@2025");
+ var decrypt = CryptoJS.AES.decrypt(word, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
+ return CryptoJS.enc.Utf8.stringify(decrypt).toString();
+}
+/**
+ * @param {Object} word加密
+ */
+function bnsCloudEncrypt(word){
+ var key = CryptoJS.enc.Utf8.parse("bonus@cloud@2025");
+ var srcs = CryptoJS.enc.Utf8.parse(word);
+ var encrypted = CryptoJS.AES.encrypt(srcs, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
+ return encrypted.toString();
+}
diff --git a/src/main/resources/static/js/publicJs.js b/src/main/resources/static/js/publicJs.js
index 57e12c6..3dcbbbf 100644
--- a/src/main/resources/static/js/publicJs.js
+++ b/src/main/resources/static/js/publicJs.js
@@ -6,12 +6,12 @@ var url=window.location.href;
let test_url="http://192.168.0.14:11998/gzDigitalSignage";
let dev_url="http://36.33.26.201:21100/gzDigitalSignage";
-let local_url="http://192.168.0.39:11998/gzDigitalSignage";
+let local_url="http://192.168.0.38:11998/gzDigitalSignage";
let dataUrl = "http://112.27.246.86:21997/gzDigitalSignage"
if(url.indexOf("36.33.26.201")!=-1){
dataUrl = dev_url;
-}else if(url.indexOf("127.0.0.1")!=-1 || url.indexOf("localhost")!=-1 || url.indexOf("192.168.0.39")!=-1){
+}else if(url.indexOf("127.0.0.1")!=-1 || url.indexOf("localhost")!=-1 || url.indexOf("192.168.0.38")!=-1){
dataUrl = local_url
}else if(url.indexOf("192.168.0.14")!=-1){
dataUrl = test_url
@@ -26,7 +26,7 @@ if(url.indexOf("36.33.26.201")!=-1){
// console.log(dataUrl)
let imgUrl = dataUrl + '/files';
-let tokens = localStorage.getItem("token");
+let tokens = localStorage.getItem("gds-token");
function error(xhr) {
var msg = xhr.responseText;
@@ -37,7 +37,7 @@ function error(xhr) {
if (code == 400) {
layer.msg(message);
} else if (code == 401 || status == 401) {
- localStorage.removeItem("token");
+ localStorage.removeItem("gds-token");
localStorage.removeItem("user");
localStorage.removeItem('pageType');
top.layer.alert(message, {
@@ -60,7 +60,7 @@ function error(xhr) {
$.ajaxSetup({
cache: false,
headers: {
- "Authorization": localStorage.getItem("token")
+ "Authorization": localStorage.getItem("gds-token")
},
async: false,
error: function (xhr, textStatus, errorThrown) {
diff --git a/src/main/resources/static/pages/role/roleListOld.html b/src/main/resources/static/pages/role/roleListOld.html
index 224133a..97ca45d 100644
--- a/src/main/resources/static/pages/role/roleListOld.html
+++ b/src/main/resources/static/pages/role/roleListOld.html
@@ -91,7 +91,7 @@
if (code == 400) {
layer.msg(message);
} else if (code == 401) {
- localStorage.removeItem("token");
+ localStorage.removeItem("gds-token");
layer.msg("token过期,请先登录", {shift: -1, time: 1000}, function(){
location.href = ctxPath + '/login.html';
});
diff --git a/src/main/resources/static/pages/user/userList.html b/src/main/resources/static/pages/user/userList.html
index 897ddc1..d744e10 100644
--- a/src/main/resources/static/pages/user/userList.html
+++ b/src/main/resources/static/pages/user/userList.html
@@ -107,7 +107,7 @@ function init(){
if (code == 400) {
layer.msg(message);
} else if (code == 401) {
- localStorage.removeItem("token");
+ localStorage.removeItem("gds-token")
layer.msg("token过期,请先登录", {shift: -1, time: 1000}, function(){
location.href = '/login.html';
});