Browse Source

monthes -> months, 添加获取配置参数mock

master
wally 4 years ago
parent
commit
23be718d91
  1. 25
      .idea/workspace.xml
  2. 27
      data/config-function.js
  3. 17
      data/config-network.js
  4. 15
      route.js

25
.idea/workspace.xml

@ -1,7 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="f6554b0f-8e9f-4d17-af66-170afe4c12e9" name="默认变更列表" comment="" /> <list default="true" id="f6554b0f-8e9f-4d17-af66-170afe4c12e9" name="默认变更列表" comment="">
<change afterPath="$PROJECT_DIR$/data/config-function.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/data/config-network.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/route.js" beforeDir="false" afterPath="$PROJECT_DIR$/route.js" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@ -14,7 +19,13 @@
</list> </list>
</option> </option>
</component> </component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectId" id="1zqPGJ109BzDN5oqtEXo6tn6xHP" /> <component name="ProjectId" id="1zqPGJ109BzDN5oqtEXo6tn6xHP" />
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectViewState"> <component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
@ -46,12 +57,24 @@
<workItem from="1634872549457" duration="1798000" /> <workItem from="1634872549457" duration="1798000" />
<workItem from="1635121020817" duration="1948000" /> <workItem from="1635121020817" duration="1948000" />
<workItem from="1635211315342" duration="2957000" /> <workItem from="1635211315342" duration="2957000" />
<workItem from="1635390008514" duration="1142000" />
</task> </task>
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" /> <option name="version" value="3" />
</component> </component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="XSLT-Support.FileAssociations.UIState"> <component name="XSLT-Support.FileAssociations.UIState">
<expand /> <expand />
<select /> <select />

27
data/config-function.js

@ -0,0 +1,27 @@
module.exports = {
code: 200,
msg: 'ok',
data: {
frequency: { // 采样频率
so2: 10, // SO2采样频率
metal: 20, // 金属腐蚀采样频率
th: 30, // 温湿度 采样频率
salt: 40, // 盐雾 采样频率
},
count: 1000, // 采集个数
time: new Date(), // 设置时间
batteryLow: 11, // 电池电压低阈值
batteryHigh: 31, // 电池电压高阈值
sunHigh: 2, // 太阳能电压高阈值
humidityHigh: 32, // 湿度高阈值
temperatureLow: 11, // 温度低阈值
temperatureHigh: 45, // 温度高阈值
securityMode: 0, // 安全模式 0->不加密 1->加密
corrosiveType: 1, // 金属腐蚀类型
report: {
type: 1, // 上报周期类型 0->时间点 1->周期
timePoints: [0, 0, 0, 0, 0, 0], // 设置时间点
cycle: 10, // 上报周期分钟数
},
}
}

17
data/config-network.js

@ -0,0 +1,17 @@
module.exports = {
code: 200,
msg: 'ok',
data: {
ip1: '192.168.1.101',
port1: '8007',
ip2: '292.168.1.101',
port2: '4001',
ip3: '192.168.1.102',
port3: '9001',
ipBackup: '192.168.1.103', // 备用ip
portBackup: '1001', // 备用端口号
account: 'wally-yy', // 账号
password: '111111', // 密码
apn: 'dsfasfa', // apn
}
}

15
route.js

@ -6,6 +6,8 @@ const integralElectric = require('./data/integralElectric');
const totalCorrosion = require('./data/totalCorrosion'); const totalCorrosion = require('./data/totalCorrosion');
const dataHistory = require('./data/dataHistory'); const dataHistory = require('./data/dataHistory');
const moistTime = require('./data/moistTime'); const moistTime = require('./data/moistTime');
const configNetwork = require('./data/config-network');
const configFunction = require('./data/config-function');
// 根据userId获取用户 // 根据userId获取用户
get('/gateway/tall3/v3.0/users/userId').to.json(user); get('/gateway/tall3/v3.0/users/userId').to.json(user);
@ -20,13 +22,20 @@ get('/gateway/corrosion/devices/all/:id').to.json(device);
get('/gateway/corrosion/devices/all').to.json(devicesAll); get('/gateway/corrosion/devices/all').to.json(devicesAll);
// 积分电量 // 积分电量
get('/gateway/corrosion/monthes/integralElectric').to.json(integralElectric); get('/gateway/corrosion/months/integralElectric').to.json(integralElectric);
// 月累计腐蚀 // 月累计腐蚀
get('/gateway/corrosion/monthes/totalCorrosion').to.json(totalCorrosion); get('/gateway/corrosion/months/totalCorrosion').to.json(totalCorrosion);
// 月累计湿润时间图 // 月累计湿润时间图
get('/gateway/corrosion/monthes/moistTime').to.json(moistTime); get('/gateway/corrosion/months/moistTime').to.json(moistTime);
// 历史数据查询 // 历史数据查询
get('/gateway/corrosion/histories').to.json(dataHistory); get('/gateway/corrosion/histories').to.json(dataHistory);
// 获取网络配置参数
get('/gateway/corrosion/config/network').to.json(configNetwork);
// 获取功能配置参数
get('/gateway/corrosion/config/function').to.json(configFunction);

Loading…
Cancel
Save