mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2025-12-26 07:26:44 +08:00
parent
e23d99d85b
commit
1a461f7d3d
@ -48,6 +48,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -106,7 +107,7 @@ public class AuthController {
|
|||||||
Long userId = LoginHelper.getUserId();
|
Long userId = LoginHelper.getUserId();
|
||||||
scheduledExecutorService.schedule(() -> {
|
scheduledExecutorService.schedule(() -> {
|
||||||
SseMessageDto dto = new SseMessageDto();
|
SseMessageDto dto = new SseMessageDto();
|
||||||
dto.setMessage("欢迎登录RuoYi-Vue-Plus后台管理系统");
|
dto.setMessage(DateUtils.getTodayHour(new Date()) + "好,欢迎登录 RuoYi-Vue-Plus 后台管理系统");
|
||||||
dto.setUserIds(List.of(userId));
|
dto.setUserIds(List.of(userId));
|
||||||
SseMessageUtils.publishMessage(dto);
|
SseMessageUtils.publishMessage(dto);
|
||||||
}, 5, TimeUnit.SECONDS);
|
}, 5, TimeUnit.SECONDS);
|
||||||
@ -147,8 +148,8 @@ public class AuthController {
|
|||||||
StpUtil.checkLogin();
|
StpUtil.checkLogin();
|
||||||
// 获取第三方登录信息
|
// 获取第三方登录信息
|
||||||
AuthResponse<AuthUser> response = SocialUtils.loginAuth(
|
AuthResponse<AuthUser> response = SocialUtils.loginAuth(
|
||||||
loginBody.getSource(), loginBody.getSocialCode(),
|
loginBody.getSource(), loginBody.getSocialCode(),
|
||||||
loginBody.getSocialState(), socialProperties);
|
loginBody.getSocialState(), socialProperties);
|
||||||
AuthUser authUserData = response.getData();
|
AuthUser authUserData = response.getData();
|
||||||
// 判断授权响应是否成功
|
// 判断授权响应是否成功
|
||||||
if (!response.ok()) {
|
if (!response.ok()) {
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package org.dromara.common.core.utils;
|
package org.dromara.common.core.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||||
import org.dromara.common.core.enums.FormatsType;
|
import org.dromara.common.core.enums.FormatsType;
|
||||||
import org.dromara.common.core.exception.ServiceException;
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
@ -297,4 +298,25 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据指定日期时间获取时间段(凌晨 / 上午 / 中午 / 下午 / 晚上)
|
||||||
|
*
|
||||||
|
* @param date 日期时间
|
||||||
|
* @return 时间段描述
|
||||||
|
*/
|
||||||
|
public static String getTodayHour(Date date) {
|
||||||
|
int hour = DateUtil.hour(date, true);
|
||||||
|
if (hour <= 6) {
|
||||||
|
return "凌晨";
|
||||||
|
} else if (hour < 12) {
|
||||||
|
return "上午";
|
||||||
|
} else if (hour == 12) {
|
||||||
|
return "中午";
|
||||||
|
} else if (hour <= 18) {
|
||||||
|
return "下午";
|
||||||
|
} else {
|
||||||
|
return "晚上";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user