opt.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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. 'menu' => false,
  48. # 数据结构
  49. 'struct' => array
  50. (
  51. 'id' => array
  52. (
  53. 'type' => 'int-11',
  54. 'name' => 'ID',
  55. 'default' => '',
  56. 'desc' => '',
  57. 'match' => 'is_numeric',
  58. 'search' => 'order',
  59. //'list' => true,
  60. ),
  61. 'project' => array
  62. (
  63. 'type' => 'varchar-30',
  64. 'name' => '项目',
  65. 'default' => '',
  66. 'desc' => '请选择项目',
  67. 'match' => 'is_string',
  68. 'update' => 'select',
  69. 'search' => 'select',
  70. 'option' => $project,
  71. 'list' => true,
  72. ),
  73. 'table' => array
  74. (
  75. 'type' => 'varchar-30',
  76. 'name' => '数据表-请输入表的英文名',
  77. 'default' => '',
  78. 'desc' => '请选择数据表',
  79. 'match' => 'is_string',
  80. 'update' => 'text',
  81. 'search' => 'fulltext',
  82. 'list' => 'Dever::load("manage/opt.get#table", {id})',
  83. ),
  84. 'method' => array
  85. (
  86. 'type' => 'varchar-32',
  87. 'name' => '所属方法名',
  88. 'default' => '',
  89. 'desc' => '请输入所属方法名',
  90. 'match' => 'option',
  91. //'update' => 'text',
  92. //'search' => 'fulltext',
  93. //'list' => true,
  94. ),
  95. 'col' => array
  96. (
  97. 'type' => 'varchar-500',
  98. 'name' => '使用的字段',
  99. 'default' => '',
  100. 'desc' => '请选择字段',
  101. 'match' => 'is_string',
  102. 'update' => 'text',
  103. 'search' => 'fulltext',
  104. 'list' => 'Dever::load("manage/opt.get#text", {id})',
  105. 'list_name' => '分析优化',
  106. ),
  107. 'col_index' => array
  108. (
  109. 'type' => 'varchar-500',
  110. 'name' => '建立索引的字段',
  111. 'default' => '',
  112. 'desc' => '请选择建立索引的字段',
  113. 'match' => 'is_string',
  114. 'update' => 'text',
  115. ),
  116. 'version' => array
  117. (
  118. 'type' => 'int-11',
  119. 'name' => '版本号',
  120. 'default' => '0',
  121. 'desc' => '版本号',
  122. 'match' => 'is_numeric',
  123. 'update' => 'text',
  124. ),
  125. 'num' => array
  126. (
  127. 'type' => 'int-11',
  128. 'name' => '执行次数',
  129. 'default' => '0',
  130. 'match' => 'is_numeric',
  131. 'desc' => '执行次数',
  132. 'update' => 'text',
  133. 'search' => 'order',
  134. 'list' => true,
  135. ),
  136. 'time' => array
  137. (
  138. 'type' => 'varchar-30',
  139. 'name' => '执行时间',
  140. 'default' => '0',
  141. 'match' => 'is_string',
  142. 'desc' => '执行时间',
  143. 'update' => 'text',
  144. 'search' => 'order',
  145. 'list' => true,
  146. ),
  147. 'status' => array
  148. (
  149. 'type' => 'tinyint-1',
  150. 'name' => '是否建立索引',
  151. 'default' => '1',
  152. 'desc' => '请选择是否建立索引',
  153. 'match' => 'is_numeric',
  154. 'option' => $status,
  155. 'update' => 'radio',
  156. //'list' => true,
  157. ),
  158. 'state' => array
  159. (
  160. 'type' => 'tinyint-1',
  161. 'name' => '数据是否存在',
  162. 'default' => '1',
  163. 'desc' => '请选择数据是否存在',
  164. 'match' => 'is_numeric',
  165. 'option' => $option,
  166. 'update' => 'radio',
  167. //'list' => true,
  168. ),
  169. 'cdate' => array
  170. (
  171. 'type' => 'int-11',
  172. 'name' => '录入时间',
  173. 'match' => array('is_numeric', time()),
  174. 'desc' => '',
  175. # 只有insert时才生效
  176. 'insert' => true,
  177. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  178. ),
  179. ),
  180. 'manage' => array
  181. (
  182. 'edit' => false,
  183. 'insert' => false,
  184. 'delete' => false,
  185. 'button' => array
  186. (
  187. '生成数据结构文档' => Dever::url('doc/view?type=db', 'manage'),
  188. 'Mysql规范和建议' => Dever::url('doc/view?type=mysql', 'manage'),
  189. //'全部清空' => 'manage/menu.delete',
  190. )
  191. ),
  192. # request 请求接口定义
  193. 'request' => array
  194. (
  195. 'updateNum' => array
  196. (
  197. 'type' => 'update',
  198. 'where' => array
  199. (
  200. 'id' => 'yes',
  201. ),
  202. 'set' => array
  203. (
  204. 'col' => 'yes',
  205. 'time' => 'yes',
  206. 'num' => array('yes', '+='),
  207. ),
  208. ),
  209. ),
  210. );