news.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <?php
  2. $status = Dever::config('base')->status;
  3. $author = function()
  4. {
  5. $array = array();
  6. $info = Dever::db('store/author')->state();
  7. if($info)
  8. {
  9. $array += $info;
  10. }
  11. return $array;
  12. };
  13. return array
  14. (
  15. # 表名
  16. 'name' => 'news',
  17. # 显示给用户看的名称
  18. 'lang' => '图文内容',
  19. 'order' => 100,
  20. 'menu' => false,
  21. # 数据结构
  22. 'struct' => array
  23. (
  24. 'id' => array
  25. (
  26. 'type' => 'int-11',
  27. 'name' => 'ID',
  28. 'default' => '',
  29. 'desc' => '',
  30. 'match' => 'is_numeric',
  31. 'list' => true,
  32. ),
  33. 'info_id' => array
  34. (
  35. 'type' => 'int-11',
  36. 'name' => '合集',
  37. 'default' => '',
  38. 'desc' => '合集',
  39. 'match' => 'is_numeric',
  40. 'update' => 'hidden',
  41. 'value' => Dever::input('search_option_info_id')
  42. ),
  43. 'content_id' => array
  44. (
  45. 'type' => 'int-11',
  46. 'name' => '合集内容id',
  47. 'default' => '',
  48. 'desc' => '合集内容id',
  49. 'match' => 'is_numeric',
  50. 'update' => 'hidden',
  51. 'value' => Dever::input('search_option_content_id')
  52. ),
  53. 'name' => array
  54. (
  55. 'type' => 'varchar-80',
  56. 'name' => '标题-图文标题',
  57. 'default' => '',
  58. 'desc' => '标题',
  59. 'match' => 'is_string',
  60. 'update' => 'text',
  61. 'list' => true,
  62. 'search' => 'fulltext',
  63. //增加预览
  64. 'preview' => true,
  65. ),
  66. 'desc' => array
  67. (
  68. 'type' => 'varchar-500',
  69. 'name' => '摘要-图文摘要',
  70. 'default' => '',
  71. 'desc' => '摘要',
  72. 'match' => 'is_string',
  73. 'update' => 'textarea',
  74. ),
  75. 'author_id' => array
  76. (
  77. 'type' => 'int-11',
  78. 'name' => '作者',
  79. 'default' => '1',
  80. 'desc' => '作者',
  81. 'match' => 'is_numeric',
  82. 'update' => 'select',
  83. //'option' => $author,
  84. 'search' => 'select',
  85. 'update_search' => 'store/lib/author.search',
  86. ),
  87. 'pic' => array
  88. (
  89. 'type' => 'varchar-150',
  90. 'name' => '封面图-图片尺寸380*380px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  91. 'default' => '',
  92. 'desc' => '封面图',
  93. 'match' => 'is_string',
  94. 'update' => 'image',
  95. 'key' => '1',
  96. 'place' => '380',
  97. ),
  98. 'pdate' => array
  99. (
  100. 'type' => 'int-11',
  101. 'name' => '发布时间',
  102. 'match' => array('is_numeric', time()),
  103. 'default' => '',
  104. 'desc' => '',
  105. 'update' => 'date',
  106. 'callback' => 'maketime',
  107. 'insert' => true,
  108. //'list' => 'date("Y-m-d H:i:s", {pdate})',
  109. 'auth' => '"{pdate}" > 0',
  110. ),
  111. 'udate' => array
  112. (
  113. 'type' => 'int-11',
  114. 'name' => '更新时间',
  115. 'match' => array('is_numeric', time()),
  116. 'desc' => '',
  117. ),
  118. 'content' => array
  119. (
  120. 'type' => 'text-255',
  121. 'name' => '内容',
  122. 'default' => '',
  123. 'desc' => '请输入内容',
  124. 'match' => 'is_string',
  125. 'update' => 'editor',
  126. 'key' => '1',
  127. ),
  128. 'status' => array
  129. (
  130. 'type' => 'int-11',
  131. 'name' => '发布状态',
  132. 'default' => '1',
  133. 'desc' => '发布状态',
  134. 'match' => 'is_numeric',
  135. //'update' => 'select',
  136. 'option' => $status,
  137. 'search' => 'select',
  138. 'list' => true,
  139. 'edit' => true,
  140. ),
  141. 'reorder' => array
  142. (
  143. 'type' => 'int-11',
  144. 'name' => '排序(数值越大越靠前)',
  145. 'default' => '1',
  146. 'desc' => '请输入排序',
  147. 'match' => 'option',
  148. //'update' => 'text',
  149. 'search' => 'order',
  150. 'list' => true,
  151. 'order' => 'desc',
  152. 'edit' => true,
  153. ),
  154. 'state' => array
  155. (
  156. 'type' => 'tinyint-1',
  157. 'name' => '状态',
  158. 'default' => '1',
  159. 'desc' => '请选择状态',
  160. 'match' => 'is_numeric',
  161. ),
  162. 'cdate' => array
  163. (
  164. 'type' => 'int-11',
  165. 'name' => '录入时间',
  166. 'match' => array('is_numeric', time()),
  167. 'desc' => '',
  168. # 只有insert时才生效
  169. 'insert' => true,
  170. ),
  171. ),
  172. # 管理功能
  173. 'manage' => array
  174. (
  175. ),
  176. # request 请求接口定义
  177. 'request' => array
  178. (
  179. 'getAll' => array
  180. (
  181. # 匹配的正则或函数 选填项
  182. 'option' => array
  183. (
  184. 'info_id' => 'yes',
  185. 'content_id' => 'yes',
  186. 'state' => 1,
  187. ),
  188. 'type' => 'all',
  189. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  190. 'col' => '*',
  191. ),
  192. ),
  193. );