浏览代码

mod:设置

panqiuyao 10 月之前
父节点
当前提交
4bdb24fe79
共有 1 个文件被更改,包括 11 次插入8 次删除
  1. 11 8
      electron/controller/setting.js

+ 11 - 8
electron/controller/setting.js

@@ -7,6 +7,10 @@ const path = require('path');
 const fs = require('fs');
 const { getDeviceConfigs, getDeviceConfigDetail, removeConfig, saveDeviceConfig } = require('../api/setting');
 
+const errData = {
+  msg :'请求失败,请联系管理员',
+  code:999
+}
 
 /**
  * 设置控制器
@@ -24,13 +28,12 @@ class SettingController extends Controller {
    */
   async getDeviceConfigList(args) {
     try {
-      console.log(2)
       const result = await getDeviceConfigs(args);
-      console.log(result)
-      return result;
+      if(result.data)  result.data
+      return errData;
     } catch (error) {
       Log.error('获取设备配置列表失败:', error);
-      return [];
+      return errData;
     }
   }
 
@@ -41,10 +44,10 @@ class SettingController extends Controller {
   async getDeviceConfigDetail(args) {
     try {
       const result = await getDeviceConfigDetail(args);
-      return result;
+      if(result.data)  result.data
+      return errData;
     } catch (error) {
-      Log.error('获取设备配置详情失败:', error);
-      return null;
+      return errData;
     }
   }
 
@@ -79,4 +82,4 @@ class SettingController extends Controller {
 }
 
 SettingController.toString = () => '[class SettingController]';
-module.exports = SettingController;
+module.exports = SettingController;