opt.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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::load('manage/project.get');
  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['lib'];
  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.php中添加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. 'status' => array
  136. (
  137. 'type' => 'tinyint-1',
  138. 'name' => '是否建立索引',
  139. 'default' => '1',
  140. 'desc' => '请选择是否建立索引',
  141. 'match' => 'is_numeric',
  142. 'option' => $status,
  143. 'update' => 'radio',
  144. //'list' => true,
  145. ),
  146. 'state' => array
  147. (
  148. 'type' => 'tinyint-1',
  149. 'name' => '数据是否存在',
  150. 'default' => '1',
  151. 'desc' => '请选择数据是否存在',
  152. 'match' => 'is_numeric',
  153. 'option' => $option,
  154. 'update' => 'radio',
  155. //'list' => true,
  156. ),
  157. 'cdate' => array
  158. (
  159. 'type' => 'int-11',
  160. 'name' => '录入时间',
  161. 'match' => array('is_numeric', time()),
  162. 'desc' => '',
  163. # 只有insert时才生效
  164. 'insert' => true,
  165. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  166. ),
  167. ),
  168. 'manage' => array
  169. (
  170. 'edit' => false,
  171. 'insert' => false,
  172. 'button' => array
  173. (
  174. '生成数据结构文档' => Dever::url('doc/view?type=db', 'manage'),
  175. 'Mysql规范和建议' => Dever::url('doc/view?type=mysql', 'manage'),
  176. //'全部清空' => 'manage/menu.delete',
  177. )
  178. ),
  179. # request 请求接口定义
  180. 'request' => array
  181. (
  182. 'updateNum' => array
  183. (
  184. 'type' => 'update',
  185. 'where' => array
  186. (
  187. 'id' => 'yes',
  188. ),
  189. 'set' => array
  190. (
  191. 'col' => 'yes',
  192. 'num' => array('1', '+='),
  193. ),
  194. ),
  195. ),
  196. );