Kaynağa Gözat

轮询刷新盘面

li.shaoyi 3 yıl önce
ebeveyn
işleme
b5b338475d

+ 3 - 1
src/services/bus/login.ts

@@ -1,5 +1,6 @@
-import { TradeMode } from '@/common/constants/enumCommon';
 import APP from '@/services';
+import timerUtil from '@/utils/timer/timerUtil'
+import { TradeMode } from '@/common/constants/enumCommon';
 import { isAllEnum } from '@/services/bus/allEnum';
 import { checkTokenLoop } from '@/services/bus/token';
 import { getAllEnums, GetPCMenus, getServerTime, queryErrorInfos, QueryTableDefine } from '@/services/go/commonService/index';
@@ -17,6 +18,7 @@ import { getMarketByTradeMode } from './market';
 import Router from '@/router';
 
 export const logout = (): void => {
+    timerUtil.clearAll();
     logoutResponse();
     removeLoginData();
     APP.closeServer();

+ 5 - 3
src/services/go/ermcp/goodsInfo/index.ts

@@ -1,6 +1,7 @@
 /** ================================= 信息 - 现货商品信息 ================================**/
 
 import APP from '@/services';
+import timerUtil from '@/utils/timer/timerUtil'
 import { getUserId } from "@/services/bus/user";
 import { getUserAccountType } from "@/services/bus/user";
 import { commonSearch_go } from '@/services/go/index';
@@ -254,11 +255,12 @@ export function GetErmcpGoods(lastUpdateTime?: string): Promise<string> {
     }
 
     return commonSearch_go('/Ermcp/GetErmcpGoods', param).then(async res => {
-
         if (res.length) {
-            const result = res.map((item: Goods) => item.goodscode.toUpperCase())
+            const result = res.reduce((acc: string, obj: Goods) => acc + obj.goodscode + ',', '')
             // 登录的时候或者刷新的时候,需要获取一次盘面信息
-            await QueryQuoteDay(result.join(','))
+            await QueryQuoteDay(result)
+            // 每5分钟获取一次盘面
+            timerUtil.setInterval(() => QueryQuoteDay(result), 5 * 60 * 1000, 'quoteDay');
         }
         // console.log('查询企业风管期货商品信息', res);
         APP.set('Goods', res)