thead.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '正常',
  6. 2 => '删除',
  7. );
  8. return array
  9. (
  10. # 表名
  11. 'name' => 'thead',
  12. # 显示给用户看的名称
  13. 'lang' => '文章管理',
  14. # 后台菜单排序
  15. 'order' => 15,
  16. # 数据结构
  17. 'struct' => array
  18. (
  19. 'id' => array
  20. (
  21. 'type' => 'int-11',
  22. 'name' => '文章ID',
  23. 'default' => '',
  24. 'desc' => '',
  25. 'match' => 'is_numeric',
  26. 'search' => 'order',
  27. 'list' => true,
  28. 'order' => 'desc',
  29. ),
  30. 'site' => array
  31. (
  32. 'type' => 'int-11',
  33. 'name' => '站点',
  34. 'default' => '',
  35. 'desc' => '请输入站点',
  36. 'match' => 'is_numeric',
  37. //'search' => 'order,fulltext',
  38. //'update' => 'text',
  39. //'list' => true,
  40. ),
  41. 'name' => array
  42. (
  43. 'type' => 'varchar-32',
  44. 'name' => '文章标题',
  45. 'default' => '',
  46. 'desc' => '请输入文章标题',
  47. 'match' => 'is_string',
  48. 'update' => 'text',
  49. 'search' => 'order,fulltext',
  50. 'list' => 'Dever::load("weixin/thead.link", {id})',
  51. ),
  52. 'reorder' => array
  53. (
  54. 'type' => 'int-11',
  55. 'name' => '排序(数值越大越靠前)',
  56. 'default' => '1',
  57. 'desc' => '请输入排序',
  58. 'match' => 'option',
  59. 'update' => 'text',
  60. 'search' => 'order',
  61. 'list' => true,
  62. 'order' => 'desc',
  63. ),
  64. 'num_view' => array
  65. (
  66. 'type' => 'int-11',
  67. 'name' => '浏览量pv',
  68. 'default' => '0',
  69. 'desc' => '请填写浏览量pv',
  70. 'match' => 'option',
  71. 'list' => true,
  72. ),
  73. 'author' => array
  74. (
  75. 'type' => 'varchar-80',
  76. 'name' => '文章作者-选填,可为空',
  77. 'default' => '',
  78. 'desc' => '请输入文章作者',
  79. 'match' => 'option',
  80. //'update' => 'text',
  81. //'list' => true,
  82. ),
  83. 'content' => array
  84. (
  85. 'type' => 'text-255',
  86. 'name' => '内容',
  87. 'default' => '',
  88. 'desc' => '请输入内容',
  89. 'match' => 'is_string',
  90. 'update' => 'editor',
  91. 'key' => 1,
  92. ),
  93. 'state' => array
  94. (
  95. 'type' => 'tinyint-1',
  96. 'name' => '状态',
  97. 'default' => '1',
  98. 'desc' => '请选择状态',
  99. 'match' => 'is_numeric',
  100. 'option' => $option,
  101. 'update' => 'radio',
  102. ),
  103. 'cdate' => array
  104. (
  105. 'type' => 'int-11',
  106. 'name' => '录入时间',
  107. 'match' => array('is_numeric', time()),
  108. 'desc' => '',
  109. # 只有insert时才生效
  110. 'insert' => true,
  111. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  112. ),
  113. ),
  114. 'auth' => 'site',
  115. # request 请求接口定义
  116. 'request' => array
  117. (
  118. 'info' => array
  119. (
  120. 'where' => array
  121. (
  122. 'id' => 'yes',
  123. 'site' => 'yes',
  124. ),
  125. 'type' => 'all',
  126. 'order' => array('reorder` desc,`id', 'desc'),
  127. 'limit' => array(1,0),
  128. //'page' => array(15, 'list'),
  129. # *为读取的字段,id为以这个字段为索引
  130. 'col' => '*|id',
  131. ),
  132. 'get' => array
  133. (
  134. # 匹配的正则或函数 选填项
  135. 'option' => array
  136. (
  137. 'id' => 'yes',
  138. 'site' => 'yes',
  139. ),
  140. 'type' => 'all',
  141. 'order' => array('reorder` desc,`id', 'desc'),
  142. 'limit' => array(5, 0),
  143. 'col' => '*',
  144. ),
  145. # 更新浏览量
  146. 'addView' => array
  147. (
  148. 'type' => 'update',
  149. 'where' => array
  150. (
  151. 'id' => 'yes',
  152. 'site' => 'yes',
  153. ),
  154. 'set' => array
  155. (
  156. 'num_view' => array('1', '+='),
  157. ),
  158. ),
  159. ),
  160. );