news.php 4.5 KB

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