device.proto 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  1. syntax = "proto3";
  2. // package声明符,用来防止不同的消息类型有命名冲突
  3. package pb_v1;
  4. // 用于生成指定语言go的包名称
  5. option go_package = "property-household/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. bool has_task = 1;
  388. }
  389. // 添加进出场记录
  390. message GateRecordAddRequest {
  391. int64 device_id = 1;
  392. string sn = 2;
  393. string location = 3;
  394. int32 direction = 4;
  395. string household_user = 5;
  396. string household_id_number = 6;
  397. string household_housename = 7;
  398. string card_number = 8;
  399. string card_owner = 9;
  400. int32 online = 10;
  401. int64 garden_id = 11;
  402. // 1 访客 2 非访客
  403. int32 is_visitor = 12;
  404. // 开门时间
  405. int64 open_time = 13;
  406. int64 household_uid = 14;
  407. string visitor_name = 15;
  408. string visitor_phone = 16;
  409. int32 protocol = 17;
  410. // 1 二维码 2 刷卡 3 人脸
  411. int32 open_type = 18;
  412. }
  413. message GateRecordAddReply {
  414. }
  415. // 门禁进出场记录列表
  416. message GateRecordListRequest {
  417. int64 page = 1;
  418. int64 page_size = 2;
  419. string device_id = 3;
  420. int64 start = 4;
  421. int64 end = 5;
  422. int32 is_visitor = 6;
  423. }
  424. message GateRecordItem {
  425. string device_id = 1;
  426. int64 white_id = 2;
  427. string location = 3;
  428. int32 direction = 4;
  429. string household_user = 5;
  430. string household_id_number = 6;
  431. string household_housename = 7;
  432. string card_number = 8;
  433. string card_owner = 9;
  434. int32 online = 10;
  435. int64 garden_id = 11;
  436. // 1 访客 2 非访客
  437. int32 is_visitor = 12;
  438. // 开门时间
  439. int64 open_time = 13;
  440. int64 household_uid = 14;
  441. string visitor_name = 15;
  442. string visitor_phone = 16;
  443. // 1 二维码 2 刷卡 3 人脸
  444. int32 open_type = 17;
  445. string sn = 18;
  446. int32 protocol = 19;
  447. }
  448. message GateRecordListReply {
  449. int64 page = 1;
  450. int64 total = 2;
  451. repeated GateRecordItem list = 3;
  452. }
  453. message GateVisitorAddRequest {
  454. int64 uid = 1;
  455. string name = 2;
  456. string phone = 3;
  457. string visitor = 4;
  458. string visitor_phone = 5;
  459. int64 device_id = 6;
  460. int64 start = 7;
  461. int64 end = 8;
  462. int64 garden_id = 9;
  463. string comment = 10;
  464. }
  465. message GateVisitorAddReply {
  466. int64 id = 1;
  467. string qcode = 2;
  468. }
  469. message GateVisitorListRequest {
  470. int64 uid = 1;
  471. int64 device_id = 2;
  472. string name = 3;
  473. string visitor = 4;
  474. int64 start = 5;
  475. int64 end = 6;
  476. int64 page = 7;
  477. int64 page_size = 8;
  478. int64 id = 9;
  479. }
  480. message GateVisitorListItem {
  481. int64 uid = 1;
  482. string name = 2;
  483. string phone = 3;
  484. string visitor = 4;
  485. string visitor_phone = 5;
  486. int64 device_id = 6;
  487. int64 start = 7;
  488. int64 end = 8;
  489. // 1 未通行 2 已同行 3 已过期
  490. int64 status = 9;
  491. int64 open_time = 10;
  492. string gate_name = 11;
  493. int64 id = 12;
  494. string comment = 13;
  495. string qcode = 14;
  496. string location = 15;
  497. string garden_name = 16;
  498. }
  499. message GateVisitorListReply {
  500. int64 page = 1;
  501. int64 total = 2;
  502. repeated GateVisitorListItem list = 3;
  503. }
  504. message GateVisitorCheckRequest {
  505. int64 id = 1;
  506. int64 open_time = 2;
  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. }