content.php 19 KB

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