content.php 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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. 'order' => 'asc',
  52. ),
  53. 'info_id' => array
  54. (
  55. 'type' => 'int-11',
  56. 'name' => '合集',
  57. 'default' => '',
  58. 'desc' => '合集',
  59. 'match' => 'is_numeric',
  60. 'update' => 'hidden',
  61. 'value' => Dever::input('search_option_info_id')
  62. ),
  63. 'source_id' => array
  64. (
  65. 'type' => 'int-11',
  66. 'name' => '来源id-一般为采集器的采集规则id,用以区分导入的数据是否重复',
  67. 'default' => '-1',
  68. 'desc' => '来源id',
  69. 'match' => 'is_numeric',
  70. ),
  71. 'page_id' => array
  72. (
  73. 'type' => 'int-11',
  74. 'name' => '章节',
  75. 'default' => '',
  76. 'desc' => '章节',
  77. 'match' => 'is_numeric',
  78. 'update' => 'hidden',
  79. 'value' => Dever::input('send_page_id')
  80. ),
  81. 'type' => array
  82. (
  83. 'type' => 'varchar-150',
  84. 'name' => '类型',
  85. 'default' => $type_default,
  86. 'desc' => '类型',
  87. 'match' => 'is_numeric',
  88. 'update' => $id ? 'hidden' : 'radio',
  89. 'option' => $type,
  90. ),
  91. 'type_id' => array
  92. (
  93. 'type' => 'int-11',
  94. 'name' => '类型id',
  95. 'default' => '',
  96. 'desc' => '类型id',
  97. 'match' => 'is_numeric',
  98. ),
  99. 'name' => array
  100. (
  101. 'type' => 'varchar-80',
  102. 'name' => '标题',
  103. 'default' => '',
  104. 'desc' => '标题',
  105. 'match' => 'is_string',
  106. 'update' => 'text',
  107. 'list' => true,
  108. //增加预览
  109. 'preview' => true,
  110. ),
  111. 'pic' => array
  112. (
  113. 'type' => 'varchar-150',
  114. 'name' => '封面图-封面图尺寸300*300px,如果未上传,则自动使用内容中的图片,自动进行裁剪,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  115. 'default' => '',
  116. 'desc' => '封面图',
  117. 'match' => 'option',
  118. 'update' => 'image',
  119. 'key' => '1',
  120. 'place' => '300*300',
  121. ),
  122. 'share_title' => array
  123. (
  124. 'type' => 'varchar-100',
  125. 'name' => '分享标题-不填写将使用标题',
  126. 'default' => '',
  127. 'desc' => '分享标题',
  128. 'match' => 'option',
  129. 'update' => 'text',
  130. ),
  131. 'share_pic' => array
  132. (
  133. 'type' => 'text-255',
  134. 'name' => '分享图片-图片尺寸300*300px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式,不传将使用封面图,这里可以上传多张,作为海报使用',
  135. 'default' => '',
  136. 'desc' => '分享图片',
  137. 'match' => 'option',
  138. 'update' => 'images',
  139. 'key' => '1',
  140. 'place' => '300*300',
  141. //'upload' => 'qiniu',
  142. //'large' => true,
  143. ),
  144. 'share_content' => array
  145. (
  146. 'type' => 'varchar-200',
  147. 'name' => '分享内容',
  148. 'default' => '',
  149. 'desc' => '分享内容',
  150. 'match' => 'option',
  151. 'update' => 'textarea',
  152. ),
  153. 'copy_text' => array
  154. (
  155. 'type' => 'text-255',
  156. 'name' => '复制文案',
  157. 'default' => '',
  158. 'desc' => '复制文案',
  159. 'match' => 'is_string',
  160. 'update' => array
  161. (
  162. array
  163. (
  164. 'col' => 'name',
  165. 'name' => '文字内容',
  166. 'default' => '',
  167. 'desc' => '文字内容',
  168. 'match' => 'is_string',
  169. 'update' => 'textarea',
  170. ),
  171. ),
  172. ),
  173. 'reorder' => array
  174. (
  175. 'type' => 'int-11',
  176. 'name' => '页号-数字越小越靠前',
  177. 'default' => '1',
  178. 'desc' => '请输入页号',
  179. 'match' => 'option',
  180. 'update' => 'text',
  181. 'search' => 'order',
  182. 'list' => true,
  183. 'order' => 'asc',
  184. 'edit' => true,
  185. ),
  186. 'state' => array
  187. (
  188. 'type' => 'tinyint-1',
  189. 'name' => '状态',
  190. 'default' => '1',
  191. 'desc' => '请选择状态',
  192. 'match' => 'is_numeric',
  193. ),
  194. 'cdate' => array
  195. (
  196. 'type' => 'int-11',
  197. 'name' => '创建时间',
  198. 'match' => array('is_numeric', time()),
  199. 'desc' => '',
  200. # 只有insert时才生效
  201. 'insert' => true,
  202. //'search' => 'date',
  203. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  204. ),
  205. ),
  206. 'manage' => array
  207. (
  208. 'insert' => false,
  209. 'edit' => false,
  210. //'delete' => false,
  211. 'num' => false,
  212. 'page_list_table' => 'content',
  213. # 自定义快捷新增和编辑
  214. 'button' => array
  215. (
  216. '新增内容' => array('location', 'add'),
  217. '预览' => array('fast', 'main/preview.get?type=4&id=' . Dever::input('search_option_info_id')),
  218. ),
  219. ),
  220. # request 请求接口定义
  221. 'request' => array
  222. (
  223. 'getAllPage' => array
  224. (
  225. # 匹配的正则或函数 选填项
  226. 'option' => array
  227. (
  228. 'info_id' => 'yes',
  229. 'page_id' => 'yes',
  230. 'state' => 1,
  231. ),
  232. 'type' => 'all',
  233. 'order' => array('reorder' => 'asc', 'id' => 'desc'),
  234. //'page' => array(30, 'list'),
  235. 'col' => 'id,type,name,pic,info_id,page_id',
  236. ),
  237. 'getAllByReorder' => array
  238. (
  239. # 匹配的正则或函数 选填项
  240. 'option' => array
  241. (
  242. 'info_id' => 'yes',
  243. 'page_id' => 'yes',
  244. 'state' => 1,
  245. ),
  246. 'type' => 'one',
  247. 'order' => array('reorder' => 'asc', 'id' => 'desc'),
  248. 'col' => '*',
  249. ),
  250. 'child' => array
  251. (
  252. 'option' => array
  253. (
  254. 'state' => 1,
  255. 'page_id' => 'yes',
  256. 'info_id' => 'yes',
  257. 'type_id' => array(1, '>='),
  258. ),
  259. 'type' => 'all',
  260. 'order' => array('reorder' => 'asc', 'id' => 'desc'),
  261. 'col' => '*|page_id|',
  262. ),
  263. 'getNew' => array
  264. (
  265. # 匹配的正则或函数 选填项
  266. 'option' => array
  267. (
  268. 'info_id' => 'yes',
  269. 'page_id' => 'yes',
  270. 'state' => 1,
  271. ),
  272. 'type' => 'one',
  273. 'order' => array('page_id' => 'desc','reorder' => 'desc', 'cdate' => 'desc'),
  274. 'col' => '*',
  275. ),
  276. )
  277. );