user_set.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '可用',
  6. 2 => '不可用',
  7. );
  8. $than = array
  9. (
  10. 1 => '大于',
  11. 2 => '小于',
  12. 3 => '大于等于',
  13. 4 => '小于等于',
  14. 5 => '等于',
  15. );
  16. $type = array
  17. (
  18. 1 => '传感器',
  19. //2 => '控制器',
  20. //3 => '信号器',
  21. );
  22. $oper = array
  23. (
  24. 1 => '单次操作',
  25. 2 => '周期操作',
  26. //3 => '信号器',
  27. );
  28. return array
  29. (
  30. 'config' => array
  31. (
  32. 'type' => $type,
  33. 'than' => $than,
  34. 'oper' => $oper,
  35. ),
  36. # 表名
  37. 'name' => 'user_set',
  38. # 显示给用户看的名称
  39. 'lang' => '用户智能设置',
  40. 'menu' => false,
  41. # 后台菜单排序
  42. 'order' => 10,
  43. # 数据结构
  44. 'struct' => array
  45. (
  46. 'id' => array
  47. (
  48. 'type' => 'int-11',
  49. 'name' => 'ID',
  50. 'default' => '',
  51. 'desc' => '',
  52. 'match' => 'is_numeric',
  53. 'search' => 'order',
  54. 'order' => 'desc',
  55. //'list' => true,
  56. ),
  57. 'uid' => array
  58. (
  59. 'type' => 'int-11',
  60. 'name' => '用户',
  61. 'default' => '',
  62. 'desc' => '请选择用户',
  63. 'match' => 'is_numeric',
  64. 'update' => 'text',
  65. 'search' => 'fulltext',
  66. 'in' => true,
  67. 'list' => 'Dever::load("passport/user-one#username", {uid})',
  68. 'autocomplete' => array('passport/manage.user?json=1', 'uid', 'passport/user-info#username'),
  69. ),
  70. 'product_id' => array
  71. (
  72. 'type' => 'int-11',
  73. 'name' => '产品',
  74. 'default' => '',
  75. 'desc' => '请选择产品',
  76. 'match' => 'is_numeric',
  77. 'update' => 'text',
  78. 'search' => 'fulltext',
  79. 'in' => true,
  80. 'list' => 'Dever::load("device/data.product_info#name", {product_id})',
  81. 'autocomplete' => array('device/manage.product?json=1', 'product_id', 'device/data.product_info#name'),
  82. ),
  83. 'device_id' => array
  84. (
  85. 'type' => 'int-11',
  86. 'name' => '基础设备',
  87. 'default' => '',
  88. 'desc' => '请输入基础设备',
  89. 'match' => 'is_numeric',
  90. 'update' => 'text',
  91. ),
  92. 'type' => array
  93. (
  94. 'type' => 'tinyint-1',
  95. 'name' => '元件类型',
  96. 'default' => '1',
  97. 'desc' => '请选择元件类型',
  98. 'match' => 'is_numeric',
  99. 'option' => $type,
  100. 'update' => 'radio',
  101. 'search' => 'select',
  102. 'list' => true,
  103. ),
  104. 'element_id' => array
  105. (
  106. 'type' => 'int-11',
  107. 'name' => '元件',
  108. 'default' => '',
  109. 'desc' => '元件',
  110. 'match' => 'is_numeric',
  111. 'update' => 'text',
  112. //'list' => 'Dever::load("device/sensor-one#name", {sensor_id})',
  113. ),
  114. 'name' => array
  115. (
  116. 'type' => 'varchar-80',
  117. 'name' => '名称',
  118. 'default' => '',
  119. 'desc' => '名称',
  120. 'match' => 'is_string',
  121. 'update' => 'text',
  122. 'list' => true,
  123. ),
  124. 'exp' => array
  125. (
  126. 'type' => 'varchar-80',
  127. 'name' => '计算公式',
  128. 'default' => '',
  129. 'desc' => '计算公式',
  130. 'match' => 'is_string',
  131. 'update' => 'text',
  132. 'list' => true,
  133. ),
  134. 'than' => array
  135. (
  136. 'type' => 'tinyint-1',
  137. 'name' => '表达式',
  138. 'default' => '1',
  139. 'desc' => '请选择表达式',
  140. 'match' => 'is_numeric',
  141. 'option' => $than,
  142. 'update' => 'radio',
  143. 'list' => true,
  144. ),
  145. 'value' => array
  146. (
  147. 'type' => 'varchar-500',
  148. 'name' => '表达式的值',
  149. 'default' => '',
  150. 'desc' => '数据',
  151. 'match' => 'is_string',
  152. 'update' => 'text',
  153. 'search' => 'fulltext',
  154. //'list' => '{reorder} == 10000 ? Dever::mdate("{value}") : "{value}{dw}"',
  155. 'list' => '"{value}{unit}"',
  156. ),
  157. 'time' => array
  158. (
  159. 'type' => 'int-11',
  160. 'name' => '间隔时间',
  161. 'default' => '',
  162. 'desc' => '间隔时间',
  163. 'match' => 'is_string',
  164. 'update' => 'textarea',
  165. ),
  166. 'result' => array
  167. (
  168. 'type' => 'varchar-1000',
  169. 'name' => '执行指令',
  170. 'default' => '',
  171. 'desc' => '执行指令',
  172. 'match' => 'is_string',
  173. 'update' => 'textarea',
  174. ),
  175. 'state' => array
  176. (
  177. 'type' => 'tinyint-1',
  178. 'name' => '状态',
  179. 'default' => '1',
  180. 'desc' => '请选择状态',
  181. 'match' => 'is_numeric',
  182. 'option' => $option,
  183. 'update' => 'radio',
  184. 'list' => true,
  185. ),
  186. 'cdate' => array
  187. (
  188. 'type' => 'int-11',
  189. 'name' => '录入时间',
  190. 'match' => array('is_numeric', time()),
  191. 'desc' => '',
  192. # 只有insert时才生效
  193. 'insert' => true,
  194. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  195. ),
  196. ),
  197. 'manage' => array
  198. (
  199. # 不允许编辑
  200. 'edit' => false,
  201. 'insert' => false,
  202. ),
  203. # request 请求接口定义
  204. 'request' => array
  205. (
  206. ),
  207. );