content.php 19 KB

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