123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <?php
- # 定义几个常用的选项
- $option = array
- (
- 1 => '显示',
- 2 => '不显示',
- );
- $park = Maze::input('option_park_id');
- $type = function() use($park)
- {
- $data = Maze::load('company/device_data-getType', array('where_park_id' => $park));
- return $data;
- };
- return array
- (
- # 表名
- 'name' => 'stat',
- # 显示给用户看的名称
- 'lang' => '数据统计',
- 'menu' => false,
- # 数据结构
- 'struct' => array
- (
- 'id' => array
- (
- 'type' => 'int-11',
- 'name' => 'ID',
- 'default' => '',
- 'desc' => '',
- 'match' => 'is_numeric',
- 'search' => 'order',
- 'order' => 'desc',
- //'list' => true,
- ),
-
- 'product_id' => array
- (
- 'type' => 'int-11',
- 'name' => '成品设备',
- 'default' => '',
- 'desc' => '请输入设备ID',
- 'match' => 'is_numeric',
- 'update' => 'text',
- ),
- 'device_id' => array
- (
- 'type' => 'int-11',
- 'name' => '基础设备',
- 'default' => '',
- 'desc' => '请输入基础设备',
- 'match' => 'is_numeric',
- 'update' => 'text',
- ),
- 'data_id' => array
- (
- 'type' => 'int-11',
- 'name' => '名称',
- 'default' => '',
- 'desc' => '名称',
- 'match' => 'is_numeric',
- //'update' => 'select',
- 'search' => 'select',
- 'option' => $type,
- 'list' => 'Maze::load("company/device_data-one#name", {data_id})',
- ),
-
- 'value' => array
- (
- 'type' => 'text-255',
- 'name' => '当前记录值',
- 'default' => '',
- 'desc' => '当前记录值',
- 'match' => 'is_string',
- 'update' => 'text',
- 'list' => '"{value}" . Maze::load("company/device_data-one#dw", {data_id})',
- ),
-
- 'receive' => array
- (
- 'type' => 'varchar-255',
- 'name' => '接收到的指令',
- 'default' => '',
- 'desc' => '接收到的指令',
- 'match' => 'is_string',
- //'update' => 'text',
- ),
-
- 'reorder' => array
- (
- 'type' => 'int-11',
- 'name' => '排序-数值越大越靠前',
- 'default' => '1',
- 'desc' => '请输入排序',
- 'match' => 'option',
- //'update' => 'text',
- 'search' => 'order',
- //'list' => true,
- //'order' => 'desc',
- 'edit' => true,
- ),
- 'state' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '状态',
- 'default' => '1',
- 'desc' => '请选择状态',
- 'match' => 'is_numeric',
- 'option' => $option,
- //'update' => 'radio',
- //'list' => true,
- ),
-
- 'cdate' => array
- (
- 'type' => 'int-11',
- 'name' => '时间',
- 'match' => array('is_numeric', time()),
- 'desc' => '',
- # 只有insert时才生效
- 'insert' => true,
- 'order' => 'desc',
- 'list' => 'date("Y-m-d H:i:s", {cdate})',
- ),
- ),
-
- //'auth' => 'company',
-
- 'manage' => array
- (
- 'insert' => false,
- //'edit' => false,
- 'list_button' => array
- (
- //11 => array('控制设备', '"farm_device_set&option_farm_device_id={id}"'),
- //12 => array('数据记录', '"farm_device_data&option_farm_device_id={id}"'),
- 6 => '删除',
- ),
- ),
-
- # request 请求接口定义
- 'request' => array
- (
- 'get' => array
- (
- # 匹配的正则或函数 选填项
- 'where' => array
- (
- 'park_id' => 'yes',
- ),
- 'type' => 'all',
- 'order' => array('reorder` desc,`id', 'desc'),
- 'col' => '*',
- ),
- 'getAll' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'data_id' => 'yes',
- 'park_id' => 'yes',
- 'device_id' => 'yes',
- 'code_id' => 'yes',
- 'start' => array('yes-cdate', '>='),
- 'end' => array('yes-cdate', '<='),
- ),
- 'type' => 'all',
- 'order' => array('id', 'desc'),
- 'limit' => array(100, 0),
- 'col' => '*',
- ),
-
- 'getOne' => array
- (
- # 匹配的正则或函数 选填项
- 'where' => array
- (
- 'park_id' => 'yes',
- 'device_id' => 'yes',
- 'element_id' => 'yes',
- 'code_id' => 'yes',
- ),
- 'type' => 'one',
- ),
- ),
- );
|