3bbccac4328717167c07721a007aa5028a786be9.svn-base 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | admin.php 管理员表
  5. |--------------------------------------------------------------------------
  6. */
  7. # 定义几个常用的选项
  8. $option = array
  9. (
  10. 1 => '启用',
  11. 2 => '关闭',
  12. );
  13. $config = function()
  14. {
  15. return Maze::load('/config-all');
  16. };
  17. return array
  18. (
  19. # 表名
  20. 'name' => 'notice',
  21. # 显示给用户看的名称
  22. 'lang' => '后台公告管理',
  23. 'order' => 7,
  24. # 数据结构
  25. 'struct' => array
  26. (
  27. 'id' => array
  28. (
  29. 'type' => 'int-11',
  30. 'name' => '公告ID',
  31. 'default' => '',
  32. 'desc' => '',
  33. 'match' => 'is_numeric',
  34. 'search' => 'order',
  35. 'list' => true,
  36. 'order' => 'desc',
  37. ),
  38. 'name' => array
  39. (
  40. 'type' => 'varchar-32',
  41. 'name' => '公告标题',
  42. 'default' => '',
  43. 'desc' => '请输入公告标题',
  44. 'match' => 'is_string',
  45. 'update' => 'text',
  46. //'autocomplete' => 'auth.role?json=1',
  47. 'search' => 'order,fulltext',
  48. 'list' => true,
  49. ),
  50. 'config' => array
  51. (
  52. 'type' => 'int-11',
  53. 'name' => '后台配置',
  54. 'default' => '1',
  55. 'desc' => '请选择后台配置',
  56. 'match' => 'is_numeric',
  57. 'option' => $config,
  58. 'update' => 'select',
  59. 'list' => true,
  60. ),
  61. 'reorder' => array
  62. (
  63. 'type' => 'int-11',
  64. 'name' => '排序(数值越大越靠前)',
  65. 'default' => '1',
  66. 'desc' => '请输入排序',
  67. 'match' => 'option',
  68. 'update' => 'text',
  69. 'search' => 'order',
  70. 'list' => true,
  71. 'order' => 'desc',
  72. ),
  73. 'content' => array
  74. (
  75. 'type' => 'text-255',
  76. 'name' => '内容',
  77. 'default' => '',
  78. 'desc' => '请输入内容',
  79. 'match' => 'is_string',
  80. 'update' => 'editor',
  81. //'list' => true,
  82. 'key' => 1,
  83. ),
  84. 'state' => array
  85. (
  86. 'type' => 'tinyint-1',
  87. 'name' => '状态',
  88. 'default' => '1',
  89. 'desc' => '请选择状态',
  90. 'match' => 'is_numeric',
  91. 'option' => $option,
  92. 'update' => 'radio',
  93. 'list' => true,
  94. ),
  95. 'cdate' => array
  96. (
  97. 'type' => 'int-11',
  98. 'name' => '录入时间',
  99. 'match' => array('is_numeric', time()),
  100. 'desc' => '',
  101. # 只有insert时才生效
  102. 'insert' => true,
  103. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  104. ),
  105. ),
  106. 'manage' => array
  107. (
  108. # 增加批量更新功能,根据哪个字段批量更新
  109. 'update_mul' => 'name',
  110. ),
  111. # request 请求接口定义
  112. 'request' => array
  113. (
  114. # 根据配置id获取notice
  115. 'getAll' => array
  116. (
  117. # 匹配的正则或函数 必填项
  118. 'where' => array
  119. (
  120. //'username' => '/^([A-Za-z0-9])/',
  121. 'config' => 'yes',
  122. 'state' => 1,
  123. ),
  124. 'type' => 'all',
  125. 'order' => array('reorder` desc,`id', 'desc'),
  126. 'limit' => array(5, 0),
  127. 'col' => '*',
  128. ),
  129. # 根据配置id和notice Id获取
  130. 'getOne' => array
  131. (
  132. 'type' => 'one',
  133. 'where' => array
  134. (
  135. 'id' => 'yes',
  136. 'config' => 'yes',
  137. 'state' => 1,
  138. ),
  139. ),
  140. ),
  141. );