diff --git a/iot/hikvision-iot.go b/iot/hikvision-iot.go
index a03d1ed..81252f3 100644
--- a/iot/hikvision-iot.go
+++ b/iot/hikvision-iot.go
@@ -27,17 +27,8 @@ func init() {
baseURL = "https://api2.hik-cloud.com"
}
clientID = os.Getenv("IOT_CLIENTID")
- if clientID == "" {
- clientID = "164edfd71b744dd88c945dbd5ae30a9a"
- }
clientSecret = os.Getenv("IOT_CLIENTSECRET")
- if clientSecret == "" {
- clientSecret = "2f580d932d7d46029a2091ece681035c"
- }
scope = os.Getenv("IOT_SCOPE")
- if scope == "" {
- scope = "yy"
- }
}
// 基础云眸http请求 公共方法
diff --git a/iot/mq-iot.go b/iot/mq-iot.go
index c2557fe..fb8e280 100644
--- a/iot/mq-iot.go
+++ b/iot/mq-iot.go
@@ -7,15 +7,6 @@ import (
"myschools.me/suguo/hikvision/iot/model"
)
-// message queue 消息通道
-
-const (
- mq_base = "/api/v1/mq/consumer"
- mq_create = mq_base + "/group1"
- mq_message = mq_base + "/messages"
- mq_offset = mq_base + "/offsets"
-)
-
var _consumerid string
// 创建消费者
@@ -23,7 +14,7 @@ func mqCreateConsumer() (*string, error) {
if _consumerid != "" {
return &_consumerid, nil
}
- resp, err := hikvisionRequest("POST", mq_create, nil)
+ resp, err := hikvisionRequest("POST", `/api/v1/mq/consumer/group1`, nil)
if err != nil {
return nil, err
}
@@ -64,7 +55,7 @@ func MQConsumerMessagePull(autoCommit bool) (*model.MQMessage, error) {
consumerId: *cid,
}
- resp, err := hikvisionIOTRequestUrlencoded("POST", mq_message, req, true)
+ resp, err := hikvisionIOTRequestUrlencoded("POST", `/api/v1/mq/consumer/messages`, req, true)
if err != nil {
return nil, err
}
@@ -89,7 +80,7 @@ func MQConsumerMessageOffset() (*model.MQBase, error) {
consumerId: *cid,
}
- resp, err := hikvisionIOTRequestUrlencoded("POST", mq_offset, req, true)
+ resp, err := hikvisionIOTRequestUrlencoded("POST", `/api/v1/mq/consumer/offsets`, req, true)
if err != nil {
return nil, err
}
diff --git a/iot/readme.md b/iot/readme.md
index c03f3a5..19a9622 100644
--- a/iot/readme.md
+++ b/iot/readme.md
@@ -6,28 +6,24 @@
### import
-$ go get -v -u myschools.me/suguo/hikvision/iot
+$ go get -v -u myschools.me/suguo/hikvision
### 快速开始
---
-**版本**
-Golang 1.20
-
##### 配置环境变量
```
-environment:
- clientID = os.Getenv("HIK_IOT_CLIENTID")
- clientSecret = os.Getenv("HIK_IOT_CLIENTSECRET")
- scope = os.Getenv("HIK_IOT_SCOPE")
+IOT_URL 海康IOT地址,默认https://api2.hik-cloud.com
+IOT_CLIENTID CLIENTID
+IOT_CLIENTSECRET CLIENTSECRET
+IOT_SCOPE SCOPE
```
-
##### 基础服务能力
-- 分组管理
+- 分组管理 group
- 接入管理
- 校时配置
-- 人员管理
+- 人员管理 person
##### 基础服务能力
- 卡片操作
- 门禁计划