huangbin 4 năm trước cách đây
mục cha
commit
fc09b3ce19

+ 1 - 4
src/services/bus/index.ts

@@ -9,7 +9,6 @@ import { getAppConfig, getCommonApiUrl } from '@/services/go/config';
 import { LoginQuery } from '@/services/go/useInfo/index';
 import { serviceURL, setServiceURL } from '@/services/request/serviceURL';
 import ProtobufCtr from '@/services/socket/protobuf/index';
-import { localStorageUtil } from '@/utils/storage';
 import { message } from 'ant-design-vue';
 import { queryMarketRun } from '../go/commonMarket';
 import { GetErmcpGoods, QueryDeliveryGoodsDetail } from '../go/ermcp/goodsInfo';
@@ -55,9 +54,7 @@ export async function globalDataRefresh(): Promise<string> {
         }
 
         // 获取错误信息
-        if (!localStorageUtil.getItem('errorCodeInfos')) {
-            await queryErrorInfos();
-        }
+        await queryErrorInfos();
         // 获取枚举
         if (!isAllEnum()) {
             await getAllEnums();

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

@@ -6,7 +6,6 @@ import { checkTokenLoop } from '@/services/bus/token';
 import { getAllEnums, GetPCMenus, getServerTime, queryErrorInfos, QueryTableDefine } from '@/services/go/commonService/index';
 import { GetErmcpGoods, QueryDeliveryGoodsDetail } from '@/services/go/ermcp/goodsInfo';
 import { GetLoginID, LoginQuery } from '@/services/go/useInfo/index';
-import { localStorageUtil } from '@/utils/storage';
 import { sessionStorageUtil } from '@/utils/storage/index';
 import Long from 'long';
 import { queryMarketRun } from '../go/commonMarket';
@@ -44,9 +43,7 @@ export const login = async (logidCode: string, password: string, byteArr: Uint8A
         // 获取服务时间
         // await getServerTime();
         // 获取错误信息
-        if (!localStorageUtil.getItem('errorCodeInfos')) {
-            await queryErrorInfos();
-        }
+        await queryErrorInfos();
         // 获取枚举
         if (!isAllEnum()) {
             await getAllEnums();

+ 10 - 2
src/services/go/commonService/index.ts

@@ -45,10 +45,18 @@ export function getAllEnums(autoid?: number): Promise<string> {
  * @param rowNumber 如果传入rowNumber,则返回此rowNumber后的数据
  */
 export function queryErrorInfos(rowNumber?: string): Promise<string> {
-    const param = rowNumber ? { rowNumber } : {};
+    const rowNum = localStorageUtil.getItem('rowNumber')
+    const param = rowNum ? { rowNumber: rowNum } : {};
     return commonSearch_go('/Common/QueryErrorInfos', param)
         .then((res) => {
-            localStorageUtil.setItem('errorCodeInfos', res);
+            if (res && res.length) {
+                const rowNumber = res[res.length - 1].rownumber
+                if (rowNumber) {
+                    localStorageUtil.setItem('rowNumber', rowNumber);
+                }
+                const list = localStorageUtil.getItem('errorCodeInfos') || []
+                localStorageUtil.setItem('errorCodeInfos', [...list, ...res]);
+            }
             return 'ok';
         })
         .catch((err: Error) => {

+ 1 - 0
src/utils/storage/localStorage.ts

@@ -9,6 +9,7 @@ interface StorageKeyName {
     allEnums: string; // 所有枚举信息
     errorCodeInfos: ErrorCodeList[];
     theme: string; // 主题色
+    rowNumber: string; // 数据库错误信息 时间戳
 }
 
 /**