product.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '可用',
  6. 2 => '删除',
  7. );
  8. $type = array
  9. (
  10. 1 => '未激活',
  11. 2 => '已激活',
  12. 3 => '不可用',
  13. );
  14. $info = function()
  15. {
  16. return Dever::load('device/info-all');
  17. };
  18. $url = '&option_product_id={id}&search_option_product_id={id}&oper_parent=product&oper_key=device';
  19. return array
  20. (
  21. # 表名
  22. 'name' => 'product',
  23. # 显示给用户看的名称
  24. 'lang' => '出厂产品管理',
  25. # 后台菜单排序
  26. 'order' => 30,
  27. //'desc' => '网关地址:http://api.xinnongbaohe.com/?key=设备标识',
  28. # 数据结构
  29. 'struct' => array
  30. (
  31. 'id' => array
  32. (
  33. 'type' => 'int-11',
  34. 'name' => '设备ID',
  35. 'default' => '',
  36. 'desc' => '',
  37. 'match' => 'is_numeric',
  38. 'search' => 'order',
  39. 'order' => 'desc',
  40. //'list' => true,
  41. ),
  42. 'info_id' => array
  43. (
  44. 'type' => 'int-11',
  45. 'name' => '基础设备',
  46. 'default' => '1',
  47. 'desc' => '请选择基础设备',
  48. 'match' => 'is_numeric',
  49. 'option' => $info,
  50. // 'update' => 'select',
  51. 'search' => 'select',
  52. 'list_name' => '设备名称',
  53. # 显示在table里的,与下面的list=table相对应
  54. 'list_table'=> 'Dever::load("device/data.product_info#dname", {id})',
  55. ),
  56. 'name' => array
  57. (
  58. 'type' => 'varchar-40',
  59. 'name' => '产品名称',
  60. 'default' => '',
  61. 'desc' => '产品名称',
  62. 'match' => 'is_string',
  63. 'update' => 'text',
  64. 'search' => 'fulltext',
  65. // 'list' => true,
  66. ),
  67. 'key' => array
  68. (
  69. 'type' => 'varchar-60',
  70. 'name' => '设备标识',
  71. 'default' => '',
  72. 'desc' => '设备标识',
  73. 'match' => 'is_string',
  74. //'update' => 'text',
  75. 'search' => 'fulltext',
  76. 'list' => 'table',
  77. ),
  78. /*
  79. 'api' => array
  80. (
  81. 'type' => 'varchar-500',
  82. 'name' => '设备网关',
  83. 'default' => '',
  84. 'desc' => '设备网关',
  85. 'match' => 'is_string',
  86. //'update' => 'textarea',
  87. 'search' => 'fulltext',
  88. 'list' => true,
  89. ),
  90. */
  91. 'tcp' => array
  92. (
  93. 'type' => 'varchar-500',
  94. 'name' => '设备tcp服务器',
  95. 'default' => '',
  96. 'desc' => '设备tcp服务器',
  97. 'match' => 'is_string',
  98. //'update' => 'textarea',
  99. //'search' => 'fulltext',
  100. //'list' => true,
  101. ),
  102. 'tcp_id' => array
  103. (
  104. 'type' => 'varchar-500',
  105. 'name' => '客户端id',
  106. 'default' => '',
  107. 'desc' => '客户端id',
  108. 'match' => 'is_string',
  109. 'update' => 'textarea',
  110. //'search' => 'fulltext',
  111. 'list' => true,
  112. 'list_name' => '客户端',
  113. 'list_table' => '"{tcp_id}" > 0 ? "已连接" : "未连接"',
  114. ),
  115. 'live_url' => array
  116. (
  117. 'type' => 'varchar-500',
  118. 'name' => '直播地址',
  119. 'default' => '',
  120. 'desc' => '直播地址',
  121. 'match' => 'is_string',
  122. 'update' => 'textarea',
  123. //'list' => true,
  124. 'list_name' => '直播地址',
  125. ),
  126. 'code' => array
  127. (
  128. 'type' => 'varchar-500',
  129. 'name' => '二维码链接',
  130. 'default' => '',
  131. 'desc' => '二维码链接',
  132. 'match' => 'is_string',
  133. //'update' => 'textarea',
  134. //'search' => 'fulltext',
  135. //'list' => true,
  136. 'list_table'=> false,
  137. ),
  138. 'uid' => array
  139. (
  140. 'type' => 'int-11',
  141. 'name' => '激活人',
  142. 'default' => '0',
  143. 'desc' => '激活人',
  144. 'match' => 'is_numeric',
  145. 'list_name' => '传感器与控制器',
  146. 'list' => 'Dever::load("device/element.getAll", {id})',
  147. ),
  148. 'type' => array
  149. (
  150. 'type' => 'tinyint-1',
  151. 'name' => '是否激活',
  152. 'default' => '1',
  153. 'desc' => '请选择是否激活',
  154. 'match' => 'is_numeric',
  155. 'option' => $type,
  156. //'update' => 'select',
  157. 'search' => 'select',
  158. //'list' => true,
  159. ),
  160. 'state' => array
  161. (
  162. 'type' => 'tinyint-1',
  163. 'name' => '是否删除',
  164. 'default' => '1',
  165. 'desc' => '请选择是否删除',
  166. 'match' => 'is_numeric',
  167. 'option' => $option,
  168. 'update' => 'radio',
  169. 'list' => true,
  170. ),
  171. 'cdate' => array
  172. (
  173. 'type' => 'int-11',
  174. 'name' => '包装时间',
  175. 'match' => array('is_numeric', time()),
  176. 'desc' => '',
  177. # 只有insert时才生效
  178. 'insert' => true,
  179. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  180. ),
  181. ),
  182. 'manage' => array
  183. (
  184. # 不允许编辑
  185. //'edit' => false,
  186. 'insert' => false,
  187. # 可以删除
  188. 'list_button' => array
  189. (
  190. 11 => array('<br />'),
  191. 14 => array('当前数据', '"product_sensor'.$url.'"'),
  192. //15 => array('数据统计', '"stat&key=server'.$url.'"'),
  193. 12 => array('<br />'),
  194. 16 => array('传感器日志', '"sensor_log&key=api'.$url.'"'),
  195. 13 => array('<br />'),
  196. 17 => array('控制器日志', '"control_log&key=api'.$url.'"'),
  197. 15 => array('<br />'),
  198. 18 => array('信号器日志', '"signal_log&key=api'.$url.'"'),
  199. 19 => array('<br />'),
  200. 25 => array('查看二维码', 'modal|showMsg(\'查看二维码\',$(this),\''.Dever::url('data.product_code', 'device').'\',function(){updateMsg(\'sendmsg\')})|"id={id}"'),
  201. ),
  202. //'desc' => '注意:命令码',
  203. ),
  204. # request 请求接口定义
  205. 'request' => array
  206. (
  207. ),
  208. );