news.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <?php
  2. $status = Dever::config('base')->status;
  3. # 每页的数据量
  4. $page = 10;
  5. $share = array
  6. (
  7. 1 => '显示',
  8. 2 => '不显示',
  9. );
  10. $template = array
  11. (
  12. 1 => '图文',
  13. 2 => '视频',
  14. );
  15. # 常用的col
  16. $col = '*';
  17. return array
  18. (
  19. # 表名
  20. 'name' => 'news',
  21. # 显示给用户看的名称
  22. 'lang' => '文章管理',
  23. 'order' => 100,
  24. # 数据结构
  25. 'struct' => array
  26. (
  27. 'id' => array
  28. (
  29. 'type' => 'int-11',
  30. 'name' => 'ID',
  31. 'default' => '',
  32. 'desc' => '',
  33. 'match' => 'is_numeric',
  34. 'list' => true,
  35. ),
  36. 'name' => array
  37. (
  38. 'type' => 'varchar-80',
  39. 'name' => '标题-文章标题,同时也用于分享标题',
  40. 'default' => '',
  41. 'desc' => '标题',
  42. 'match' => 'is_string',
  43. 'update' => 'text',
  44. 'list' => true,
  45. 'search' => 'fulltext',
  46. //增加预览
  47. 'preview' => true,
  48. ),
  49. 'desc' => array
  50. (
  51. 'type' => 'varchar-500',
  52. 'name' => '摘要-文章摘要,同时也用于分享内容',
  53. 'default' => '',
  54. 'desc' => '摘要',
  55. 'match' => 'is_string',
  56. 'update' => 'textarea',
  57. ),
  58. 'cover' => array
  59. (
  60. 'type' => 'varchar-150',
  61. 'name' => '封面图',
  62. 'default' => '',
  63. 'desc' => '封面图',
  64. 'match' => 'option',
  65. 'update' => 'image',
  66. 'key' => '1',
  67. 'place' => '300*300',
  68. ),
  69. 'content' => array
  70. (
  71. 'type' => 'text-255',
  72. 'name' => '内容',
  73. 'default' => '',
  74. 'desc' => '请输入内容',
  75. 'match' => 'is_string',
  76. 'update' => 'editor',
  77. 'key' => '1',
  78. ),
  79. 'reorder' => array
  80. (
  81. 'type' => 'int-11',
  82. 'name' => '排序-数值越大越靠前,相当于置顶',
  83. 'default' => '1',
  84. 'desc' => '请输入排序',
  85. 'match' => 'option',
  86. //'update' => 'text',
  87. 'search' => 'order',
  88. 'list' => true,
  89. 'order' => 'desc',
  90. 'edit' => true,
  91. ),
  92. 'state' => array
  93. (
  94. 'type' => 'tinyint-1',
  95. 'name' => '状态',
  96. 'default' => '1',
  97. 'desc' => '请选择状态',
  98. 'match' => 'is_numeric',
  99. ),
  100. 'cdate' => array
  101. (
  102. 'type' => 'int-11',
  103. 'name' => '录入时间',
  104. 'match' => array('is_numeric', time()),
  105. 'desc' => '',
  106. # 只有insert时才生效
  107. 'insert' => true,
  108. ),
  109. ),
  110. # 管理功能
  111. 'manage' => array
  112. (
  113. //'insert' => false,
  114. # 列表
  115. 'list_button' => array
  116. (
  117. //'edit' => array('预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=1'))),
  118. ),
  119. ),
  120. # request 请求接口定义
  121. 'request' => array
  122. (
  123. 'search' => array
  124. (
  125. # 匹配的正则或函数 选填项
  126. 'option' => array
  127. (
  128. 'ids' => array('yes-id', 'in'),
  129. 'cate_id' => 'yes',
  130. 'name' => array('yes', 'like'),
  131. 'id' => 'yes',
  132. 'state' => 1,
  133. ),
  134. 'type' => 'all',
  135. 'order' => array('reorder' => 'desc', 'cdate' => 'desc'),
  136. 'limit' => '0,10',
  137. 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
  138. ),
  139. ),
  140. );