content.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. <?php
  2. $id = Dever::input('search_option_info_id');
  3. $cate = array();
  4. if ($id) {
  5. $journal = Dever::db('journal/info')->one($id);
  6. $cate = Dever::db('journal/cate')->one($journal['cate_id']);
  7. }
  8. $type_config = array
  9. (
  10. # 默认类型
  11. 3 => '图文内容',
  12. 1 => '全屏图',
  13. 2 => '长图',
  14. # 2018-12-11 增加3个类型
  15. 4 => '全屏视频',
  16. 5 => '留言视频',
  17. 6 => '留言音频',
  18. # 关联类型 > 10
  19. 11 => '关联图文',
  20. 12 => '关联视频',
  21. 13 => '关联直播',
  22. );
  23. $type_default = 3;
  24. if ($cate) {
  25. $type = array();
  26. $cate_type = explode(',', $cate['type']);
  27. $i = 0;
  28. foreach ($cate_type as $k => $v) {
  29. if (isset($type_config[$v])) {
  30. if ($i == 0) {
  31. $type_default = $v;
  32. }
  33. $type[$v] = $type_config[$v];
  34. $i++;
  35. }
  36. }
  37. } else {
  38. $type = $type_config;
  39. }
  40. $is_button = array
  41. (
  42. 1 => '显示',
  43. 2 => '不显示',
  44. );
  45. $text = array
  46. (
  47. 1 => '上左',
  48. 2 => '上中',
  49. 3 => '上右',
  50. 4 => '中左',
  51. 5 => '正中',
  52. 6 => '中右',
  53. 7 => '下左',
  54. 8 => '下中',
  55. 9 => '下右',
  56. //10 => '自定义',
  57. );
  58. $bgcolor_type = array
  59. (
  60. 1 => '设置背景颜色',
  61. 2 => '不设置背景颜色',
  62. );
  63. $author = function()
  64. {
  65. $array = array();
  66. $info = Dever::db('content/author')->state();
  67. if($info)
  68. {
  69. $array += $info;
  70. }
  71. return $array;
  72. };
  73. return array
  74. (
  75. # 表名
  76. 'name' => 'content',
  77. # 显示给用户看的名称
  78. 'lang' => '内页管理',
  79. 'menu' => false,
  80. 'gettype' => $type,
  81. 'text' => $text,
  82. 'end' => array
  83. (
  84. 'insert' => 'journal/lib/manage.addContent',
  85. ),
  86. # 数据结构
  87. 'struct' => array
  88. (
  89. 'id' => array
  90. (
  91. 'type' => 'int-11',
  92. 'name' => 'ID',
  93. 'default' => '',
  94. 'desc' => '',
  95. 'match' => 'is_numeric',
  96. //'search' => 'order',
  97. //'list' => true,
  98. ),
  99. 'info_id' => array
  100. (
  101. 'type' => 'int-11',
  102. 'name' => '小刊',
  103. 'default' => '',
  104. 'desc' => '小刊',
  105. 'match' => 'is_numeric',
  106. 'update' => 'hidden',
  107. 'value' => Dever::input('search_option_info_id')
  108. ),
  109. 'type' => array
  110. (
  111. 'type' => 'int-11',
  112. 'name' => '类型',
  113. 'default' => $type_default,
  114. 'desc' => '类型',
  115. 'match' => 'is_numeric',
  116. 'update' => 'radio',
  117. 'option' => $type,
  118. 'control' => 'type',
  119. ),
  120. 'name' => array
  121. (
  122. 'type' => 'varchar-80',
  123. 'name' => '标题',
  124. 'default' => '',
  125. 'desc' => '标题',
  126. 'match' => 'is_string',
  127. 'update' => 'text',
  128. 'list' => true,
  129. //增加预览
  130. 'preview' => true,
  131. 'show' => 'type=3,5,6',
  132. ),
  133. 'video' => array
  134. (
  135. 'type' => 'varchar-800',
  136. 'name' => '上传视频-视频格式mp4,mov,上传大小不能超过4G',
  137. 'default' => '',
  138. 'desc' => '上传点播视频',
  139. 'match' => 'is_string',
  140. 'update' => 'upload',
  141. 'key' => '3',
  142. 'place' => '150',
  143. 'upload' => 'qiniu',
  144. 'large' => true,
  145. //不覆盖原文件,生成新文件
  146. 'cover' => 2,
  147. 'show' => 'type=4,5',
  148. ),
  149. 'music' => array
  150. (
  151. 'type' => 'varchar-800',
  152. 'name' => '上传音频-视频格式mp3,上传大小不能超过100M',
  153. 'default' => '',
  154. 'desc' => '上传音频',
  155. 'match' => 'is_string',
  156. 'update' => 'upload',
  157. 'key' => '2',
  158. 'place' => '150',
  159. 'upload' => 'qiniu',
  160. 'large' => true,
  161. //不覆盖原文件,生成新文件
  162. 'cover' => 2,
  163. 'show' => 'type=6',
  164. ),
  165. 'cover' => array
  166. (
  167. 'type' => 'varchar-150',
  168. 'name' => '封面图-全屏视频的封面图图片尺寸750*1386px或等比尺寸,留言视频的封面图图片尺寸750*422px或等比尺寸,留言音频的封面图图片尺寸750*422px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  169. 'default' => '',
  170. 'desc' => '封面图',
  171. 'match' => 'option',
  172. 'update' => 'image',
  173. 'key' => '1',
  174. 'place' => '150',
  175. 'show' => 'type=4,5,6',
  176. ),
  177. 'focus' => array
  178. (
  179. 'type' => 'text-255',
  180. 'name' => '焦点图',
  181. 'default' => '',
  182. 'desc' => '焦点图',
  183. 'match' => 'option',
  184. 'update' => 'image',
  185. 'key' => '1',
  186. 'place' => '150',
  187. 'show' => 'type=3',
  188. ),
  189. 'author_id' => array
  190. (
  191. 'type' => 'int-11',
  192. 'name' => '作者',
  193. 'default' => '1',
  194. 'desc' => '作者',
  195. 'match' => 'is_numeric',
  196. 'update' => 'select',
  197. 'option' => $author,
  198. //'search' => 'select',
  199. 'show' => 'type=3',
  200. ),
  201. 'content' => array
  202. (
  203. 'type' => 'text-255',
  204. 'name' => '内容',
  205. 'default' => '',
  206. 'desc' => '请输入内容',
  207. 'match' => 'is_string',
  208. 'update' => 'editor',
  209. 'show' => 'type=3',
  210. //自定义编辑器右侧按钮
  211. 'editor' => array
  212. (
  213. 'name' => '选择插入模块',
  214. 'button' => array
  215. (
  216. array
  217. (
  218. # 名称
  219. 'name' => '图片',
  220. # 资源库id
  221. 'key' => 1,
  222. # 类型
  223. 'type' => 'image',
  224. ),
  225. array
  226. (
  227. 'name' => '音频',
  228. 'key' => 2,
  229. 'type' => 'media',
  230. ),
  231. array
  232. (
  233. 'name' => '视频',
  234. 'key' => 'video/lib/core.vod',
  235. ),
  236. array
  237. (
  238. 'name' => '直播',
  239. 'key' => 'video/lib/core.live',
  240. ),
  241. array
  242. (
  243. 'name' => '小程序',
  244. 'key' => 'content/lib/applet.update',
  245. 'type' => 'update',
  246. ),
  247. ),
  248. ),
  249. ),
  250. 'pic' => array
  251. (
  252. 'type' => 'varchar-150',
  253. 'name' => '图片-全屏图图片尺寸750*1386px或等比尺寸,长图图片尺寸750*高度不限 或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  254. 'default' => '',
  255. 'desc' => '图片',
  256. 'match' => 'option',
  257. 'update' => 'image',
  258. 'key' => '1',
  259. 'place' => '150',
  260. 'show' => 'type=1,2',
  261. ),
  262. 'is_button' => array
  263. (
  264. 'type' => 'int-11',
  265. 'name' => '是否显示保存按钮',
  266. 'default' => '1',
  267. 'desc' => '是否显示保存按钮',
  268. 'match' => 'is_numeric',
  269. 'update' => 'radio',
  270. 'option' => $is_button,
  271. // 'search' => 'select',
  272. 'show' => 'type=1',
  273. 'control' => 'is_button',
  274. ),
  275. 'button_name' => array
  276. (
  277. 'type' => 'varchar-80',
  278. 'name' => '保存按钮文字内容',
  279. 'default' => '保存图片',
  280. 'desc' => '保存按钮文字内容',
  281. 'match' => 'option',
  282. 'update' => 'textarea',
  283. 'show' => 'type=1',
  284. ),
  285. 'button_color' => array
  286. (
  287. 'type' => 'varchar-10',
  288. 'name' => '保存按钮文字颜色',
  289. 'default' => '#000000',
  290. 'desc' => '保存按钮文字颜色',
  291. 'match' => 'option',
  292. 'update' => 'color',
  293. 'show' => 'type=1',
  294. ),
  295. 'article_id' => array
  296. (
  297. 'type' => 'int-11',
  298. 'name' => '关联图文',
  299. 'default' => '',
  300. 'desc' => '关联图文',
  301. 'match' => 'option',
  302. 'update' => 'select',
  303. 'show' => 'type=11',
  304. 'update_search' => 'journal/lib/manage.search_article',
  305. ),
  306. 'vod_id' => array
  307. (
  308. 'type' => 'int-11',
  309. 'name' => '关联视频',
  310. 'default' => '',
  311. 'desc' => '关联视频',
  312. 'match' => 'option',
  313. 'update' => 'select',
  314. 'show' => 'type=12',
  315. 'update_search' => 'journal/lib/manage.search_vod',
  316. ),
  317. 'live_id' => array
  318. (
  319. 'type' => 'int-11',
  320. 'name' => '关联直播',
  321. 'default' => '',
  322. 'desc' => '关联直播',
  323. 'match' => 'option',
  324. 'update' => 'select',
  325. 'show' => 'type=13',
  326. 'update_search' => 'journal/lib/manage.search_live',
  327. ),
  328. 'text' => array
  329. (
  330. 'type' => 'text-1000',
  331. 'name' => '文字设置',
  332. 'default' => '',
  333. 'desc' => '文字设置',
  334. 'match' => 'is_string',
  335. 'option' => $text,
  336. 'show' => 'type=1',
  337. 'update' => array
  338. (
  339. array
  340. (
  341. 'col' => 'name',
  342. 'name' => '文字内容',
  343. 'default' => '',
  344. 'desc' => '文字内容',
  345. 'match' => 'is_string',
  346. 'update' => 'textarea',
  347. ),
  348. array
  349. (
  350. 'col' => 'color',
  351. 'name' => '文字颜色',
  352. 'default' => '#000000',
  353. 'desc' => '文字颜色',
  354. 'match' => 'is_string',
  355. 'update' => 'color',
  356. ),
  357. array
  358. (
  359. 'col' => 'bgcolor_type',
  360. 'name' => '是否设置背景颜色',
  361. 'default' => '2',
  362. 'desc' => '是否设置背景颜色',
  363. 'match' => 'is_string',
  364. 'update' => 'radio',
  365. 'option' => $bgcolor_type,
  366. 'control' => 'bgcolor_type',
  367. ),
  368. array
  369. (
  370. 'col' => 'bgcolor',
  371. 'name' => '背景颜色',
  372. 'default' => '#000000',
  373. 'desc' => '背景颜色',
  374. 'match' => 'is_string',
  375. 'update' => 'color',
  376. 'show' => 'bgcolor_type=1'
  377. ),
  378. array
  379. (
  380. 'col' => 'size',
  381. 'name' => '文字大小-直接输入像素数字',
  382. 'default' => '16',
  383. 'desc' => '结果描述',
  384. 'match' => 'is_numeric',
  385. 'update' => 'text',
  386. ),
  387. ),
  388. ),
  389. 'reorder' => array
  390. (
  391. 'type' => 'int-11',
  392. 'name' => '页号',
  393. 'default' => '1',
  394. 'desc' => '请输入排序',
  395. 'match' => 'option',
  396. //'update' => 'text',
  397. 'search' => 'order',
  398. 'list' => true,
  399. 'order' => 'asc',
  400. 'edit' => true,
  401. ),
  402. 'state' => array
  403. (
  404. 'type' => 'tinyint-1',
  405. 'name' => '状态',
  406. 'default' => '1',
  407. 'desc' => '请选择状态',
  408. 'match' => 'is_numeric',
  409. ),
  410. 'cdate' => array
  411. (
  412. 'type' => 'int-11',
  413. 'name' => '创建时间',
  414. 'match' => array('is_numeric', time()),
  415. 'desc' => '',
  416. # 只有insert时才生效
  417. 'insert' => true,
  418. //'search' => 'date',
  419. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  420. ),
  421. ),
  422. 'manage' => array
  423. (
  424. 'insert' => false,
  425. 'edit' => false,
  426. //'delete' => false,
  427. 'num' => false,
  428. 'page_list_table' => 'journal',
  429. # 自定义快捷新增和编辑
  430. 'button' => array
  431. (
  432. '新增内页' => array('location', 'add'),
  433. '预览' => array('fast', 'main/preview.get?type=4&id=' . Dever::input('search_option_info_id')),
  434. ),
  435. ),
  436. # request 请求接口定义
  437. 'request' => array
  438. (
  439. 'getAll' => array
  440. (
  441. # 匹配的正则或函数 选填项
  442. 'option' => array
  443. (
  444. 'info_id' => 'yes',
  445. 'state' => 1,
  446. ),
  447. 'type' => 'all',
  448. 'order' => array('reorder' => 'asc', 'id' => 'desc'),
  449. 'page' => array(10, 'list'),
  450. 'col' => '*',
  451. ),
  452. 'getAllByReorder' => array
  453. (
  454. # 匹配的正则或函数 选填项
  455. 'option' => array
  456. (
  457. 'info_id' => 'yes',
  458. 'state' => 1,
  459. ),
  460. 'type' => 'one',
  461. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  462. 'col' => '*',
  463. ),
  464. )
  465. );