stat.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '显示',
  6. 2 => '不显示',
  7. );
  8. $park = Maze::input('option_park_id');
  9. $type = function() use($park)
  10. {
  11. $data = Maze::load('company/device_data-getType', array('where_park_id' => $park));
  12. return $data;
  13. };
  14. return array
  15. (
  16. # 表名
  17. 'name' => 'stat',
  18. # 显示给用户看的名称
  19. 'lang' => '数据统计',
  20. 'menu' => false,
  21. # 数据结构
  22. 'struct' => array
  23. (
  24. 'id' => array
  25. (
  26. 'type' => 'int-11',
  27. 'name' => 'ID',
  28. 'default' => '',
  29. 'desc' => '',
  30. 'match' => 'is_numeric',
  31. 'search' => 'order',
  32. 'order' => 'desc',
  33. //'list' => true,
  34. ),
  35. 'product_id' => array
  36. (
  37. 'type' => 'int-11',
  38. 'name' => '成品设备',
  39. 'default' => '',
  40. 'desc' => '请输入设备ID',
  41. 'match' => 'is_numeric',
  42. 'update' => 'text',
  43. ),
  44. 'device_id' => array
  45. (
  46. 'type' => 'int-11',
  47. 'name' => '基础设备',
  48. 'default' => '',
  49. 'desc' => '请输入基础设备',
  50. 'match' => 'is_numeric',
  51. 'update' => 'text',
  52. ),
  53. 'data_id' => array
  54. (
  55. 'type' => 'int-11',
  56. 'name' => '名称',
  57. 'default' => '',
  58. 'desc' => '名称',
  59. 'match' => 'is_numeric',
  60. //'update' => 'select',
  61. 'search' => 'select',
  62. 'option' => $type,
  63. 'list' => 'Maze::load("company/device_data-one#name", {data_id})',
  64. ),
  65. 'value' => array
  66. (
  67. 'type' => 'text-255',
  68. 'name' => '当前记录值',
  69. 'default' => '',
  70. 'desc' => '当前记录值',
  71. 'match' => 'is_string',
  72. 'update' => 'text',
  73. 'list' => '"{value}" . Maze::load("company/device_data-one#dw", {data_id})',
  74. ),
  75. 'receive' => array
  76. (
  77. 'type' => 'varchar-255',
  78. 'name' => '接收到的指令',
  79. 'default' => '',
  80. 'desc' => '接收到的指令',
  81. 'match' => 'is_string',
  82. //'update' => 'text',
  83. ),
  84. 'reorder' => array
  85. (
  86. 'type' => 'int-11',
  87. 'name' => '排序-数值越大越靠前',
  88. 'default' => '1',
  89. 'desc' => '请输入排序',
  90. 'match' => 'option',
  91. //'update' => 'text',
  92. 'search' => 'order',
  93. //'list' => true,
  94. //'order' => 'desc',
  95. 'edit' => true,
  96. ),
  97. 'state' => array
  98. (
  99. 'type' => 'tinyint-1',
  100. 'name' => '状态',
  101. 'default' => '1',
  102. 'desc' => '请选择状态',
  103. 'match' => 'is_numeric',
  104. 'option' => $option,
  105. //'update' => 'radio',
  106. //'list' => true,
  107. ),
  108. 'cdate' => array
  109. (
  110. 'type' => 'int-11',
  111. 'name' => '时间',
  112. 'match' => array('is_numeric', time()),
  113. 'desc' => '',
  114. # 只有insert时才生效
  115. 'insert' => true,
  116. 'order' => 'desc',
  117. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  118. ),
  119. ),
  120. //'auth' => 'company',
  121. 'manage' => array
  122. (
  123. 'insert' => false,
  124. //'edit' => false,
  125. 'list_button' => array
  126. (
  127. //11 => array('控制设备', '"farm_device_set&option_farm_device_id={id}"'),
  128. //12 => array('数据记录', '"farm_device_data&option_farm_device_id={id}"'),
  129. 6 => '删除',
  130. ),
  131. ),
  132. # request 请求接口定义
  133. 'request' => array
  134. (
  135. 'get' => array
  136. (
  137. # 匹配的正则或函数 选填项
  138. 'where' => array
  139. (
  140. 'park_id' => 'yes',
  141. ),
  142. 'type' => 'all',
  143. 'order' => array('reorder` desc,`id', 'desc'),
  144. 'col' => '*',
  145. ),
  146. 'getAll' => array
  147. (
  148. # 匹配的正则或函数 选填项
  149. 'option' => array
  150. (
  151. 'data_id' => 'yes',
  152. 'park_id' => 'yes',
  153. 'device_id' => 'yes',
  154. 'code_id' => 'yes',
  155. 'start' => array('yes-cdate', '>='),
  156. 'end' => array('yes-cdate', '<='),
  157. ),
  158. 'type' => 'all',
  159. 'order' => array('id', 'desc'),
  160. 'limit' => array(100, 0),
  161. 'col' => '*',
  162. ),
  163. 'getOne' => array
  164. (
  165. # 匹配的正则或函数 选填项
  166. 'where' => array
  167. (
  168. 'park_id' => 'yes',
  169. 'device_id' => 'yes',
  170. 'element_id' => 'yes',
  171. 'code_id' => 'yes',
  172. ),
  173. 'type' => 'one',
  174. ),
  175. ),
  176. );