hikvision.go 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. package model
  2. import (
  3. "gorm.io/gorm"
  4. "time"
  5. )
  6. type Hikvision struct {
  7. gorm.Model
  8. }
  9. type Monitor struct {
  10. Id int `json:"Id"`
  11. Name string `json:"Name"`
  12. Location string `json:"Location"` //位置
  13. State int `json:"State"` //状态
  14. }
  15. type MonitorNms struct {
  16. Id int `json:"Id"`
  17. Name string `json:"Name"`
  18. InspectResult int `json:"InspectResult"` //状态(0-视频异常,1-视频正常,2-登录失败,3-取流异常,4-解码失败,5-码流延时,6-诊断失败)
  19. }
  20. type RealTimeInspection struct {
  21. Id int `json:"Id"`
  22. Name string `json:"Name"` //名称
  23. Location string `json:"Location"` //位置
  24. Event string `json:"Event"` //事件-列3
  25. Date string `json:"Date"`
  26. }
  27. type Device struct {
  28. Id int `json:"Id"`
  29. Car string `json:"Car"` //车牌号
  30. Name string `json:"Name"` //名称
  31. State int `json:"State"` //状态
  32. Date string `json:"Date"` //事件-列3
  33. }
  34. type Visitor struct {
  35. Id int `json:"Id"`
  36. Name string `json:"Name"` //名称
  37. State int `json:"State"` //状态
  38. Phone string `json:"Phone"` //电话
  39. Location string `json:"Location"` //位置
  40. Date string `json:"Date"` //时间
  41. }
  42. type AlarmList struct {
  43. Id int `json:"Id"`
  44. Name string `json:"Name"` //名称
  45. AlarmContent string `json:"AlarmContent"` //告警内容
  46. Location string `json:"Location"` //位置
  47. State int `json:"State"` //状态
  48. Date string `json:"Date"` //时间
  49. }
  50. type Door struct {
  51. Name string `json:"name"`
  52. RegionIndexCodes []string `json:"regionIndexCodes"`
  53. IsSubRegion bool `json:"isSubRegion"`
  54. PageNo int `json:"pageNo"`
  55. PageSize int `json:"pageSize"`
  56. AuthCodes []string `json:"authCodes"`
  57. Expressions []struct {
  58. Key string `json:"key"`
  59. Operator int `json:"operator"`
  60. Values []string `json:"values"`
  61. } `json:"expressions"`
  62. OrderBy string `json:"orderBy"`
  63. OrderType string `json:"orderType"`
  64. }
  65. type DoorResp struct {
  66. Code string `json:"code"`
  67. Msg string `json:"msg"`
  68. Data struct {
  69. Total int `json:"total"`
  70. PageNo int `json:"pageNo"`
  71. PageSize int `json:"pageSize"`
  72. List []DoorList `json:"list"`
  73. } `json:"data"`
  74. }
  75. type DoorList struct {
  76. IndexCode string `json:"indexCode"` //资源唯一编码
  77. ResourceType string `json:"resourceType"` //资源类型
  78. Name string `json:"name"` //资源名称
  79. DoorNo string `json:"doorNo"` //门禁点编号
  80. ChannelNo string `json:"channelNo"` //通道号
  81. ParentIndexCode string `json:"parentIndexCode"` //父资源索引
  82. ControlOneId string `json:"controlOneId"` //一级控制器id
  83. ControlTwoId string `json:"controlTwoId"` //二级控制器id
  84. ReaderInId string `json:"readerInId"` //读卡器1
  85. ReaderOutId string `json:"readerOutId"` //读卡器2
  86. DoorSerial int `json:"doorSerial"` //门序号
  87. TreatyType string `json:"treatyType"` //接入协议
  88. RegionIndexCode string `json:"regionIndexCode"` //所属区域
  89. RegionPath string `json:"regionPath"` //所属区域目录,以@符号分割,包含本节点
  90. CreateTime string `json:"createTime"` //创建时间
  91. UpdateTime string `json:"updateTime"` //更新时间
  92. Description string `json:"description"` //描述
  93. ChannelType string `json:"channelType"` //通道类型
  94. RegionName string `json:"regionName"` //区域名称
  95. RegionPathName string `json:"regionPathName"` //区域目录名称
  96. InstallLocation string `json:"installLocation"` //安装位置
  97. }
  98. type Response struct {
  99. RequestId string `protobuf:"bytes,1,opt,name=requestId,proto3" json:"requestId,omitempty"`
  100. Code int32 `protobuf:"varint,2,opt,name=code,proto3" json:"code,omitempty"`
  101. Msg string `protobuf:"bytes,3,opt,name=msg,proto3" json:"msg,omitempty"`
  102. Data any `json:"data"`
  103. }
  104. type DoControl struct {
  105. Code string `json:"code"`
  106. Msg string `json:"msg"`
  107. Data []DoControlData `json:"data"`
  108. }
  109. type DoControlData struct {
  110. DoorIndexCode string `json:"doorIndexCode"`
  111. ControlResultCode int `json:"controlResultCode"`
  112. ControlResultDesc string `json:"controlResultDesc"`
  113. }
  114. type Doorstates struct {
  115. Code string `json:"code"`
  116. Msg string `json:"msg"`
  117. Data struct {
  118. AuthDoorList []struct {
  119. DoorIndexCode string `json:"doorIndexCode"` //门禁点indexCode
  120. DoorState int `json:"doorState"` //门状态,0 初始状态,1 开门状态,2关门状态,3离线状态
  121. } `json:"authDoorList"`
  122. NoAuthDoorIndexCodeList []string `json:"noAuthDoorIndexCodeList"` //没有权限的门禁点集合
  123. } `json:"data"`
  124. }
  125. // DeviceResource 设备资源
  126. type DeviceResource struct {
  127. Code string `json:"code"`
  128. Msg string `json:"msg"`
  129. Data struct {
  130. Total int `json:"total"`
  131. PageNo int `json:"pageNo"`
  132. PageSize int `json:"pageSize"`
  133. List []struct {
  134. IndexCode string `json:"indexCode"`
  135. Name string `json:"name"`
  136. ResourceType string `json:"resourceType"`
  137. DoorNo string `json:"doorNo"`
  138. Description string `json:"description"`
  139. ParentIndexCodes string `json:"parentIndexCodes"`
  140. RegionIndexCode string `json:"regionIndexCode"`
  141. RegionPath string `json:"regionPath"`
  142. ChannelType string `json:"channelType"`
  143. ChannelNo string `json:"channelNo"`
  144. InstallLocation string `json:"installLocation"`
  145. CapabilitySet string `json:"capabilitySet"`
  146. ControlOneId string `json:"controlOneId"`
  147. ControlTwoId string `json:"controlTwoId"`
  148. ReaderInId string `json:"readerInId"`
  149. ReaderOutId string `json:"readerOutId"`
  150. ComId string `json:"comId"`
  151. CreateTime string `json:"createTime"`
  152. UpdateTime string `json:"updateTime"`
  153. } `json:"list"`
  154. } `json:"data"`
  155. }
  156. type EventLogs struct {
  157. Code string `json:"code"`
  158. Msg string `json:"msg"`
  159. Data struct {
  160. Total int `json:"total"`
  161. PageNo int `json:"pageNo"`
  162. PageSize int `json:"pageSize"`
  163. List []struct {
  164. EventId string `json:"eventId"`
  165. StartTime string `json:"startTime"`
  166. EndTime string `json:"endTime"`
  167. EventType int `json:"eventType"`
  168. SrcIndex string `json:"srcIndex"`
  169. SrcName string `json:"srcName"`
  170. SrcType string `json:"srcType"`
  171. RegionId string `json:"regionId"`
  172. Status int `json:"status"`
  173. } `json:"list"`
  174. } `json:"data"`
  175. }
  176. // RegionsRoot 区域根节点
  177. type RegionsRoot struct {
  178. Code string `json:"code"`
  179. Msg string `json:"msg"`
  180. Data struct {
  181. IndexCode string `json:"indexCode"`
  182. Name string `json:"name"`
  183. ParentIndexCode string `json:"parentIndexCode"`
  184. TreeCode string `json:"treeCode"`
  185. } `json:"data"`
  186. }
  187. // RegionsSubRegions 根据区域编号获取下一级区域列表
  188. type RegionsSubRegions struct {
  189. Code string `json:"code"`
  190. Msg string `json:"msg"`
  191. Data struct {
  192. Total int `json:"total"`
  193. PageNo int `json:"pageNo"`
  194. PageSize int `json:"pageSize"`
  195. List []struct {
  196. IndexCode string `json:"indexCode"`
  197. Name string `json:"name"`
  198. ParentIndexCode string `json:"parentIndexCode"`
  199. Available bool `json:"available"`
  200. Leaf bool `json:"leaf"`
  201. CascadeCode string `json:"cascadeCode"`
  202. CascadeType int `json:"cascadeType"`
  203. CatalogType int `json:"catalogType"`
  204. ExternalIndexCode string `json:"externalIndexCode"`
  205. Sort int `json:"sort"`
  206. RegionPath string `json:"regionPath"`
  207. CreateTime time.Time `json:"createTime"`
  208. UpdateTime time.Time `json:"updateTime"`
  209. } `json:"list"`
  210. } `json:"data"`
  211. }
  212. var ResourceType = map[string]string{
  213. "region": "区域",
  214. "acsDevice": "门禁控制器",
  215. "door": "门禁点",
  216. "reader": "门禁读卡器",
  217. "encodeDevice": "编码设备",
  218. "camera": "监控点",
  219. "ioIn": "报警输入",
  220. "ioOut": "报警输出",
  221. "iasDevice": "入侵报警-报警主机",
  222. "subSys": "入侵报警-子系统",
  223. "defence": "入侵报警-防区通道",
  224. "radarDevice": "入侵报警-雷达设备",
  225. "visDevice": "可视对讲设备",
  226. "visDeviceInDoor": "可视对讲-室内机",
  227. "visDeviceOutDoor": "可视对讲-门口机",
  228. "visDeviceWallDoor": "可视对讲-围墙机",
  229. "visDeviceManager": "可视对讲-管理机",
  230. "ecsDevice": "梯控-控制器",
  231. "ladderCardReader": "梯控-读卡器",
  232. "floor": "梯控-楼层",
  233. "peDevice": "动环设备",
  234. "pemsIoOut": "动环-开关量",
  235. "transducer": "动环-传感器",
  236. "sensor": "动环-环境量",
  237. "snapCamera": "停车场-抓拍机",
  238. "led": "停车场-显示屏",
  239. "inoutControl": "停车场-出入口控制机",
  240. "barrierGate": "停车场-道闸",
  241. "bluetoothReader": "停车场-蓝牙读卡器",
  242. "rfiReader": "停车场-远距离读卡器",
  243. "guideManager": "停车场-诱导管理器",
  244. "guideLed": "停车场-诱导/引导屏幕",
  245. "geoManage": "停车场-地磁管理器",
  246. "monitoringPointDevice": "园区-卡口设备",
  247. "monitoringPoint": "园区-卡口点",
  248. "gardenLed": "园区-显示屏",
  249. "emerdevice": "紧急报警设备",
  250. "talk": "对讲通道",
  251. "electricLock": "电锁",
  252. "alarmLamp": "警灯",
  253. "siren": "警号",
  254. }
  255. func (m *Hikvision) TableName() string {
  256. return "hikvision"
  257. }