鼎鼎知识库
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

2021.1.25开放平台开发文档(后端).md 7.1KB

pirms 3 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. 鼎鼎所有售出模块的数据会统一指向到开放平台。所以,针对模块的所有操作围绕开放平台接口进行。本文档针对.NET Core后端开发人员。
  2. > 原理
  3. 所有模块目前被记录在总部数据库的`TestMac`表,该表记录着模块和项目的映射关系。当通过项目寻找模块,通过`HeaderQuarterRepository`找到项目下的模块。
  4. 如何找到模块下的开关呢?通过开放平台接口(`api/breaker/data`)就可以。
  5. > 开放平台:获取模块实时数据接口
  6. 请求
  7. ```
  8. POST http://47.103.61.198:5008/api/breaker/data
  9. Headers:
  10. Content-Type: application/json
  11. DD-Open-Key: d2ca79f1-4666-4ad5-953b-7ba5ee480fe0
  12. Body:
  13. {
  14. "mac":"187ED53338C4"
  15. }
  16. ```
  17. 响应:
  18. ```
  19. {
  20. "data": {
  21. "serverinfo": {
  22. "port": "12345",
  23. "hardware": "T25",
  24. "execleakcheck": "false",
  25. "protocol_ver": "19",
  26. "mac": "187ED53338C4",
  27. "loginid": "187ED53338C4",
  28. "gate": "",
  29. "ip": "192.168.8.134",
  30. "version": "1.3.08",
  31. "loginpwd": "7a57a5a743894ae4",
  32. "ssidpwd": "2803f88db851c67a",
  33. "ssid": "DDINGW",
  34. "timezoneId": "Asia/Shanghai",
  35. "ServerProtocol": "2",
  36. "server": "47.103.61.198:5008/ebx-bishop/data/carry",
  37. "datetime": "2021-01-25 14:24:56",
  38. "leakcheckdate": "3,13,33",
  39. "lastleakcheckdate": "2017-01-01 10:00:00"
  40. },
  41. "distributbox": {
  42. "breakers": {
  43. "1": {
  44. "version": "1.03",
  45. "title": "总路",
  46. "model": "JZK2L100-BL6523",
  47. "alarm": 0,
  48. "enableNetCtrl": true,
  49. "mxdw": 0,
  50. "mxgg": 14080,
  51. "mxgl": 96,
  52. "mxgw": 90,
  53. "mxgy": 260,
  54. "mxld": 30,
  55. "mxqy": 0,
  56. "openClose": true,
  57. "addr": 1,
  58. "power": 0,
  59. "specification": "64",
  60. "control": 1,
  61. "visibility": 1,
  62. "totalChannelId": -1,
  63. "lineType": "220",
  64. "a_A": 0,
  65. "a_T": 32.1,
  66. "a_V": 226,
  67. "a_WP": 0,
  68. "a_LD": 0.5,
  69. "a_PF": 0,
  70. "g_A": 0,
  71. "g_T": 0,
  72. "g_V": 0,
  73. "g_WP": 0,
  74. "g_LD": 0,
  75. "g_PF": 0,
  76. "b_A": 0,
  77. "b_T": 0,
  78. "b_V": 0,
  79. "b_WP": 0,
  80. "b_PF": 0,
  81. "c_A": 0,
  82. "c_T": 0,
  83. "c_V": 0,
  84. "c_WP": 0,
  85. "c_PF": 0,
  86. "n_A": 0,
  87. "n_T": 0
  88. },
  89. "2": {
  90. "version": "1.03",
  91. "title": "线路1",
  92. "model": "JZK2L100-BL6523",
  93. "alarm": 0,
  94. "enableNetCtrl": true,
  95. "mxdw": 0,
  96. "mxgg": 100,
  97. "mxgl": 30,
  98. "mxgw": 90,
  99. "mxgy": 260,
  100. "mxld": 30,
  101. "mxqy": 175,
  102. "openClose": true,
  103. "addr": 2,
  104. "power": 0,
  105. "specification": "20",
  106. "control": 1,
  107. "visibility": 1,
  108. "totalChannelId": 1,
  109. "lineType": "220",
  110. "a_A": 0,
  111. "a_T": 35,
  112. "a_V": 226,
  113. "a_WP": 0,
  114. "a_LD": 0,
  115. "a_PF": 0,
  116. "g_A": 0,
  117. "g_T": 0,
  118. "g_V": 0,
  119. "g_WP": 0,
  120. "g_LD": 0,
  121. "g_PF": 0,
  122. "b_A": 0,
  123. "b_T": 0,
  124. "b_V": 0,
  125. "b_WP": 0,
  126. "b_PF": 0,
  127. "c_A": 0,
  128. "c_T": 0,
  129. "c_V": 0,
  130. "c_WP": 0,
  131. "c_PF": 0,
  132. "n_A": 0,
  133. "n_T": 0
  134. },
  135. "3": {
  136. "version": "1.03",
  137. "title": "线路2",
  138. "model": "JZK2L100-BL6523",
  139. "alarm": 0,
  140. "enableNetCtrl": true,
  141. "mxdw": 0,
  142. "mxgg": 4400,
  143. "mxgl": 30,
  144. "mxgw": 90,
  145. "mxgy": 260,
  146. "mxld": 30,
  147. "mxqy": 175,
  148. "openClose": true,
  149. "addr": 3,
  150. "power": 0,
  151. "specification": "20",
  152. "control": 1,
  153. "visibility": 1,
  154. "totalChannelId": 1,
  155. "lineType": "220",
  156. "a_A": 0,
  157. "a_T": 35,
  158. "a_V": 226,
  159. "a_WP": 0,
  160. "a_LD": 0,
  161. "a_PF": 0,
  162. "g_A": 0,
  163. "g_T": 0,
  164. "g_V": 0,
  165. "g_WP": 0,
  166. "g_LD": 0,
  167. "g_PF": 0,
  168. "b_A": 0,
  169. "b_T": 0,
  170. "b_V": 0,
  171. "b_WP": 0,
  172. "b_PF": 0,
  173. "c_A": 0,
  174. "c_T": 0,
  175. "c_V": 0,
  176. "c_WP": 0,
  177. "c_PF": 0,
  178. "n_A": 0,
  179. "n_T": 0
  180. }
  181. },
  182. "change": null
  183. }
  184. },
  185. "isError": false,
  186. "message": "success",
  187. "code": 200
  188. }
  189. ```
  190. 在Application层,按如下方式调用:
  191. ```
  192. using Flurl.Http;
  193. using DD.Libs.Devices.ManDun;
  194. string url = "http://47.103.61.198:5008/api/breaker/data";
  195. var dto = new SomeClass{ mac="187ED53338C4"};
  196. var response = await url
  197. .WithHeader("Content-Type", "application/json")
  198. .WithHeader("DD-Open-Key", "d2ca79f1-4666-4ad5-953b-7ba5ee480fe0")
  199. .PostJsonAsync(dto)
  200. .ReceiveJson<RealtimeData>();
  201. ```
  202. > 开放平台:合闸或分断
  203. 请求
  204. ```
  205. POST http://47.103.61.198:5008/api/breaker/oc
  206. Headers:
  207. Content-Type: application/json
  208. DD-Open-Key: d2ca79f1-4666-4ad5-953b-7ba5ee480fe0
  209. Body:
  210. {
  211. "cmd":"OCSWITCH",
  212. "value1":"open",
  213. "value2":"1,2,3",
  214. "mac":"187ED53338C4",
  215. "extra":""
  216. }
  217. ```
  218. 在Application层,按如下方式调用:
  219. ```
  220. using Flurl.Http;
  221. string url = "http://47.103.61.198:5008/api/breaker/oc";
  222. var dto = new SomeClass{ cmd="",value1="",value2="",mac="",extra=""};
  223. var response = await url
  224. .WithHeader("Content-Type", "application/json")
  225. .WithHeader("DD-Open-Key", "d2ca79f1-4666-4ad5-953b-7ba5ee480fe0")
  226. .PostJsonAsync(dto);
  227. ```