log.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | log.php 日志表
  5. |--------------------------------------------------------------------------
  6. */
  7. $admin = function()
  8. {
  9. $array = array();
  10. $info = Dever::load('manage/admin-state');
  11. if($info)
  12. {
  13. $array += $info;
  14. }
  15. return $array;
  16. };
  17. $type = array
  18. (
  19. 1 => '新增',
  20. 2 => '更新',
  21. 3 => '删除',
  22. 4 => '恢复',
  23. );
  24. return array
  25. (
  26. # 表名
  27. 'name' => 'log',
  28. # 显示给用户看的名称
  29. 'lang' => '操作日志',
  30. # 关闭验证重复提交功能
  31. 'submit' => false,
  32. 'config_type' => $type,
  33. # 建表时进行分区,一般按照时间分区,仅在mysql类型有效
  34. 'partition' => array
  35. (
  36. 'type' => 'range',//range分区,具体的值请查看mysql分区类型
  37. 'col' => 'YEAR(cdate)',//分区的字段值
  38. 'value' => array(2000,2010),//分区的值
  39. 'exp' => 'LESS THEN',//LESS THEN还是in等表达式
  40. ),
  41. 'order' => 66,
  42. # 表类型 值为\innodb\myisam\,默认为innodb,仅在mysql类型有效
  43. //'type' => 'innodb',
  44. # 数据结构
  45. 'struct' => array
  46. (
  47. 'id' => array
  48. (
  49. 'type' => 'int-11',
  50. 'name' => 'ID',
  51. 'default' => '',
  52. 'desc' => '',
  53. 'match' => 'is_numeric',
  54. 'list' => true,
  55. ),
  56. 'project' => array
  57. (
  58. 'type' => 'varchar-80',
  59. 'name' => '项目名',
  60. 'default' => '',
  61. 'desc' => '请输入项目名',
  62. 'match' => 'is_string',
  63. //'list' => 'Dever::load("manage/project.name", "{project}")',
  64. ),
  65. 'table' => array
  66. (
  67. 'type' => 'varchar-80',
  68. 'name' => '项目下的表名',
  69. 'default' => '',
  70. 'desc' => '项目下的表名',
  71. 'match' => 'is_string',
  72. //'list' => 'Dever::load("manage/database.getTableName", "{project}", "{table}")',
  73. ),
  74. 'menu_id' => array
  75. (
  76. 'type' => 'varchar-80',
  77. 'name' => '菜单',
  78. 'default' => '',
  79. 'desc' => '菜单',
  80. 'match' => 'is_string',
  81. 'search' => 'linkage',
  82. 'update' => 'linkage',
  83. 'option' => Dever::url('menu.getManageMenu', 'manage'),
  84. //'list' => 'Dever::load("manage/menu-one#name", "{menu_id}")',
  85. 'list' => 'Dever::load("manage/src/lib/log.getMenuInfo", "{menu_id}")',
  86. ),
  87. 'name' => array
  88. (
  89. 'type' => 'varchar-80',
  90. 'name' => '操作名',
  91. 'default' => '',
  92. 'desc' => '操作名',
  93. 'match' => 'is_string',
  94. 'search' => 'fulltext',
  95. 'list' => true,
  96. ),
  97. 'type' => array
  98. (
  99. 'type' => 'tinyint-1',
  100. 'name' => '操作类型',
  101. 'default' => '1',
  102. 'desc' => '操作类型',
  103. 'match' => 'is_numeric',
  104. 'option' => $type,
  105. 'search' => 'select',
  106. 'update' => 'radio',
  107. 'list' => true,
  108. ),
  109. 'admin' => array
  110. (
  111. 'type' => 'int-11',
  112. 'name' => '操作人',
  113. 'default' => '',
  114. 'desc' => '操作人',
  115. 'match' => 'is_string',
  116. 'search' => array
  117. (
  118. 'api' => 'manage/admin-getSearch',
  119. 'col' => 'col',
  120. 'result' => 'id',
  121. 'search' => 'admin',
  122. ),
  123. 'list' => 'Dever::load("manage/admin-one#username", {admin})',
  124. //'option' => $admin,
  125. ),
  126. 'info' => array
  127. (
  128. 'type' => 'longtext',
  129. 'name' => '操作记录',
  130. 'default' => '',
  131. 'desc' => '操作记录',
  132. 'match' => 'is_string',
  133. 'search' => 'fulltext',
  134. 'list' => 'Dever::load("manage/src/lib/log.getInfo", "{id}")',
  135. //'modal' => '查看详情',
  136. ),
  137. 'tid' => array
  138. (
  139. 'type' => 'int-11',
  140. 'name' => '来源表id',
  141. 'default' => '',
  142. 'desc' => '来源表id',
  143. 'match' => 'is_string',
  144. //'list' => true,
  145. ),
  146. 'state' => array
  147. (
  148. 'type' => 'tinyint-1',
  149. 'name' => '状态',
  150. 'default' => '1',
  151. 'desc' => '请选择状态',
  152. 'match' => 'option',
  153. ),
  154. 'cdate' => array
  155. (
  156. 'type' => 'int-11',
  157. 'name' => '操作时间',
  158. 'match' => array('is_numeric', time()),
  159. 'desc' => '',
  160. # 只有insert时才生效
  161. 'insert' => true,
  162. 'search' => 'time',
  163. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  164. ),
  165. ),
  166. 'manage' => array
  167. (
  168. 'list_table' => 'html',
  169. 'delete' => false,
  170. 'edit' => false,
  171. 'insert' => false,
  172. 'link' => 'parent=log',
  173. 'button' => array
  174. (
  175. '字段记录' => array('list', 'opt'),
  176. '计划任务' => array('list', 'cron'),
  177. '接口列表' => array('list', 'api'),
  178. ),
  179. ),
  180. # 索引
  181. 'index' => array
  182. (
  183. # 索引名 => 索引id
  184. //'id' => 'id,state',
  185. ),
  186. # request 请求接口定义
  187. 'request' => array
  188. (
  189. # onload 增加hack功能 使用该请求接口必须首先载入的类 如果需要子项也添加类似功能,可以使用start、end
  190. 'onload' => 'manage/auth.init',//这个是权限验证,必须后台登录
  191. ),
  192. );