优化中

This commit is contained in:
suguo.yao 2023-11-27 13:40:05 +08:00
parent 6ebfeda319
commit e520b5c26c
3 changed files with 10 additions and 32 deletions

View File

@ -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请求 公共方法

View File

@ -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
}

View File

@ -6,28 +6,24 @@
### import
<code>$ go get -v -u myschools.me/suguo/hikvision/iot</code>
<code>$ go get -v -u myschools.me/suguo/hikvision</code>
### 快速开始
---
**版本**
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
##### 基础服务能力
- 卡片操作
- 门禁计划