notice.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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 Dever::load('manage/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. ),
  92. 'cdate' => array
  93. (
  94. 'type' => 'int-11',
  95. 'name' => '录入时间',
  96. 'match' => array('is_numeric', time()),
  97. 'desc' => '',
  98. # 只有insert时才生效
  99. 'insert' => true,
  100. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  101. ),
  102. ),
  103. 'manage' => array
  104. (
  105. # 增加批量更新功能,根据哪个字段批量更新
  106. 'update_mul' => 'name',
  107. ),
  108. # request 请求接口定义
  109. 'request' => array
  110. (
  111. # 根据配置id获取notice
  112. 'getAll' => array
  113. (
  114. # 匹配的正则或函数 必填项
  115. 'where' => array
  116. (
  117. //'username' => '/^([A-Za-z0-9])/',
  118. 'config' => 'yes',
  119. 'state' => 1,
  120. ),
  121. 'type' => 'all',
  122. 'order' => array('id' => 'desc'),
  123. 'limit' => '0,5',
  124. 'col' => '*',
  125. ),
  126. # 根据配置id和notice Id获取
  127. 'getOne' => array
  128. (
  129. 'type' => 'one',
  130. 'where' => array
  131. (
  132. 'id' => 'yes',
  133. 'config' => 'yes',
  134. 'state' => 1,
  135. ),
  136. 'input' => true,
  137. ),
  138. ),
  139. );