@ray-js/lamp-schedule-core 1.0.5-beta.3 → 1.0.5-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,7 @@ import "core-js/modules/esnext.iterator.for-each.js";
11
11
 
12
12
  import { EDeviceType } from '../types';
13
13
  import { LOG_PREFIX } from '../constant';
14
- import { scheduleLogger as ScheduleLogger } from './ScheduleLogger';
14
+ import { scheduleLogger, scheduleLogger as ScheduleLogger } from './ScheduleLogger';
15
15
  import { devIdOrGroupIdCache, getScheduleCache, setScheduleCache } from '../utils/ScheduleCache';
16
16
  import { initDpState, setDpState } from './dpState';
17
17
  import { getDpCodeByDpId } from './ScheduleUtils';
@@ -104,6 +104,8 @@ export class Support {
104
104
  deviceList = []
105
105
  } = groupRes || {};
106
106
  const firstDevice = deviceList === null || deviceList === void 0 ? void 0 : deviceList[0];
107
+ const firstDevDps = (firstDevice === null || firstDevice === void 0 ? void 0 : firstDevice.dps) || {};
108
+ const hasDps = Object.keys(firstDevDps).length > 0;
107
109
  getDeviceInfo({
108
110
  deviceId: firstDevice === null || firstDevice === void 0 ? void 0 : firstDevice.devId,
109
111
  success: deviceInfoRes => {
@@ -112,17 +114,26 @@ export class Support {
112
114
  delete deviceInfoRes.dps;
113
115
  // 从 deviceInfoRes 中筛选出 groupRes 中不存在的数据,合并到 res
114
116
  const filteredDeviceInfo = {};
115
- const _deviceInfo = _objectSpread(_objectSpread({}, groupRes), deviceInfoRes);
117
+ const _deviceInfo = _objectSpread(_objectSpread({}, deviceInfoRes), groupRes);
116
118
  Object.keys(_deviceInfo).forEach(key => {
117
- if (!(key in groupRes)) {
119
+ if (!(key in groupRes) && key !== 'dps') {
118
120
  filteredDeviceInfo[key] = deviceInfoRes[key];
119
121
  }
120
122
  });
121
123
  const res = _objectSpread(_objectSpread({}, groupRes), filteredDeviceInfo);
124
+ // 兼容 安卓下群组下dps字段异常,7.0.x 版本有问题,7.3.0版本修复了
125
+ if (Object.keys(groupRes).length <= 1 && hasDps) {
126
+ res.dps = firstDevDps;
127
+ }
122
128
  setScheduleCache(DEV_INFO_KEY, res);
123
129
  // 群组中为空
124
130
  groupId && (devIdOrGroupIdCache === null || devIdOrGroupIdCache === void 0 ? void 0 : devIdOrGroupIdCache.set('', groupId));
125
131
  const dpMap = {};
132
+ scheduleLogger.debug(firstDevDps, hasDps, 'group and devInfo merge: firstDevDps ==== ');
133
+ scheduleLogger.debug(res, 'group and devInfo merge: resresres ==== ');
134
+ scheduleLogger.debug(groupRes, 'resresres groupRes ==== ');
135
+ scheduleLogger.debug(deviceInfoRes, 'resresres deviceInfoRes ==== ');
136
+ scheduleLogger.debug(filteredDeviceInfo, 'resresres filteredDeviceInfo ==== ');
126
137
  Object.keys(res.dps).forEach(dpId => {
127
138
  const dpCode = getDpCodeByDpId(dpId);
128
139
  dpCode && setDpState(dpCode, res.dps[dpId]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/lamp-schedule-core",
3
- "version": "1.0.5-beta.3",
3
+ "version": "1.0.5-beta.4",
4
4
  "description": "照明计划模块核心能力",
5
5
  "main": "./lib/index.js",
6
6
  "files": [