fix(消息通知): 修复站内通知弹框的问题
--bug=1016011 --user=刘瑞斌 【消息通知】执行接口case时有时收到多条系统站内通知,有时不会弹出站内通知 https://www.tapd.cn/55049933/s/1233494
This commit is contained in:
parent
9d9e26aa56
commit
e2a78debcf
|
@ -17,7 +17,7 @@ import java.util.Timer;
|
|||
import java.util.TimerTask;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@ServerEndpoint("/notification/count/{userId}")
|
||||
@ServerEndpoint("/notification/count/{userId}/{random}")
|
||||
@Component
|
||||
public class NotificationWebSocket {
|
||||
private static NotificationService notificationService;
|
||||
|
@ -32,7 +32,7 @@ public class NotificationWebSocket {
|
|||
* 开启连接的操作
|
||||
*/
|
||||
@OnOpen
|
||||
public void onOpen(@PathParam("userId") String userId, Session session) {
|
||||
public void onOpen(@PathParam("userId") String userId, @PathParam("random") double random, Session session) {
|
||||
Timer timer = new Timer(true);
|
||||
NotificationCenter task = new NotificationCenter(session, userId);
|
||||
timer.schedule(task, 0, 10 * 1000);
|
||||
|
|
|
@ -99,7 +99,7 @@ export default {
|
|||
if (window.location.protocol === 'https:') {
|
||||
protocol = "wss://";
|
||||
}
|
||||
const uri = protocol + window.location.host + "/notification/count/" + getCurrentUserId();
|
||||
const uri = protocol + window.location.host + "/notification/count/" + getCurrentUserId() + "/" + Math.random();
|
||||
this.websocket = new WebSocket(uri);
|
||||
this.websocket.onmessage = this.onMessage;
|
||||
this.websocket.onopen = this.onOpen;
|
||||
|
@ -163,8 +163,6 @@ export default {
|
|||
type: 'info',
|
||||
message: message,
|
||||
});
|
||||
// 弹出之后标记成已读
|
||||
this.$get('/notification/read/' + d.id);
|
||||
this.noticeShow = true;
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue