393e0693dece141d205abcda1201a4f8d1f029c2.svn-base 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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. 'list' => true,
  85. ),
  86. 'ldate' => array
  87. (
  88. 'type' => 'int-11',
  89. 'name' => '执行时间',
  90. 'match' => 'is_numeric',
  91. 'desc' => '请选择执行时间',
  92. 'update' => 'date',
  93. 'callback' => 'maketime',
  94. 'list' => 'date("Y-m-d H:i:s", {ldate})',
  95. ),
  96. 'time' => array
  97. (
  98. 'type' => 'int-11',
  99. 'name' => '时间间隔(为0则执行一次)',
  100. 'default' => '0',
  101. 'match' => 'is_numeric',
  102. 'desc' => '请输入时间间隔',
  103. 'update' => 'text',
  104. 'list' => true,
  105. ),
  106. 'state' => array
  107. (
  108. 'type' => 'tinyint-1',
  109. 'name' => '状态',
  110. 'default' => '1',
  111. 'desc' => '请选择状态',
  112. 'match' => 'is_numeric',
  113. 'option' => $option,
  114. 'update' => 'radio',
  115. 'list' => true,
  116. ),
  117. 'cdate' => array
  118. (
  119. 'type' => 'int-11',
  120. 'name' => '录入时间',
  121. 'match' => array('is_numeric', time()),
  122. 'desc' => '',
  123. # 只有insert时才生效
  124. 'insert' => true,
  125. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  126. ),
  127. ),
  128. 'manage' => array
  129. (
  130. 'list_button' => array(6 => '删除'),
  131. ),
  132. # request 请求接口定义
  133. 'request' => array
  134. (
  135. # get
  136. 'get' => array
  137. (
  138. 'where' => array
  139. (
  140. 'ldate' => array('yes', '<='),
  141. 'state' => 1,
  142. ),
  143. 'type' => 'all',
  144. 'order' => array('id', 'desc'),
  145. 'col' => '*',
  146. ),
  147. # get
  148. 'getOne' => array
  149. (
  150. 'where' => array
  151. (
  152. 'project' => 'yes',
  153. 'interface' => 'yes',
  154. ),
  155. 'type' => 'one',
  156. ),
  157. ),
  158. );