opt.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | opt.php 记录字段的表
  5. |--------------------------------------------------------------------------
  6. */
  7. # 定义几个常用的选项
  8. $option = array
  9. (
  10. 1 => '显示',
  11. 2 => '不显示',
  12. );
  13. $status = array
  14. (
  15. 1 => '未做任何操作',
  16. 2 => '已建立索引',
  17. );
  18. $info = Dever\Loader\Project::read();
  19. $path = $info['manage']['path'];
  20. if(isset($info['manage']['setup']))
  21. {
  22. $path = $info['manage']['setup'];
  23. }
  24. # 获取project
  25. $project = function() use ($info)
  26. {
  27. $data = array();
  28. foreach($info as $k => $v)
  29. {
  30. $k = $v['name'];
  31. $data[$k]['id'] = $v['name'];
  32. $data[$k]['name'] = $v['lang'];
  33. }
  34. return $data;
  35. };
  36. return array
  37. (
  38. # 表名
  39. 'name' => 'opt',
  40. # 显示给用户看的名称
  41. 'lang' => '字段记录表',
  42. 'desc' => Dever::markdown('**本表记录所有数据表文件里的request方法:**
  43. 1. 启用本表的记录功能,不会影响所有业务逻辑的执行效率,但会消耗服务器资源。建议仅在测试环境下开启或短时间内开启。请在config/base项中添加opt来确定是否启用。
  44. 2. 在这里可以根据相应的记录,手动添加索引。'),
  45. # 表类型 值为\innodb\myisam\,默认为innodb,仅在mysql类型有效
  46. 'type' => 'innodb',
  47. # 数据结构
  48. 'struct' => array
  49. (
  50. 'id' => array
  51. (
  52. 'type' => 'int-11',
  53. 'name' => 'ID',
  54. 'default' => '',
  55. 'desc' => '',
  56. 'match' => 'is_numeric',
  57. 'search' => 'order',
  58. //'list' => true,
  59. ),
  60. 'project' => array
  61. (
  62. 'type' => 'varchar-30',
  63. 'name' => '项目',
  64. 'default' => '',
  65. 'desc' => '请选择项目',
  66. 'match' => 'is_string',
  67. 'update' => 'select',
  68. 'search' => 'select',
  69. 'option' => $project,
  70. 'list' => true,
  71. ),
  72. 'table' => array
  73. (
  74. 'type' => 'varchar-30',
  75. 'name' => '数据表-请输入表的英文名',
  76. 'default' => '',
  77. 'desc' => '请选择数据表',
  78. 'match' => 'is_string',
  79. 'update' => 'text',
  80. 'search' => 'fulltext',
  81. 'list' => 'Dever::load("manage/opt.get#table", {id})',
  82. ),
  83. 'method' => array
  84. (
  85. 'type' => 'varchar-32',
  86. 'name' => '所属方法名',
  87. 'default' => '',
  88. 'desc' => '请输入所属方法名',
  89. 'match' => 'option',
  90. //'update' => 'text',
  91. //'search' => 'fulltext',
  92. //'list' => true,
  93. ),
  94. 'col' => array
  95. (
  96. 'type' => 'varchar-500',
  97. 'name' => '使用的字段',
  98. 'default' => '',
  99. 'desc' => '请选择字段',
  100. 'match' => 'is_string',
  101. 'update' => 'text',
  102. 'search' => 'fulltext',
  103. 'list' => 'Dever::load("manage/opt.get#text", {id})',
  104. 'list_name' => '分析优化',
  105. ),
  106. 'col_index' => array
  107. (
  108. 'type' => 'varchar-500',
  109. 'name' => '建立索引的字段',
  110. 'default' => '',
  111. 'desc' => '请选择建立索引的字段',
  112. 'match' => 'is_string',
  113. 'update' => 'text',
  114. ),
  115. 'version' => array
  116. (
  117. 'type' => 'int-11',
  118. 'name' => '版本号',
  119. 'default' => '0',
  120. 'desc' => '版本号',
  121. 'match' => 'is_numeric',
  122. 'update' => 'text',
  123. ),
  124. 'num' => array
  125. (
  126. 'type' => 'int-11',
  127. 'name' => '执行次数',
  128. 'default' => '0',
  129. 'match' => 'is_numeric',
  130. 'desc' => '执行次数',
  131. 'update' => 'text',
  132. 'search' => 'order',
  133. 'list' => true,
  134. ),
  135. 'time' => array
  136. (
  137. 'type' => 'varchar-30',
  138. 'name' => '执行时间',
  139. 'default' => '0',
  140. 'match' => 'is_string',
  141. 'desc' => '执行时间',
  142. 'update' => 'text',
  143. 'search' => 'order',
  144. 'list' => true,
  145. ),
  146. 'status' => array
  147. (
  148. 'type' => 'tinyint-1',
  149. 'name' => '是否建立索引',
  150. 'default' => '1',
  151. 'desc' => '请选择是否建立索引',
  152. 'match' => 'is_numeric',
  153. 'option' => $status,
  154. 'update' => 'radio',
  155. //'list' => true,
  156. ),
  157. 'state' => array
  158. (
  159. 'type' => 'tinyint-1',
  160. 'name' => '数据是否存在',
  161. 'default' => '1',
  162. 'desc' => '请选择数据是否存在',
  163. 'match' => 'is_numeric',
  164. 'option' => $option,
  165. 'update' => 'radio',
  166. //'list' => true,
  167. ),
  168. 'cdate' => array
  169. (
  170. 'type' => 'int-11',
  171. 'name' => '录入时间',
  172. 'match' => array('is_numeric', time()),
  173. 'desc' => '',
  174. # 只有insert时才生效
  175. 'insert' => true,
  176. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  177. ),
  178. ),
  179. 'manage' => array
  180. (
  181. 'edit' => false,
  182. 'insert' => false,
  183. 'delete' => false,
  184. 'button' => array
  185. (
  186. '生成数据结构文档' => Dever::url('doc/view?type=db', 'manage'),
  187. 'Mysql规范和建议' => Dever::url('doc/view?type=mysql', 'manage'),
  188. //'全部清空' => 'manage/menu.delete',
  189. )
  190. ),
  191. # request 请求接口定义
  192. 'request' => array
  193. (
  194. 'updateNum' => array
  195. (
  196. 'type' => 'update',
  197. 'where' => array
  198. (
  199. 'id' => 'yes',
  200. ),
  201. 'set' => array
  202. (
  203. 'col' => 'yes',
  204. 'time' => 'yes',
  205. 'num' => array('1', '+='),
  206. ),
  207. ),
  208. ),
  209. );