6335cca3911a7a36b731e036f03e1e4f99639c25.svn-base 3.5 KB

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