cb63dd98e300465400b8ecc0bbf0314a944bfd13.svn-base 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | role.php 角色表
  5. |--------------------------------------------------------------------------
  6. */
  7. # 定义几个常用的选项
  8. $option = array
  9. (
  10. 1 => '可执行',
  11. 2 => '已完成',
  12. );
  13. # 获取project
  14. $project = function()
  15. {
  16. $info = Maze::load('manage/project.get');
  17. $data = array();
  18. foreach($info as $k => $v)
  19. {
  20. $k = $v['lib'];
  21. $data[$k]['id'] = $v['name'];
  22. $data[$k]['name'] = $v['lang'];
  23. }
  24. return $data;
  25. };
  26. //print_r($project);die;
  27. return array
  28. (
  29. # 表名
  30. 'name' => 'cron',
  31. # 显示给用户看的名称
  32. 'lang' => '计划任务',
  33. 'desc' => '请将* * * * * root php '.MAZE_PROJECT_PATH.'daemon/maze.php放到cron中[建议每分钟执行一次,虚拟主机请在config/base.php里开启cron=true]<br />或者请执行 php '.MAZE_PROJECT_PATH.'daemon/loop.php > /dev/null & 指令,将本程序放到后台一直运行',
  34. # 数据结构
  35. 'struct' => array
  36. (
  37. 'id' => array
  38. (
  39. 'type' => 'int-11',
  40. 'name' => 'ID',
  41. 'default' => '',
  42. 'desc' => '',
  43. 'match' => 'is_numeric',
  44. 'search' => 'order',
  45. 'list' => true,
  46. ),
  47. 'name' => array
  48. (
  49. 'type' => 'varchar-24',
  50. 'name' => '任务名',
  51. 'default' => '',
  52. 'desc' => '请输入任务名',
  53. 'match' => 'is_string',
  54. 'update' => 'text',
  55. 'search' => 'fulltext',
  56. 'list' => true,
  57. ),
  58. 'project' => array
  59. (
  60. 'type' => 'varchar-30',
  61. 'name' => '项目',
  62. 'default' => '',
  63. 'desc' => '请选择项目',
  64. 'match' => 'is_string',
  65. 'update' => 'select',
  66. 'option' => $project,
  67. 'list' => true,
  68. ),
  69. 'interface' => array
  70. (
  71. 'type' => 'varchar-100',
  72. 'name' => '接口(命令行)',
  73. 'default' => '',
  74. 'desc' => '请输入接口(命令行)',
  75. 'match' => 'is_string',
  76. 'update' => 'text',
  77. ),
  78. 'ldate' => array
  79. (
  80. 'type' => 'int-11',
  81. 'name' => '执行时间',
  82. 'match' => 'is_numeric',
  83. 'desc' => '请选择执行时间',
  84. 'update' => 'date',
  85. 'callback' => 'maketime',
  86. 'list' => 'date("Y-m-d H:i:s", {ldate})',
  87. ),
  88. 'time' => array
  89. (
  90. 'type' => 'int-11',
  91. 'name' => '时间间隔(为0则执行一次)',
  92. 'default' => '0',
  93. 'match' => 'is_numeric',
  94. 'desc' => '请输入时间间隔',
  95. 'update' => 'text',
  96. 'list' => true,
  97. ),
  98. 'state' => array
  99. (
  100. 'type' => 'tinyint-1',
  101. 'name' => '状态',
  102. 'default' => '1',
  103. 'desc' => '请选择状态',
  104. 'match' => 'is_numeric',
  105. 'option' => $option,
  106. 'update' => 'radio',
  107. 'list' => true,
  108. ),
  109. 'cdate' => array
  110. (
  111. 'type' => 'int-11',
  112. 'name' => '录入时间',
  113. 'match' => array('is_numeric', time()),
  114. 'desc' => '',
  115. # 只有insert时才生效
  116. 'insert' => true,
  117. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  118. ),
  119. ),
  120. 'manage' => array
  121. (
  122. 'list_button' => array(6 => '删除'),
  123. ),
  124. # request 请求接口定义
  125. 'request' => array
  126. (
  127. # get
  128. 'get' => array
  129. (
  130. 'where' => array
  131. (
  132. 'ldate' => array('yes', '<='),
  133. 'state' => 1,
  134. ),
  135. 'type' => 'all',
  136. 'order' => array('id', 'desc'),
  137. 'col' => '*',
  138. ),
  139. # get
  140. 'getOne' => array
  141. (
  142. 'where' => array
  143. (
  144. 'project' => 'yes',
  145. 'interface' => 'yes',
  146. ),
  147. 'type' => 'one',
  148. ),
  149. ),
  150. );