user_product.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '可用',
  6. 2 => '不可用',
  7. );
  8. return array
  9. (
  10. # 表名
  11. 'name' => 'user_product',
  12. # 显示给用户看的名称
  13. 'lang' => '用户产品列表',
  14. # 后台菜单排序
  15. 'order' => 10,
  16. # 数据结构
  17. 'struct' => array
  18. (
  19. 'id' => array
  20. (
  21. 'type' => 'int-11',
  22. 'name' => 'ID',
  23. 'default' => '',
  24. 'desc' => '',
  25. 'match' => 'is_numeric',
  26. 'search' => 'order',
  27. 'order' => 'desc',
  28. //'list' => true,
  29. ),
  30. 'uid' => array
  31. (
  32. 'type' => 'int-11',
  33. 'name' => '用户',
  34. 'default' => '',
  35. 'desc' => '请选择用户',
  36. 'match' => 'is_numeric',
  37. 'update' => 'text',
  38. 'search' => 'fulltext',
  39. 'in' => true,
  40. 'list' => 'Dever::load("passport/user-one#username", {uid})',
  41. 'autocomplete' => array('passport/manage.user?json=1', 'uid', 'passport/user-info#username'),
  42. ),
  43. 'product_id' => array
  44. (
  45. 'type' => 'int-11',
  46. 'name' => '产品',
  47. 'default' => '',
  48. 'desc' => '请选择产品',
  49. 'match' => 'is_numeric',
  50. 'update' => 'text',
  51. 'search' => 'fulltext',
  52. 'in' => true,
  53. 'list' => 'Dever::load("device/data.product_info#name", {product_id})',
  54. 'autocomplete' => array('device/manage.product?json=1', 'product_id', 'device/data.product_info#name'),
  55. ),
  56. 'key' => array
  57. (
  58. 'type' => 'varchar-60',
  59. 'name' => '设备标识',
  60. 'default' => '',
  61. 'desc' => '设备标识',
  62. 'match' => 'is_string',
  63. //'update' => 'text',
  64. 'list_name' => '传感器与控制器',
  65. 'list' => 'Dever::load("device/element.getAll", {product_id})',
  66. ),
  67. 'state' => array
  68. (
  69. 'type' => 'tinyint-1',
  70. 'name' => '状态',
  71. 'default' => '1',
  72. 'desc' => '请选择状态',
  73. 'match' => 'is_numeric',
  74. 'option' => $option,
  75. 'update' => 'radio',
  76. 'list' => true,
  77. ),
  78. 'cdate' => array
  79. (
  80. 'type' => 'int-11',
  81. 'name' => '录入时间',
  82. 'match' => array('is_numeric', time()),
  83. 'desc' => '',
  84. # 只有insert时才生效
  85. 'insert' => true,
  86. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  87. ),
  88. ),
  89. 'manage' => array
  90. (
  91. # 不允许编辑
  92. 'edit' => false,
  93. 'insert' => false,
  94. ),
  95. # request 请求接口定义
  96. 'request' => array
  97. (
  98. ),
  99. );