page.php 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <?php
  2. $info_id = Dever::input('search_option_info_id');
  3. $page_id = Dever::input('option_page_id', -1);
  4. $page = function() use ($info_id)
  5. {
  6. $array = array
  7. (
  8. //-1 => array('id' => '-1', 'name' => '父级章节'),
  9. );
  10. $info = Dever::db('collection/page')->state(array('info_id' => $info_id, 'page_id' => -1));
  11. if($info)
  12. {
  13. $array += $info;
  14. }
  15. return $array;
  16. };
  17. $times = function() use ($info_id)
  18. {
  19. $array = array
  20. (
  21. -1 => array('id' => '-1', 'name' => '不选择'),
  22. );
  23. $info = Dever::db('collection/times')->mainAll(array('info_id' => $info_id));
  24. if($info)
  25. {
  26. $array += $info;
  27. }
  28. return $array;
  29. };
  30. $times_child = function() use ($info_id)
  31. {
  32. $info = Dever::db('collection/times')->childAll(array('info_id' => $info_id));
  33. return $info;
  34. };
  35. # 搜索
  36. $search_times = function() use ($info_id)
  37. {
  38. $array = array
  39. (
  40. -1 => array('id' => '-1', 'name' => '所有时光'),
  41. );
  42. $info = Dever::load('collection/lib/times')->all();
  43. if($info)
  44. {
  45. $array += $info;
  46. }
  47. return $array;
  48. };
  49. $bgmusic_autoplay = array
  50. (
  51. 1 => '自动播放',
  52. 2 => '不自动播放',
  53. );
  54. return array
  55. (
  56. # 表名
  57. 'name' => 'page',
  58. # 显示给用户看的名称
  59. 'lang' => '章节管理',
  60. # 是否显示在后台菜单
  61. 'order' => 1,
  62. 'menu' => false,
  63. # 数据结构
  64. 'struct' => array
  65. (
  66. 'id' => array
  67. (
  68. 'type' => 'int-11',
  69. 'name' => 'ID',
  70. 'default' => '',
  71. 'desc' => '',
  72. 'match' => 'is_numeric',
  73. 'order' => 'asc',
  74. 'list' => true,
  75. ),
  76. 'info_id' => array
  77. (
  78. 'type' => 'int-11',
  79. 'name' => '合集',
  80. 'default' => '',
  81. 'desc' => '合集',
  82. 'match' => 'is_numeric',
  83. 'update' => 'hidden',
  84. 'search' => 'hidden',
  85. 'value' => $info_id
  86. ),
  87. 'source_id' => array
  88. (
  89. 'type' => 'int-11',
  90. 'name' => '来源id-一般为采集器的采集规则id,用以区分导入的数据是否重复',
  91. 'default' => '-1',
  92. 'desc' => '来源id',
  93. 'match' => 'is_numeric',
  94. ),
  95. 'name' => array
  96. (
  97. 'type' => 'varchar-150',
  98. 'name' => '章节名称',
  99. 'default' => '',
  100. 'desc' => '章节名称',
  101. 'match' => 'is_string',
  102. 'update' => 'text',
  103. 'search' => 'fulltext',
  104. 'list' => true,
  105. 'edit' => true,
  106. ),
  107. 'times_id_parent' => array
  108. (
  109. 'type' => 'int-11',
  110. 'name' => '父级时光',
  111. 'default' => '0',
  112. 'desc' => '请选择父级时光',
  113. 'match' => 'is_numeric',
  114. 'update' => 'select',
  115. 'option' => $times,
  116. # 当值改变时,执行下一步操作
  117. 'child_name' => 'times_id',
  118. 'child' => $times_child,
  119. 'child_value' => '{times_id}',
  120. ),
  121. 'times_id' => array
  122. (
  123. 'type' => 'int-11',
  124. 'name' => '子时光',
  125. 'default' => '0',
  126. 'desc' => '请选择子时光',
  127. 'match' => 'is_numeric',
  128. 'search' => 'group',
  129. 'option' => $search_times,
  130. 'list_name' => '时光',
  131. 'list' => '{times_id} > 0 ? Dever::load("collection/lib/times.getName", {times_id}, {times_id_parent}) : "无"',
  132. ),
  133. 'page_id' => array
  134. (
  135. 'type' => 'int-11',
  136. 'name' => '上级章节',
  137. 'default' => $page_id,
  138. 'desc' => '请选择上级章节',
  139. 'match' => 'is_numeric',
  140. 'update' => $page_id < 0 ? 'hidden': 'select',
  141. 'option' => $page,
  142. //'value' => $page_id,
  143. 'list' => '{page_id} > 0 ? Dever::load("collection/page-one#name", {page_id}) : "主章节"',
  144. ),
  145. 'bgmusic' => array
  146. (
  147. 'type' => 'varchar-800',
  148. 'name' => '背景音乐-音频格式mp3,上传大小不能超过100M',
  149. 'default' => '',
  150. 'desc' => '背景音乐',
  151. 'match' => 'option',
  152. 'update' => 'upload',
  153. 'key' => '2',
  154. 'place' => '150',
  155. 'upload' => 'yun',
  156. 'large' => true,
  157. ),
  158. 'bgmusic_autoplay' => array
  159. (
  160. 'type' => 'tinyint-1',
  161. 'name' => '背景音乐自动播放',
  162. 'default' => '1',
  163. 'desc' => '背景音乐自动播放',
  164. 'match' => 'option',
  165. 'update' => 'radio',
  166. 'option' => $bgmusic_autoplay,
  167. ),
  168. 'pic' => array
  169. (
  170. 'type' => 'varchar-150',
  171. 'name' => '图片-章节图片,一般作为开头的封面图片,尺寸为330*330px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  172. 'default' => '',
  173. 'desc' => '章节图片',
  174. 'match' => 'option',
  175. 'update' => $page_id < 0 ? 'hidden': 'image',
  176. 'key' => '1',
  177. 'place' => '330*330',
  178. ),
  179. 'desc' => array
  180. (
  181. 'type' => 'varchar-800',
  182. 'name' => '描述-添加描述将展示封面',
  183. 'default' => '',
  184. 'desc' => '描述',
  185. 'match' => 'option',
  186. 'update' => 'textarea',
  187. 'update' => $page_id < 0 ? 'hidden': 'textarea',
  188. //'list' => true,
  189. ),
  190. 'desc_end' => array
  191. (
  192. 'type' => 'varchar-800',
  193. 'name' => '完结描述-添加完结描述将展示在本章节末尾',
  194. 'default' => '',
  195. 'desc' => '描述',
  196. 'match' => 'option',
  197. 'update' => 'textarea',
  198. 'update' => $page_id < 0 ? 'hidden': 'textarea',
  199. //'list' => true,
  200. ),
  201. 'pic_end' => array
  202. (
  203. 'type' => 'varchar-150',
  204. 'name' => '完结图片-章节图片,一般作为结尾的封面图片,尺寸为330*330px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  205. 'default' => '',
  206. 'desc' => '完结图片',
  207. 'match' => 'option',
  208. 'update' => $page_id < 0 ? 'hidden': 'image',
  209. 'key' => '1',
  210. 'place' => '330*330',
  211. ),
  212. 'reorder' => array
  213. (
  214. 'type' => 'int-11',
  215. 'name' => '排序(数值越小越靠前)',
  216. 'default' => '1',
  217. 'desc' => '请输入排序',
  218. 'match' => 'option',
  219. 'update' => 'text',
  220. 'search' => 'order',
  221. 'list_name' => '排序',
  222. 'list' => true,
  223. 'order' => 'asc',
  224. 'edit' => true,
  225. ),
  226. 'state' => array
  227. (
  228. 'type' => 'tinyint-1',
  229. 'name' => '状态',
  230. 'default' => '1',
  231. 'desc' => '请选择状态',
  232. 'match' => 'is_numeric',
  233. ),
  234. 'cdate' => array
  235. (
  236. 'type' => 'int-11',
  237. 'name' => '录入时间',
  238. 'match' => array('is_numeric', time()),
  239. 'desc' => '',
  240. # 只有insert时才生效
  241. 'insert' => true,
  242. 'order' => 'asc',
  243. //'search' => 'date',
  244. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  245. ),
  246. ),
  247. 'manage' => array
  248. (
  249. 'edit' => false,
  250. 'button' => array
  251. (
  252. '时光配置' => array('location', 'manage/project/database/list&project=collection&oper_table=page&top_table=info&top_project=collection&table=times&search_option_info_id=' . $info_id . '&search_option_state=1'),
  253. ),
  254. # 列表页的类型
  255. 'list_type' => 'tree',
  256. 'list_button' => array
  257. (
  258. //'update' => '编辑',
  259. 'update' => array('编辑', '"page&option_page_id={page_id}"'),
  260. 'add' => array('新增子章节', '"{page_id}" == -1 ? "page&option_page_id={id}" : "page&option_page_id={page_id},{id}"', '{page_id} == -1'),
  261. 'list' => array('内容管理', '"content&search_option_info_id={info_id}&send_page_id={id}&oper_table=page&top_table=info&top_project=collection&page_type=1"' , '{page_id} > 0'),
  262. 'delete' => '删除',
  263. ),
  264. ),
  265. 'request' => array
  266. (
  267. 'child' => array
  268. (
  269. 'option' => array
  270. (
  271. 'state' => 1,
  272. 'page_id' => array(1, '>='),
  273. 'info_id' => 'yes',
  274. 'times_id' => 'yes',
  275. ),
  276. 'type' => 'all',
  277. 'order' => array('reorder' => 'asc', 'id' => 'asc'),
  278. 'col' => '*',
  279. ),
  280. 'main' => array
  281. (
  282. 'option' => array
  283. (
  284. 'state' => 1,
  285. 'page_id' => -1,
  286. 'info_id' => 'yes',
  287. 'times_id' => 'yes',
  288. ),
  289. 'type' => 'all',
  290. 'order' => array('reorder' => 'asc', 'id' => 'asc'),
  291. 'col' => '*',
  292. ),
  293. 'getOne' => array
  294. (
  295. 'option' => array
  296. (
  297. 'page_id' => array(1, '>='),
  298. 'info_id' => 'yes',
  299. 'times_id' => 'yes',
  300. 'state' => 1,
  301. ),
  302. 'type' => 'one',
  303. 'order' => array('reorder' => 'asc', 'id' => 'asc'),
  304. 'col' => '*',
  305. ),
  306. 'getNew' => array
  307. (
  308. # 匹配的正则或函数 选填项
  309. 'option' => array
  310. (
  311. 'info_id' => 'yes',
  312. 'page_id' => 'yes',
  313. 'state' => 1,
  314. ),
  315. 'type' => 'one',
  316. 'order' => array('reorder' => 'desc', 'cdate' => 'desc'),
  317. 'col' => '*',
  318. ),
  319. )
  320. );