device.proto 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  1. syntax = "proto3";
  2. // package声明符,用来防止不同的消息类型有命名冲突
  3. package pb_v1;
  4. // 用于生成指定语言go的包名称
  5. option go_package = "property-mqtt/pb/v1";
  6. // 门禁入库
  7. message GateInRequest {
  8. // 设备名
  9. string device_name = 1;
  10. // 序列号
  11. string sn = 2;
  12. // 厂商
  13. string manufactor = 3;
  14. // 授权key
  15. string auth_key = 4;
  16. // 协议
  17. int32 protocol = 5;
  18. bool qcode_support = 6;
  19. bool pic_support = 7;
  20. bool card_support = 8;
  21. }
  22. message GateInReply {
  23. }
  24. message GateBatchInItem {
  25. // 设备名
  26. string device_name = 1;
  27. // 序列号
  28. string sn = 2;
  29. // 厂商
  30. string manufactor = 3;
  31. // 授权key
  32. string auth_key = 4;
  33. // 协议
  34. int32 protocol = 5;
  35. bool qcode_support = 6;
  36. bool pic_support = 7;
  37. bool card_support = 8;
  38. }
  39. message GateBatchInRequest {
  40. repeated GateBatchInItem list = 1;
  41. }
  42. message GateBatchInReply {
  43. }
  44. // 门禁出库
  45. message GateOutRequest {
  46. int64 device_id = 1;
  47. int64 garden_id = 2;
  48. string out_user = 3;
  49. }
  50. message GateOutReply {
  51. }
  52. // 门禁列表
  53. message GateItem {
  54. // 设备id
  55. int64 device_id = 1;
  56. // 设备名
  57. string device_name = 2;
  58. // 序列号
  59. string sn = 3;
  60. // 厂商
  61. string manufactor = 4;
  62. // 授权key
  63. string auth_key = 5;
  64. // 1支持二维码 2 不支持
  65. int32 qcode_support = 6;
  66. // 协议
  67. int32 protocol = 7;
  68. // 小区id
  69. int64 garden_id = 8;
  70. // 小区名
  71. string garden_name = 9;
  72. // 出库人
  73. string out_user = 10;
  74. // 出库时间
  75. int64 out_time = 11;
  76. // 1 在线 2 离线
  77. int32 status = 12;
  78. // true 已启用 false 已禁用
  79. bool enable = 13;
  80. // 1 进场 2 出场 3 进出场
  81. int32 direction = 14;
  82. string location = 15;
  83. string protocol_desc = 16;
  84. // 1 支持人脸 2 不支持
  85. int32 pic_support = 17;
  86. // 1 支持卡 2 不支持
  87. int32 card_support = 18;
  88. string user_name = 19;
  89. string password = 20;
  90. string ip = 21;
  91. string mac = 22;
  92. int64 port = 23;
  93. }
  94. message GateListRequest {
  95. int64 garden_id = 1;
  96. int64 page = 2;
  97. int64 page_size = 3;
  98. // 1 已出库 2 未出库
  99. int32 out = 4;
  100. int32 device_id = 5;
  101. string sn = 6;
  102. string device_name = 7;
  103. string manufactor = 8;
  104. repeated int64 unit_ids = 9;
  105. int32 qcode_support = 10;
  106. int32 pic_support = 11;
  107. int32 card_support = 12;
  108. }
  109. message GateListReply {
  110. int64 page = 1;
  111. int64 total = 2;
  112. repeated GateItem list = 3;
  113. }
  114. // 门禁信息
  115. message GateInfoRequest {
  116. int64 device_id = 1;
  117. string sn = 2;
  118. int32 protocol = 3;
  119. }
  120. message GateInfoReply {
  121. GateItem info = 1;
  122. }
  123. // 删除门禁
  124. message GateDelRequest {
  125. int64 device_id = 1;
  126. }
  127. message GateDelReply {
  128. }
  129. // 回收门禁
  130. message GateRecoveryRequest {
  131. int64 device_id = 1;
  132. }
  133. message GateRecoveryReply {
  134. }
  135. // 门禁启用停用
  136. message GateEnableRequest {
  137. int64 device_id = 1;
  138. int64 garden_id = 2;
  139. bool enable = 3;
  140. }
  141. message GateEnableReply {
  142. }
  143. // 小区端编辑位置或方向
  144. message GateSetRequest {
  145. int64 device_id = 1;
  146. int64 garden_id = 2;
  147. // 1 进场 2 出场 3 进出场
  148. int32 direction = 3;
  149. // 位置
  150. string location = 4;
  151. string gate_name = 5;
  152. string user_name = 6;
  153. string password = 7;
  154. string ip = 8;
  155. string mac = 9;
  156. int64 port = 10;
  157. }
  158. message GateSetReply {
  159. }
  160. // 门禁添加远程命令
  161. message GateCommandAddRequest {
  162. // 1 远程开门;
  163. // 2 重启设备;
  164. // 4 获取设备参数;
  165. // 5 设置设备参数; 6 下载白名单;
  166. // 7 清空本地所有白名单;
  167. // 8 清空本地所有刷卡记录;
  168. // 9 扫码显示参数;
  169. // 10 查询卡号是否存在白名单
  170. // 99 恢复出厂;
  171. int32 cmd_code = 1;
  172. string cmd_params = 2;
  173. int64 device_id = 3;
  174. }
  175. message GateCommandAddReply {
  176. }
  177. // 门禁命令列表
  178. message GateCommandListRequest {
  179. int64 device_id = 1;
  180. int32 status = 2;
  181. int64 start = 3;
  182. int64 end = 4;
  183. int64 page = 5;
  184. int64 page_size = 6;
  185. }
  186. message GateCommandItem {
  187. int64 device_id = 1;
  188. string desc = 2;
  189. // 1 待执行 2 执行中 3 执行完成
  190. int32 status = 3;
  191. int64 created_at = 4;
  192. // 1 成功 2 失败
  193. int32 result_status = 5;
  194. // 结果描述
  195. string result_status_desc = 6;
  196. int64 id = 7;
  197. }
  198. message GateCommandListReply {
  199. int64 page = 1;
  200. int64 total = 2;
  201. repeated GateCommandItem list = 3;
  202. }
  203. // 删除命令
  204. message GateCommandDelRequest {
  205. int64 id = 1;
  206. }
  207. message GateCommandDelReply {
  208. }
  209. // 命令结果
  210. message GateCommandResultRequest {
  211. int64 id = 1;
  212. int32 cmd_code = 2;
  213. int32 result_status = 3;
  214. string result_desc = 4;
  215. string sn = 5;
  216. int32 protocol = 6;
  217. string content = 7;
  218. }
  219. message GateCommandResultReply {
  220. bool has_task = 1;
  221. }
  222. // 获取一条命令用于执行
  223. message GateCommandUseRequest {
  224. string sn = 1;
  225. int32 protocol = 2;
  226. }
  227. message GateCommandUseReply {
  228. int64 id = 1;
  229. int32 cmd_code = 2;
  230. string cmd_params = 3;
  231. }
  232. message GateUnitAddRequest {
  233. int64 device_id = 1;
  234. repeated int64 unit_id = 2;
  235. int64 garden_id = 3;
  236. }
  237. message GateUnitAddReply {
  238. }
  239. message GateUnitListRequest {
  240. int64 device_id = 1;
  241. int64 garden_id = 2;
  242. }
  243. message GateUnitListReply {
  244. repeated int64 unit_id = 3;
  245. }
  246. message GateUnitDeviceRequest {
  247. int64 garden_id = 1;
  248. repeated int64 unit_id = 2;
  249. }
  250. message GateUnitDeviceReply {
  251. repeated GateItem list = 1;
  252. }
  253. message GateUserPicAddRequest {
  254. int64 garden_id = 1;
  255. int64 unit_id = 2;
  256. int64 house_id = 3;
  257. string house_name = 4;
  258. int64 uid = 5;
  259. string id_number = 6;
  260. string name = 7;
  261. string pic_url = 8;
  262. string phone = 9;
  263. }
  264. message GateUserPicAddReply {
  265. }
  266. message GateUserPicInfoRequest {
  267. int64 garden_id = 1;
  268. int64 uid = 2;
  269. }
  270. message GateUserPicInfoReply {
  271. string pic_url = 1;
  272. // 1 待下发 2 已下发 3 下发失败
  273. int32 down_status = 2;
  274. // 1 待审核 2 审核通过 3 审核未通过
  275. int32 approve_status = 3;
  276. string feedback = 4;
  277. }
  278. message GateUserPicListRequest {
  279. int64 garden_id = 1;
  280. int32 down_status = 2;
  281. string name = 3;
  282. int64 page = 4;
  283. int64 page_size = 5;
  284. }
  285. message GateUserPicDevice {
  286. int64 device_id = 1;
  287. string device_name = 2;
  288. int32 down_status = 3;
  289. }
  290. message GateUserPicItem {
  291. int64 id = 1;
  292. int64 uid = 2;
  293. string name = 3;
  294. string id_number = 4;
  295. string house_name = 5;
  296. int64 created_at = 6;
  297. int64 approved_at = 7;
  298. int32 approve_status = 8;
  299. int32 down_status = 9;
  300. repeated GateUserPicDevice gate_permissions = 10;
  301. }
  302. message GateUserPicListReply {
  303. int64 page = 1;
  304. int64 total = 2;
  305. repeated GateUserPicItem list = 3;
  306. }
  307. message GateUserPicApproveRequest {
  308. int64 garden_id = 1;
  309. int64 id = 2;
  310. bool status = 3;
  311. string feedback = 4;
  312. }
  313. message GateUserPicApproveReply {
  314. }
  315. message GateUserPicSyncRequest {
  316. int64 id = 1;
  317. int64 garden_id = 2;
  318. }
  319. message GateUserPicSyncReply {
  320. }
  321. message GateCardAddRequest {
  322. string card_number = 1;
  323. int64 garden_id = 2;
  324. string name = 3;
  325. repeated int64 device_ids = 4;
  326. }
  327. message GateCardAddReply {
  328. }
  329. message GateCardListRequest {
  330. int64 garden_id = 1;
  331. int32 down_status = 2;
  332. string name = 3;
  333. int64 page = 4;
  334. int64 page_size = 5;
  335. }
  336. message GateCardDevice {
  337. int64 device_id = 1;
  338. string device_name = 2;
  339. int32 down_status = 3;
  340. }
  341. message GateCardItem {
  342. int64 id = 1;
  343. string name = 2;
  344. string card_number = 3;
  345. int64 created_at = 4;
  346. int32 down_status = 5;
  347. repeated GateCardDevice gate_permissions = 6;
  348. }
  349. message GateCardListReply {
  350. int64 page = 1;
  351. int64 total = 2;
  352. repeated GateCardItem list = 3;
  353. }
  354. message GateCardSyncRequest {
  355. int64 id = 1;
  356. int64 garden_id = 2;
  357. }
  358. message GateCardSyncReply {
  359. }
  360. // 白名单匹配
  361. message GateWhiteMatchRequest {
  362. string sn = 1;
  363. int32 protocol = 2;
  364. string code_val = 3;
  365. int32 code_type = 4;
  366. }
  367. message GateWhiteMatchReply {
  368. int32 status = 1;
  369. string uid = 2;
  370. string card_number = 3;
  371. string id_number = 4;
  372. string phone = 5;
  373. string device_name = 6;
  374. string location = 7;
  375. int32 direction = 8;
  376. string name = 9;
  377. string house_name = 10;
  378. int64 device_id = 11;
  379. int64 garden_id = 12;
  380. }
  381. // 门禁更新状态
  382. message GateOnlineRequest {
  383. string sn = 1;
  384. int32 protocol = 2;
  385. }
  386. message GateOnlineReply {
  387. }
  388. // 添加进出场记录
  389. message GateRecordAddRequest {
  390. int64 device_id = 1;
  391. string sn = 2;
  392. string location = 3;
  393. int32 direction = 4;
  394. string household_user = 5;
  395. string household_id_number = 6;
  396. string household_housename = 7;
  397. string card_number = 8;
  398. string card_owner = 9;
  399. int32 online = 10;
  400. int64 garden_id = 11;
  401. // 1 访客 2 非访客
  402. int32 is_visitor = 12;
  403. // 开门时间
  404. int64 open_time = 13;
  405. int64 household_uid = 14;
  406. string visitor_name = 15;
  407. string visitor_phone = 16;
  408. int32 protocol = 17;
  409. // 1 二维码 2 刷卡 3 人脸
  410. int32 open_type = 18;
  411. }
  412. message GateRecordAddReply {
  413. }
  414. // 门禁进出场记录列表
  415. message GateRecordListRequest {
  416. int64 page = 1;
  417. int64 page_size = 2;
  418. string device_id = 3;
  419. int64 start = 4;
  420. int64 end = 5;
  421. int32 is_visitor = 6;
  422. }
  423. message GateRecordItem {
  424. string device_id = 1;
  425. int64 white_id = 2;
  426. string location = 3;
  427. int32 direction = 4;
  428. string household_user = 5;
  429. string household_id_number = 6;
  430. string household_housename = 7;
  431. string card_number = 8;
  432. string card_owner = 9;
  433. int32 online = 10;
  434. int64 garden_id = 11;
  435. // 1 访客 2 非访客
  436. int32 is_visitor = 12;
  437. // 开门时间
  438. int64 open_time = 13;
  439. int64 household_uid = 14;
  440. string visitor_name = 15;
  441. string visitor_phone = 16;
  442. // 1 二维码 2 刷卡 3 人脸
  443. int32 open_type = 17;
  444. string sn = 18;
  445. int32 protocol = 19;
  446. }
  447. message GateRecordListReply {
  448. int64 page = 1;
  449. int64 total = 2;
  450. repeated GateRecordItem list = 3;
  451. }
  452. message GateVisitorAddRequest {
  453. int64 uid = 1;
  454. string name = 2;
  455. string phone = 3;
  456. string visitor = 4;
  457. string visitor_phone = 5;
  458. int64 device_id = 6;
  459. int64 start = 7;
  460. int64 end = 8;
  461. int64 garden_id = 9;
  462. string comment = 10;
  463. }
  464. message GateVisitorAddReply {
  465. int64 id = 1;
  466. string qcode = 2;
  467. }
  468. message GateVisitorListRequest {
  469. int64 uid = 1;
  470. int64 device_id = 2;
  471. string name = 3;
  472. string visitor = 4;
  473. int64 start = 5;
  474. int64 end = 6;
  475. int64 page = 7;
  476. int64 page_size = 8;
  477. int64 id = 9;
  478. }
  479. message GateVisitorListItem {
  480. int64 uid = 1;
  481. string name = 2;
  482. string phone = 3;
  483. string visitor = 4;
  484. string visitor_phone = 5;
  485. int64 device_id = 6;
  486. int64 start = 7;
  487. int64 end = 8;
  488. // 1 未通行 2 已同行 3 已过期
  489. int64 status = 9;
  490. int64 open_time = 10;
  491. string gate_name = 11;
  492. int64 id = 12;
  493. string comment = 13;
  494. string qcode = 14;
  495. string location = 15;
  496. string garden_name = 16;
  497. }
  498. message GateVisitorListReply {
  499. int64 page = 1;
  500. int64 total = 2;
  501. repeated GateVisitorListItem list = 3;
  502. }
  503. message GateVisitorCheckRequest {
  504. int64 id = 1;
  505. int64 open_time = 2;
  506. int64 device_id = 3;
  507. }
  508. message GateVisitorCheckReply {
  509. }
  510. message GateVisitorDelRequest {
  511. int64 id = 1;
  512. int64 uid = 2;
  513. bool manager = 3;
  514. }
  515. message GateVisitorDelReply {
  516. }
  517. message MqttFaceGateRequest {
  518. }
  519. message MqttFaceGateReply {
  520. repeated string sns = 1;
  521. }