content.php 21 KB

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