content.php 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <?php
  2. $id = Dever::input('search_option_info_id');
  3. $cate = array();
  4. if ($id) {
  5. $collection = Dever::db('collection/info')->one($id);
  6. $cate = Dever::db('collection/cate')->one($collection['cate_id']);
  7. }
  8. $type_default = 3;
  9. $type_config = Dever::db('collection/cate')->config['gettype'];
  10. if ($cate) {
  11. $type = array();
  12. $cate_type = explode(',', $cate['type']);
  13. $i = 0;
  14. foreach ($cate_type as $k => $v) {
  15. if (isset($type_config[$v])) {
  16. if ($i == 0) {
  17. $type_default = $v;
  18. }
  19. $type[$v] = $type_config[$v];
  20. $i++;
  21. }
  22. }
  23. } else {
  24. $type = $type_config;
  25. }
  26. $id = Dever::input('where_id');
  27. return array
  28. (
  29. # 表名
  30. 'name' => 'content',
  31. # 显示给用户看的名称
  32. 'lang' => '内容管理',
  33. 'menu' => false,
  34. 'gettype' => $type,
  35. 'end' => array
  36. (
  37. 'insert' => 'collection/lib/manage.addContent',
  38. ),
  39. # 数据结构
  40. 'struct' => array
  41. (
  42. 'id' => array
  43. (
  44. 'type' => 'int-11',
  45. 'name' => 'ID',
  46. 'default' => '',
  47. 'desc' => '',
  48. 'match' => 'is_numeric',
  49. //'search' => 'order',
  50. //'list' => true,
  51. ),
  52. 'info_id' => array
  53. (
  54. 'type' => 'int-11',
  55. 'name' => '合集',
  56. 'default' => '',
  57. 'desc' => '合集',
  58. 'match' => 'is_numeric',
  59. 'update' => 'hidden',
  60. 'value' => Dever::input('search_option_info_id')
  61. ),
  62. 'page_id' => array
  63. (
  64. 'type' => 'int-11',
  65. 'name' => '章节',
  66. 'default' => '',
  67. 'desc' => '章节',
  68. 'match' => 'is_numeric',
  69. 'update' => 'hidden',
  70. 'value' => Dever::input('send_page_id')
  71. ),
  72. 'type' => array
  73. (
  74. 'type' => 'varchar-150',
  75. 'name' => '类型',
  76. 'default' => $type_default,
  77. 'desc' => '类型',
  78. 'match' => 'is_numeric',
  79. 'update' => $id ? 'hidden' : 'radio',
  80. 'option' => $type,
  81. ),
  82. 'type_id' => array
  83. (
  84. 'type' => 'int-11',
  85. 'name' => '类型id',
  86. 'default' => '',
  87. 'desc' => '类型id',
  88. 'match' => 'is_numeric',
  89. ),
  90. 'name' => array
  91. (
  92. 'type' => 'varchar-80',
  93. 'name' => '标题',
  94. 'default' => '',
  95. 'desc' => '标题',
  96. 'match' => 'is_string',
  97. 'update' => 'text',
  98. 'list' => true,
  99. //增加预览
  100. 'preview' => true,
  101. ),
  102. 'pic' => array
  103. (
  104. 'type' => 'varchar-150',
  105. 'name' => '封面图-封面图尺寸300*300px,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  106. 'default' => '',
  107. 'desc' => '封面图',
  108. 'match' => 'option',
  109. 'update' => 'image',
  110. 'key' => '1',
  111. 'place' => '300*300',
  112. ),
  113. 'share_title' => array
  114. (
  115. 'type' => 'varchar-100',
  116. 'name' => '分享标题-不填写将使用标题',
  117. 'default' => '',
  118. 'desc' => '分享标题',
  119. 'match' => 'option',
  120. 'update' => 'text',
  121. ),
  122. 'share_pic' => array
  123. (
  124. 'type' => 'text-255',
  125. 'name' => '分享图片-图片尺寸300*300px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式,不传将使用封面图,这里可以上传多张,作为海报使用',
  126. 'default' => '',
  127. 'desc' => '分享图片',
  128. 'match' => 'option',
  129. 'update' => 'images',
  130. 'key' => '1',
  131. 'place' => '300*300',
  132. //'upload' => 'qiniu',
  133. //'large' => true,
  134. ),
  135. 'share_content' => array
  136. (
  137. 'type' => 'varchar-200',
  138. 'name' => '分享内容',
  139. 'default' => '',
  140. 'desc' => '分享内容',
  141. 'match' => 'option',
  142. 'update' => 'textarea',
  143. ),
  144. 'copy_text' => array
  145. (
  146. 'type' => 'text-255',
  147. 'name' => '复制文案',
  148. 'default' => '',
  149. 'desc' => '复制文案',
  150. 'match' => 'is_string',
  151. 'update' => array
  152. (
  153. array
  154. (
  155. 'col' => 'name',
  156. 'name' => '文字内容',
  157. 'default' => '',
  158. 'desc' => '文字内容',
  159. 'match' => 'is_string',
  160. 'update' => 'textarea',
  161. ),
  162. ),
  163. ),
  164. 'reorder' => array
  165. (
  166. 'type' => 'int-11',
  167. 'name' => '页号-数字越小越靠前',
  168. 'default' => '1',
  169. 'desc' => '请输入页号',
  170. 'match' => 'option',
  171. 'update' => 'text',
  172. 'search' => 'order',
  173. 'list' => true,
  174. 'order' => 'asc',
  175. 'edit' => true,
  176. ),
  177. 'state' => array
  178. (
  179. 'type' => 'tinyint-1',
  180. 'name' => '状态',
  181. 'default' => '1',
  182. 'desc' => '请选择状态',
  183. 'match' => 'is_numeric',
  184. ),
  185. 'cdate' => array
  186. (
  187. 'type' => 'int-11',
  188. 'name' => '创建时间',
  189. 'match' => array('is_numeric', time()),
  190. 'desc' => '',
  191. # 只有insert时才生效
  192. 'insert' => true,
  193. //'search' => 'date',
  194. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  195. ),
  196. ),
  197. 'manage' => array
  198. (
  199. 'insert' => false,
  200. 'edit' => false,
  201. //'delete' => false,
  202. 'num' => false,
  203. 'page_list_table' => 'content',
  204. # 自定义快捷新增和编辑
  205. 'button' => array
  206. (
  207. '新增内容' => array('location', 'add'),
  208. '预览' => array('fast', 'main/preview.get?type=4&id=' . Dever::input('search_option_info_id')),
  209. ),
  210. ),
  211. # request 请求接口定义
  212. 'request' => array
  213. (
  214. 'getAllPage' => array
  215. (
  216. # 匹配的正则或函数 选填项
  217. 'option' => array
  218. (
  219. 'info_id' => 'yes',
  220. 'page_id' => 'yes',
  221. 'state' => 1,
  222. ),
  223. 'type' => 'all',
  224. 'order' => array('reorder' => 'asc', 'id' => 'desc'),
  225. //'page' => array(30, 'list'),
  226. 'col' => 'id,type,name,pic,info_id,page_id',
  227. ),
  228. 'getAllByReorder' => array
  229. (
  230. # 匹配的正则或函数 选填项
  231. 'option' => array
  232. (
  233. 'info_id' => 'yes',
  234. 'page_id' => 'yes',
  235. 'state' => 1,
  236. ),
  237. 'type' => 'one',
  238. 'order' => array('reorder' => 'asc', 'id' => 'desc'),
  239. 'col' => '*',
  240. ),
  241. 'child' => array
  242. (
  243. 'option' => array
  244. (
  245. 'state' => 1,
  246. 'page_id' => 'yes',
  247. 'info_id' => 'yes',
  248. 'type_id' => array(1, '>='),
  249. ),
  250. 'type' => 'all',
  251. 'order' => array('reorder' => 'asc', 'id' => 'desc'),
  252. 'col' => '*|page_id|',
  253. ),
  254. )
  255. );