content.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
  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. # 2019-03-27 增加两个类型
  14. 7 => '长图(文字)',
  15. 8 => '横屏图',
  16. 2 => '长图',
  17. 9 => '无边框图片',
  18. 10 => '四宫格图片',
  19. # 2018-12-11 增加3个类型
  20. 4 => '全屏视频',
  21. 5 => '留言视频',
  22. 6 => '留言音频',
  23. # 2019-03-27 增加三个类型
  24. 21 => '对话模板',
  25. # 关联类型 > 10
  26. 11 => '关联图文',
  27. 12 => '关联视频',
  28. 13 => '关联直播',
  29. );
  30. $type_default = 3;
  31. if ($cate) {
  32. $type = array();
  33. $cate_type = explode(',', $cate['type']);
  34. $i = 0;
  35. foreach ($cate_type as $k => $v) {
  36. if (isset($type_config[$v])) {
  37. if ($i == 0) {
  38. $type_default = $v;
  39. }
  40. $type[$v] = $type_config[$v];
  41. $i++;
  42. }
  43. }
  44. } else {
  45. $type = $type_config;
  46. }
  47. $is_button = array
  48. (
  49. 1 => '显示',
  50. 2 => '不显示',
  51. );
  52. $text = array
  53. (
  54. 1 => '上左',
  55. 2 => '上中',
  56. 3 => '上右',
  57. 4 => '中左',
  58. 5 => '正中',
  59. 6 => '中右',
  60. 7 => '下左',
  61. 8 => '下中',
  62. 9 => '下右',
  63. //10 => '自定义',
  64. );
  65. $palaces = array
  66. (
  67. 1 => '上左',
  68. 2 => '上右',
  69. 3 => '下左',
  70. 4 => '下右',
  71. );
  72. $bgcolor_type = array
  73. (
  74. 1 => '设置背景颜色',
  75. 2 => '不设置背景颜色',
  76. );
  77. $talk_type = array
  78. (
  79. 1 => '文字',
  80. 2 => '图片',
  81. 3 => '音频',
  82. );
  83. $talk_location = array
  84. (
  85. 1 => '显示在左侧',
  86. 2 => '显示在右侧',
  87. );
  88. $author = function()
  89. {
  90. $array = array();
  91. $info = Dever::db('content/author')->state();
  92. if($info)
  93. {
  94. $array += $info;
  95. }
  96. return $array;
  97. };
  98. return array
  99. (
  100. # 表名
  101. 'name' => 'content',
  102. # 显示给用户看的名称
  103. 'lang' => '内页管理',
  104. 'menu' => false,
  105. 'gettype' => $type,
  106. 'text' => $text,
  107. 'end' => array
  108. (
  109. 'insert' => 'journal/lib/manage.addContent',
  110. ),
  111. # 数据结构
  112. 'struct' => array
  113. (
  114. 'id' => array
  115. (
  116. 'type' => 'int-11',
  117. 'name' => 'ID',
  118. 'default' => '',
  119. 'desc' => '',
  120. 'match' => 'is_numeric',
  121. //'search' => 'order',
  122. //'list' => true,
  123. ),
  124. 'info_id' => array
  125. (
  126. 'type' => 'int-11',
  127. 'name' => '小刊',
  128. 'default' => '',
  129. 'desc' => '小刊',
  130. 'match' => 'is_numeric',
  131. 'update' => 'hidden',
  132. 'value' => Dever::input('search_option_info_id')
  133. ),
  134. 'type' => array
  135. (
  136. 'type' => 'int-11',
  137. 'name' => '类型',
  138. 'default' => $type_default,
  139. 'desc' => '类型',
  140. 'match' => 'is_numeric',
  141. 'update' => 'radio',
  142. 'option' => $type,
  143. 'control' => 'type',
  144. ),
  145. 'name' => array
  146. (
  147. 'type' => 'varchar-80',
  148. 'name' => '标题',
  149. 'default' => '',
  150. 'desc' => '标题',
  151. 'match' => 'is_string',
  152. 'update' => 'text',
  153. 'list' => true,
  154. //增加预览
  155. 'preview' => true,
  156. 'show' => 'type=3,5,6',
  157. ),
  158. 'video' => array
  159. (
  160. 'type' => 'varchar-800',
  161. 'name' => '上传视频-视频格式mp4,上传大小不能超过4G',
  162. 'default' => '',
  163. 'desc' => '上传点播视频',
  164. 'match' => 'is_string',
  165. 'update' => 'upload',
  166. 'key' => '3',
  167. 'place' => '150',
  168. 'upload' => 'qiniu',
  169. 'large' => true,
  170. //不覆盖原文件,生成新文件
  171. 'cover' => 2,
  172. 'show' => 'type=4,5',
  173. ),
  174. 'video_info' => array
  175. (
  176. 'type' => 'text-255',
  177. 'name' => '视频信息',
  178. 'default' => '',
  179. 'desc' => '视频信息',
  180. 'match' => 'is_string',
  181. ),
  182. 'music' => array
  183. (
  184. 'type' => 'varchar-800',
  185. 'name' => '上传音频-视频格式mp3,上传大小不能超过100M',
  186. 'default' => '',
  187. 'desc' => '上传音频',
  188. 'match' => 'is_string',
  189. 'update' => 'upload',
  190. 'key' => '2',
  191. 'place' => '150',
  192. 'upload' => 'qiniu',
  193. 'large' => true,
  194. //不覆盖原文件,生成新文件
  195. 'cover' => 2,
  196. 'show' => 'type=6',
  197. ),
  198. 'cover' => array
  199. (
  200. 'type' => 'varchar-150',
  201. 'name' => '封面图-全屏视频的封面图图片尺寸750*1386px或等比尺寸,留言视频的封面图图片尺寸750*422px或等比尺寸,留言音频的封面图图片尺寸750*422px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  202. 'default' => '',
  203. 'desc' => '封面图',
  204. 'match' => 'option',
  205. 'update' => 'image',
  206. 'key' => '1',
  207. 'place' => '150',
  208. 'show' => 'type=4,5,6',
  209. ),
  210. 'focus' => array
  211. (
  212. 'type' => 'text-255',
  213. 'name' => '焦点图',
  214. 'default' => '',
  215. 'desc' => '焦点图',
  216. 'match' => 'option',
  217. 'update' => 'image',
  218. 'key' => '1',
  219. 'place' => '150',
  220. 'show' => 'type=3',
  221. ),
  222. 'author_id' => array
  223. (
  224. 'type' => 'int-11',
  225. 'name' => '作者',
  226. 'default' => '1',
  227. 'desc' => '作者',
  228. 'match' => 'is_numeric',
  229. 'update' => 'select',
  230. 'option' => $author,
  231. //'search' => 'select',
  232. 'show' => 'type=3',
  233. ),
  234. 'content' => array
  235. (
  236. 'type' => 'text-255',
  237. 'name' => '内容',
  238. 'default' => '',
  239. 'desc' => '请输入内容',
  240. 'match' => 'is_string',
  241. 'update' => 'editor',
  242. 'show' => 'type=3',
  243. //自定义编辑器右侧按钮
  244. 'editor' => array
  245. (
  246. 'name' => '选择插入模块',
  247. 'button' => array
  248. (
  249. array
  250. (
  251. # 名称
  252. 'name' => '图片',
  253. # 资源库id
  254. 'key' => 1,
  255. # 类型
  256. 'type' => 'image',
  257. ),
  258. array
  259. (
  260. 'name' => '音频',
  261. 'key' => 2,
  262. 'type' => 'media',
  263. ),
  264. array
  265. (
  266. 'name' => '视频',
  267. 'key' => 'video/lib/core.vod',
  268. ),
  269. array
  270. (
  271. 'name' => '直播',
  272. 'key' => 'video/lib/core.live',
  273. ),
  274. array
  275. (
  276. 'name' => '小程序',
  277. 'key' => 'content/lib/applet.update',
  278. 'type' => 'update',
  279. ),
  280. ),
  281. ),
  282. ),
  283. 'pic' => array
  284. (
  285. 'type' => 'varchar-150',
  286. 'name' => '图片-全屏图图片尺寸750*1386px或等比尺寸,长屏图图片尺寸750*高度不限或等比尺寸,横屏图图片尺寸宽度不限*1386px或等比尺寸,长图图片尺寸750*高度不限或等比尺寸,无边框图片尺寸长和宽均没有限制,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  287. 'default' => '',
  288. 'desc' => '图片',
  289. 'match' => 'option',
  290. 'update' => 'image',
  291. 'key' => '1',
  292. 'place' => '150',
  293. 'show' => 'type=1,2,7,8,9',
  294. ),
  295. 'pic_info' => array
  296. (
  297. 'type' => 'varchar-500',
  298. 'name' => '图片信息',
  299. 'default' => '',
  300. 'desc' => '图片信息',
  301. 'match' => 'is_string',
  302. 'update' => 'hidden',
  303. ),
  304. 'is_button' => array
  305. (
  306. 'type' => 'int-11',
  307. 'name' => '是否显示保存按钮',
  308. 'default' => '1',
  309. 'desc' => '是否显示保存按钮',
  310. 'match' => 'is_numeric',
  311. 'update' => 'radio',
  312. 'option' => $is_button,
  313. // 'search' => 'select',
  314. 'show' => 'type=1,7,8',
  315. 'control' => 'is_button',
  316. ),
  317. 'button_name' => array
  318. (
  319. 'type' => 'varchar-80',
  320. 'name' => '保存按钮文字内容',
  321. 'default' => '保存图片',
  322. 'desc' => '保存按钮文字内容',
  323. 'match' => 'option',
  324. 'update' => 'textarea',
  325. 'show' => 'type=1,7,8',
  326. ),
  327. 'button_color' => array
  328. (
  329. 'type' => 'varchar-10',
  330. 'name' => '保存按钮文字颜色',
  331. 'default' => '#000000',
  332. 'desc' => '保存按钮文字颜色',
  333. 'match' => 'option',
  334. 'update' => 'color',
  335. 'show' => 'type=1,7,8',
  336. ),
  337. 'article_id' => array
  338. (
  339. 'type' => 'int-11',
  340. 'name' => '关联图文',
  341. 'default' => '',
  342. 'desc' => '关联图文',
  343. 'match' => 'option',
  344. 'update' => 'select',
  345. 'show' => 'type=11',
  346. 'update_search' => 'journal/lib/manage.search_article',
  347. ),
  348. 'vod_id' => array
  349. (
  350. 'type' => 'int-11',
  351. 'name' => '关联视频',
  352. 'default' => '',
  353. 'desc' => '关联视频',
  354. 'match' => 'option',
  355. 'update' => 'select',
  356. 'show' => 'type=12',
  357. 'update_search' => 'journal/lib/manage.search_vod',
  358. ),
  359. 'live_id' => array
  360. (
  361. 'type' => 'int-11',
  362. 'name' => '关联直播',
  363. 'default' => '',
  364. 'desc' => '关联直播',
  365. 'match' => 'option',
  366. 'update' => 'select',
  367. 'show' => 'type=13',
  368. 'update_search' => 'journal/lib/manage.search_live',
  369. ),
  370. 'text' => array
  371. (
  372. 'type' => 'text-1000',
  373. 'name' => '文字设置',
  374. 'default' => '',
  375. 'desc' => '文字设置',
  376. 'match' => 'is_string',
  377. 'option' => $text,
  378. 'show' => 'type=1,7,8',
  379. 'update' => array
  380. (
  381. array
  382. (
  383. 'col' => 'name',
  384. 'name' => '文字内容',
  385. 'default' => '',
  386. 'desc' => '文字内容',
  387. 'match' => 'is_string',
  388. 'update' => 'textarea',
  389. ),
  390. array
  391. (
  392. 'col' => 'color',
  393. 'name' => '文字颜色',
  394. 'default' => '#000000',
  395. 'desc' => '文字颜色',
  396. 'match' => 'is_string',
  397. 'update' => 'color',
  398. ),
  399. array
  400. (
  401. 'col' => 'bgcolor_type',
  402. 'name' => '是否设置背景颜色',
  403. 'default' => '2',
  404. 'desc' => '是否设置背景颜色',
  405. 'match' => 'is_string',
  406. 'update' => 'radio',
  407. 'option' => $bgcolor_type,
  408. 'control' => 'bgcolor_type',
  409. ),
  410. array
  411. (
  412. 'col' => 'bgcolor',
  413. 'name' => '背景颜色',
  414. 'default' => '#000000',
  415. 'desc' => '背景颜色',
  416. 'match' => 'is_string',
  417. 'update' => 'color',
  418. 'show' => 'bgcolor_type=1'
  419. ),
  420. array
  421. (
  422. 'col' => 'size',
  423. 'name' => '文字大小-直接输入像素数字',
  424. 'default' => '16',
  425. 'desc' => '结果描述',
  426. 'match' => 'is_numeric',
  427. 'update' => 'text',
  428. ),
  429. ),
  430. ),
  431. 'palaces' => array
  432. (
  433. 'type' => 'text-1000',
  434. 'name' => '四宫格图片',
  435. 'default' => '',
  436. 'desc' => '四宫格图片',
  437. 'match' => 'is_string',
  438. 'option' => $palaces,
  439. 'show' => 'type=10',
  440. 'update' => array
  441. (
  442. array
  443. (
  444. 'col' => 'pic',
  445. 'name' => '图片',
  446. 'default' => '',
  447. 'desc' => '图片',
  448. 'match' => 'is_string',
  449. 'update' => 'image',
  450. 'key' => 1,
  451. ),
  452. ),
  453. ),
  454. 'talk_pic' => array
  455. (
  456. 'type' => 'varchar-150',
  457. 'name' => '置顶图片-图片尺寸750*1386px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式。为空则不显示',
  458. 'default' => '',
  459. 'desc' => '图片',
  460. 'match' => 'option',
  461. 'update' => 'image',
  462. 'key' => '1',
  463. 'place' => '150',
  464. 'show' => 'type=21',
  465. ),
  466. 'talk' => array
  467. (
  468. 'type' => 'text-1000',
  469. 'name' => '对话设置',
  470. 'default' => '',
  471. 'desc' => '对话设置',
  472. 'match' => 'is_string',
  473. 'show' => 'type=21',
  474. 'update' => array
  475. (
  476. array
  477. (
  478. 'col' => 'talk_location',
  479. 'name' => '对话位置',
  480. 'default' => '1',
  481. 'desc' => '对话位置',
  482. 'match' => 'is_string',
  483. 'update' => 'radio',
  484. 'option' => $talk_location,
  485. ),
  486. array
  487. (
  488. 'col' => 'avatar',
  489. 'name' => '头像-图片尺寸120*120px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式。',
  490. 'default' => '',
  491. 'desc' => '头像',
  492. 'match' => 'option',
  493. 'update' => 'image',
  494. 'key' => 1,
  495. ),
  496. array
  497. (
  498. 'col' => 'talk_type',
  499. 'name' => '对话类型',
  500. 'default' => '1',
  501. 'desc' => '对话类型',
  502. 'match' => 'is_string',
  503. 'update' => 'radio',
  504. 'option' => $talk_type,
  505. 'control' => 'talk_type',
  506. ),
  507. array
  508. (
  509. 'col' => 'text',
  510. 'name' => '文字内容-为空则不显示',
  511. 'default' => '',
  512. 'desc' => '文字内容',
  513. 'match' => 'option',
  514. 'update' => 'textarea',
  515. 'show' => 'talk_type=1'
  516. ),
  517. array
  518. (
  519. 'col' => 'pic',
  520. 'name' => '图片-图片尺寸750*1386px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式,可以上传GIF格式。为空则不显示',
  521. 'default' => '',
  522. 'desc' => '图片',
  523. 'match' => 'option',
  524. 'update' => 'image',
  525. 'key' => 1,
  526. 'show' => 'talk_type=2'
  527. ),
  528. array
  529. (
  530. 'col' => 'audio',
  531. 'name' => '音频-音频格式mp3,上传大小不能超过100M,为空则不显示',
  532. 'default' => '',
  533. 'desc' => '音频',
  534. 'match' => 'option',
  535. 'update' => 'upload',
  536. 'key' => 2,
  537. 'show' => 'talk_type=3'
  538. ),
  539. ),
  540. ),
  541. 'reorder' => array
  542. (
  543. 'type' => 'int-11',
  544. 'name' => '页号',
  545. 'default' => '1',
  546. 'desc' => '请输入排序',
  547. 'match' => 'option',
  548. //'update' => 'text',
  549. 'search' => 'order',
  550. 'list' => true,
  551. 'order' => 'asc',
  552. 'edit' => true,
  553. ),
  554. 'state' => array
  555. (
  556. 'type' => 'tinyint-1',
  557. 'name' => '状态',
  558. 'default' => '1',
  559. 'desc' => '请选择状态',
  560. 'match' => 'is_numeric',
  561. ),
  562. 'cdate' => array
  563. (
  564. 'type' => 'int-11',
  565. 'name' => '创建时间',
  566. 'match' => array('is_numeric', time()),
  567. 'desc' => '',
  568. # 只有insert时才生效
  569. 'insert' => true,
  570. //'search' => 'date',
  571. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  572. ),
  573. ),
  574. 'manage' => array
  575. (
  576. 'insert' => false,
  577. 'edit' => false,
  578. //'delete' => false,
  579. 'num' => false,
  580. 'page_list_table' => 'journal',
  581. # 自定义快捷新增和编辑
  582. 'button' => array
  583. (
  584. '新增内页' => array('location', 'add'),
  585. '预览' => array('fast', 'main/preview.get?type=4&id=' . Dever::input('search_option_info_id')),
  586. ),
  587. ),
  588. # request 请求接口定义
  589. 'request' => array
  590. (
  591. 'getAll' => array
  592. (
  593. # 匹配的正则或函数 选填项
  594. 'option' => array
  595. (
  596. 'info_id' => 'yes',
  597. 'state' => 1,
  598. ),
  599. 'type' => 'all',
  600. 'order' => array('reorder' => 'asc', 'id' => 'desc'),
  601. 'page' => array(10, 'list'),
  602. 'col' => '*',
  603. ),
  604. 'getAllByReorder' => array
  605. (
  606. # 匹配的正则或函数 选填项
  607. 'option' => array
  608. (
  609. 'info_id' => 'yes',
  610. 'state' => 1,
  611. ),
  612. 'type' => 'one',
  613. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  614. 'col' => '*',
  615. ),
  616. )
  617. );