|
|
@@ -14,18 +14,18 @@ export default new (class {
|
|
|
|
|
|
constructor() {
|
|
|
this.socket.onPush = (p) => {
|
|
|
- const { funCode } = p
|
|
|
+ const { funCode, content } = p
|
|
|
const delay = 500 // 延迟推送消息,防止短时间内重复请求
|
|
|
|
|
|
switch (funCode) {
|
|
|
case FunCode.LogoutRsp: {
|
|
|
- console.log('接收到用户登出通知', funCode)
|
|
|
+ //console.log('接收到用户登出通知', funCode)
|
|
|
// 用户登出通知
|
|
|
- eventBus.$emit('LogoutNotify', '网络错误')
|
|
|
+ eventBus.$emit('LogoutNotify', '账号已登出')
|
|
|
break;
|
|
|
}
|
|
|
case FunCode.MoneyChangedNotify: {
|
|
|
- console.log('接收到资金变动通知', funCode)
|
|
|
+ //console.log('接收到资金变动通知', funCode)
|
|
|
timerInterceptor.debounce(() => {
|
|
|
// 资金变动通知
|
|
|
eventBus.$emit('MoneyChangedNotify')
|
|
|
@@ -33,7 +33,7 @@ export default new (class {
|
|
|
break
|
|
|
}
|
|
|
case FunCode.OrderDealedNtf: {
|
|
|
- console.log('接收到成交通知', funCode)
|
|
|
+ //console.log('接收到成交通知', funCode)
|
|
|
timerInterceptor.debounce(() => {
|
|
|
// 成交通知
|
|
|
eventBus.$emit('OrderDealedNtf')
|
|
|
@@ -41,15 +41,19 @@ export default new (class {
|
|
|
break
|
|
|
}
|
|
|
case FunCode.MarketStatusChangeNtf: {
|
|
|
- console.log('接收到市场状态变更通知', funCode)
|
|
|
- timerInterceptor.debounce(() => {
|
|
|
- // 市场状态变更通知
|
|
|
- eventBus.$emit('MarketStatusChangeNtf')
|
|
|
- }, delay, funCode.toString())
|
|
|
+ //console.log('接收到市场状态变更通知', funCode)
|
|
|
+ if (content) {
|
|
|
+ const res = new TextDecoder().decode(content)
|
|
|
+ const { Status } = JSON.parse(res)
|
|
|
+ if ([1, 23].includes(Status)) {
|
|
|
+ // 用户登出通知
|
|
|
+ eventBus.$emit('LogoutNotify', '系统结算,请稍后重新登录')
|
|
|
+ }
|
|
|
+ }
|
|
|
break
|
|
|
}
|
|
|
case FunCode.ListingOrderChangeNtf: {
|
|
|
- console.log('接收到挂牌委托变更广播通知', funCode)
|
|
|
+ //console.log('接收到挂牌委托变更广播通知', funCode)
|
|
|
timerInterceptor.debounce(() => {
|
|
|
// 挂牌委托变更广播通知
|
|
|
eventBus.$emit('ListingOrderChangeNtf');
|
|
|
@@ -57,7 +61,7 @@ export default new (class {
|
|
|
break;
|
|
|
}
|
|
|
case FunCode.PosChangedNtf: {
|
|
|
- console.log('接收到头寸变化通知', funCode)
|
|
|
+ //console.log('接收到头寸变化通知', funCode)
|
|
|
timerInterceptor.debounce(() => {
|
|
|
// 头寸变化通知
|
|
|
eventBus.$emit('PosChangedNtf');
|