[TOC=2]
## 檢查設備是否添加
~~~[api]
post:/installers/project_device/check_device_add
*integer:project_id=1#項目 id
*array:sn_list=[]#設備序列號數組
<<<
<<<
success
{
"code": 0,
"data": {
"list": {
"915001000053": {
"is_add": false
},
"915001000099": {
"is_add": false
},
"915001000003": {
"is_add": true
}
}
}
}
<<<
explain
915001000053 // sn_list 內填寫的設備序列號
is_add // 是否添加過
true => 已添加
false => 未添加
<<<
error
~~~
## 設備列表
~~~[api]
get:/installers/project_device/list
*integer:project_id=1#項目 id
*integer:current_page=0#當前頁
*integer:page_number=0#頁碼
<<<
<<<
success
{
"code": 0,
"data": {
"list": [
{
"id": 1,
"project_id": 2,
"device_id": 1,
"sn": "746051001790",
"name": "智能空調",
"type": 46,
"subtype": 0,
"province": "陜西省",
"city": "安康市",
"district": "漢陰縣",
"street": "",
"streetNumber": "",
"lng": "108.392163",
"lat": "32.714036",
"address": "123",
"location": "123",
"remarks": "123",
"create_time": "2021-05-07 10:28:59",
"group_name": "默認分組",
"group_id": 2
}
],
"current_page": 0,
"page_number": 0,
"total": 1
}
}
<<<
explain
id // 項目設備 id
project_id // 項目 id
device_id // 設備 id
sn // 設備序列號
name // 設備名稱
type // 設備類型
subtype // 設備子類型
province // 省
city // 市
district // 區
street // 街道
streetNumber // 門牌號
lng // 經度
lat // 緯度
address // 詳細地址
location // 安裝位置
remarks // 備注信息
create_time // 添加時間
group_name // 分組名稱
group_id // 分組 id
<<<
error
~~~
## 類型設備列表
~~~[api]
get:/installers/project_device/type_list
*integer:project_id=1#項目 id
*integer:current_page=0#當前頁
*integer:page_number=0#頁碼
*integer:type=0#設備類型
<<<
<<<
success
{
"code": 0,
"data": {
"list": [
{
"id": 1,
"project_id": 2,
"device_id": 1,
"sn": "746051001790",
"name": "智能空調",
"type": 46,
"subtype": 0,
"province": "陜西省",
"city": "安康市",
"district": "漢陰縣",
"street": "",
"streetNumber": "",
"lng": "108.392163",
"lat": "32.714036",
"address": "123",
"location": "123",
"remarks": "123",
"create_time": "2021-05-07 10:28:59",
"group_name": "默認分組",
"group_id": 2
}
],
"current_page": 0,
"page_number": 0,
"total": 1
}
}
<<<
explain
id // 項目設備 id
project_id // 項目 id
device_id // 設備 id
sn // 設備序列號
name // 設備名稱
type // 設備類型
subtype // 設備子類型
province // 省
city // 市
district // 區
street // 街道
streetNumber // 門牌號
lng // 經度
lat // 緯度
address // 詳細地址
location // 安裝位置
remarks // 備注信息
create_time // 添加時間
group_name // 分組名稱
group_id // 分組 id
<<<
error
~~~
## 設備搜索
~~~[api]
get:/installers/project_device/search
*integer:project_id=1#項目 id
*integer:current_page=0#當前頁
*integer:page_number=0#頁碼
*integer:type=0#設備類型
*string:search=''''#可搜序列號、設備名稱、備注信息、安裝位置
<<<
<<<
success
{
"code": 0,
"data": {
"list": [
{
"id": 1,
"project_id": 2,
"device_id": 1,
"sn": "746051001790",
"name": "智能空調",
"type": 46,
"subtype": 0,
"province": "陜西省",
"city": "安康市",
"district": "漢陰縣",
"street": "",
"streetNumber": "",
"lng": "108.392163",
"lat": "32.714036",
"address": "123",
"location": "123",
"remarks": "123",
"create_time": "2021-05-07 10:28:59",
"group_name": "默認分組",
"group_id": 2
}
],
"current_page": 0,
"page_number": 0,
"total": 1
}
}
<<<
explain
id // 項目設備 id
project_id // 項目 id
device_id // 設備 id
sn // 設備序列號
name // 設備名稱
type // 設備類型
subtype // 設備子類型
province // 省
city // 市
district // 區
street // 街道
streetNumber // 門牌號
lng // 經度
lat // 緯度
address // 詳細地址
location // 安裝位置
remarks // 備注信息
create_time // 添加時間
group_name // 分組名稱
group_id // 分組 id
<<<
error
~~~
## 設備類型
~~~[api]
get:/installers/project_device/get_device_type
*integer:project_id=1#項目 id
integer:is_device_num=0#是否返回對應設備數量
<<<
<<<
field_explain
is_device_num // 是否返回對應設備數量
0 => 不返回
1 => 返回
<<<
success
{
"code": 0,
"data": {
"list": [
{
"type": 29,
"name": "電暖溫控器",
"mark":""
},
{
"type": 27,
"name": "空調伴侶",
"mark":""
},
]
}
}
<<<
success
{
"code": 0,
"data": {
"list": [
{
"type": 29,
"name": "電暖溫控器",
"mark":"",
"total": 1
},
{
"type": 27,
"name": "空調伴侶",
"mark":"",
"total": 3
},
]
}
}
<<<
success_explain
type // 設備類型
name // 設備類型名稱
mark // 設備類型對應型號
total // 對應設備數量
<<<
error
~~~
## 項目設備統計
~~~[api]
post:/installers/project_device/device_total
*array:project_ids=[1]#項目 id 數組
<<<
<<<
success
{
"code": 0,
"data": {
"list": {
"4": {
"total": 1
},
"2": {
"total": 6
}
}
}
}
<<<
error
~~~
## 設備信息修改
~~~[api]
post:/installers/project_device/update
*integer:id=0#項目設備 id
*integer:project_id=0#項目 id
string:name=''''#設備名稱
string:location=''''#安裝位置
string:remarks=''''#備注信息
<<<
<<<
success
{
"code": 0
}
<<<
error
~~~
>[info] 可以只傳 name、location、remarks 的字段中其中任意一個字段。不修改可以不傳值
## 設備密碼修改
~~~[api]
post:/installers/project_device/update_pwd
*integer:id=0#項目設備 id
*integer:project_id=0#項目 id
*string:password=666666#設備原密碼
*string:password_new=777777#設備新密碼
<<<
<<<
success
{
"code": 0
}
<<<
error
{
"code": 502,
"msg": "設備密碼錯誤"
}
~~~
## 設備位置修改
~~~[api]
post:/installers/device_info/update
*integer:id=0#項目設備 id
*string:province=""#省
*string:city=""#市
*string:district=""#區
*string:street=""#街道
*string:streetNumber=""#門牌號
*string:lng=""#地理經度
*string:lat=""#地理緯度
*string:address=""#詳細地址
<<<
<<<
success
{
"code": 0
}
<<<
error
~~~
## 設備添加
~~~[api]
post:/installers/project_device/save
*integer:project_id=0#項目 id
*integer:group_id=0#項目分組 id
*string:sn=""#設備序列號
string:name=""#設備名稱
*string:password=""#設備密碼
integer:bind_type=0 #添加設備類型 1 新設備 , 0 已經聯網設備
string:location=""#設備安裝位置
string:remarks=""#設備備注信息
string:province=""#省
string:city=""#市
string:district=""#區
string:street=""#街道
string:streetNumber=""#門牌號
string:lng=""#地理經度
string:lat=""#地理緯度
string:address=""#詳細地址
<<<
<<<
success
{
"code": 0,
"data": {
"device_info": {
"id": 10,
"device_id": 9,
"type": 29,
"subtype": 0
}
}
}
<<<
error
{
"code": -1,
"msg": "設備密碼不能為空"
}
~~~
>[danger] 必填字段有 project_id、group_id、sn、password、name
> group_id 值可以為 0 表示添加到默認分組
> bind_type 默認為 0 表示添加已經聯網的設備, 1 表示添加新配網的設備
## 設備刪除
~~~[api]
post:/installers/project_device/delete
*integer:project_id=默認值#說明文字
*array:id_list=[]#設備列表內返回的 id 字段值
<<<
<<<
success
<<<
error
~~~