content.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  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. 'video_info' => array
  150. (
  151. 'type' => 'text-255',
  152. 'name' => '视频信息',
  153. 'default' => '',
  154. 'desc' => '视频信息',
  155. 'match' => 'is_string',
  156. ),
  157. 'music' => array
  158. (
  159. 'type' => 'varchar-800',
  160. 'name' => '上传音频-视频格式mp3,上传大小不能超过100M',
  161. 'default' => '',
  162. 'desc' => '上传音频',
  163. 'match' => 'is_string',
  164. 'update' => 'upload',
  165. 'key' => '2',
  166. 'place' => '150',
  167. 'upload' => 'qiniu',
  168. 'large' => true,
  169. //不覆盖原文件,生成新文件
  170. 'cover' => 2,
  171. 'show' => 'type=6',
  172. ),
  173. 'cover' => array
  174. (
  175. 'type' => 'varchar-150',
  176. 'name' => '封面图-全屏视频的封面图图片尺寸750*1386px或等比尺寸,留言视频的封面图图片尺寸750*422px或等比尺寸,留言音频的封面图图片尺寸750*422px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  177. 'default' => '',
  178. 'desc' => '封面图',
  179. 'match' => 'option',
  180. 'update' => 'image',
  181. 'key' => '1',
  182. 'place' => '150',
  183. 'show' => 'type=4,5,6',
  184. ),
  185. 'focus' => array
  186. (
  187. 'type' => 'text-255',
  188. 'name' => '焦点图',
  189. 'default' => '',
  190. 'desc' => '焦点图',
  191. 'match' => 'option',
  192. 'update' => 'image',
  193. 'key' => '1',
  194. 'place' => '150',
  195. 'show' => 'type=3',
  196. ),
  197. 'author_id' => array
  198. (
  199. 'type' => 'int-11',
  200. 'name' => '作者',
  201. 'default' => '1',
  202. 'desc' => '作者',
  203. 'match' => 'is_numeric',
  204. 'update' => 'select',
  205. 'option' => $author,
  206. //'search' => 'select',
  207. 'show' => 'type=3',
  208. ),
  209. 'content' => array
  210. (
  211. 'type' => 'text-255',
  212. 'name' => '内容',
  213. 'default' => '',
  214. 'desc' => '请输入内容',
  215. 'match' => 'is_string',
  216. 'update' => 'editor',
  217. 'show' => 'type=3',
  218. //自定义编辑器右侧按钮
  219. 'editor' => array
  220. (
  221. 'name' => '选择插入模块',
  222. 'button' => array
  223. (
  224. array
  225. (
  226. # 名称
  227. 'name' => '图片',
  228. # 资源库id
  229. 'key' => 1,
  230. # 类型
  231. 'type' => 'image',
  232. ),
  233. array
  234. (
  235. 'name' => '音频',
  236. 'key' => 2,
  237. 'type' => 'media',
  238. ),
  239. array
  240. (
  241. 'name' => '视频',
  242. 'key' => 'video/lib/core.vod',
  243. ),
  244. array
  245. (
  246. 'name' => '直播',
  247. 'key' => 'video/lib/core.live',
  248. ),
  249. array
  250. (
  251. 'name' => '小程序',
  252. 'key' => 'content/lib/applet.update',
  253. 'type' => 'update',
  254. ),
  255. ),
  256. ),
  257. ),
  258. 'pic' => array
  259. (
  260. 'type' => 'varchar-150',
  261. 'name' => '图片-全屏图图片尺寸750*1386px或等比尺寸,长图图片尺寸750*高度不限 或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  262. 'default' => '',
  263. 'desc' => '图片',
  264. 'match' => 'option',
  265. 'update' => 'image',
  266. 'key' => '1',
  267. 'place' => '150',
  268. 'show' => 'type=1,2',
  269. ),
  270. 'is_button' => array
  271. (
  272. 'type' => 'int-11',
  273. 'name' => '是否显示保存按钮',
  274. 'default' => '1',
  275. 'desc' => '是否显示保存按钮',
  276. 'match' => 'is_numeric',
  277. 'update' => 'radio',
  278. 'option' => $is_button,
  279. // 'search' => 'select',
  280. 'show' => 'type=1',
  281. 'control' => 'is_button',
  282. ),
  283. 'button_name' => array
  284. (
  285. 'type' => 'varchar-80',
  286. 'name' => '保存按钮文字内容',
  287. 'default' => '保存图片',
  288. 'desc' => '保存按钮文字内容',
  289. 'match' => 'option',
  290. 'update' => 'textarea',
  291. 'show' => 'type=1',
  292. ),
  293. 'button_color' => array
  294. (
  295. 'type' => 'varchar-10',
  296. 'name' => '保存按钮文字颜色',
  297. 'default' => '#000000',
  298. 'desc' => '保存按钮文字颜色',
  299. 'match' => 'option',
  300. 'update' => 'color',
  301. 'show' => 'type=1',
  302. ),
  303. 'article_id' => array
  304. (
  305. 'type' => 'int-11',
  306. 'name' => '关联图文',
  307. 'default' => '',
  308. 'desc' => '关联图文',
  309. 'match' => 'option',
  310. 'update' => 'select',
  311. 'show' => 'type=11',
  312. 'update_search' => 'journal/lib/manage.search_article',
  313. ),
  314. 'vod_id' => array
  315. (
  316. 'type' => 'int-11',
  317. 'name' => '关联视频',
  318. 'default' => '',
  319. 'desc' => '关联视频',
  320. 'match' => 'option',
  321. 'update' => 'select',
  322. 'show' => 'type=12',
  323. 'update_search' => 'journal/lib/manage.search_vod',
  324. ),
  325. 'live_id' => array
  326. (
  327. 'type' => 'int-11',
  328. 'name' => '关联直播',
  329. 'default' => '',
  330. 'desc' => '关联直播',
  331. 'match' => 'option',
  332. 'update' => 'select',
  333. 'show' => 'type=13',
  334. 'update_search' => 'journal/lib/manage.search_live',
  335. ),
  336. 'text' => array
  337. (
  338. 'type' => 'text-1000',
  339. 'name' => '文字设置',
  340. 'default' => '',
  341. 'desc' => '文字设置',
  342. 'match' => 'is_string',
  343. 'option' => $text,
  344. 'show' => 'type=1',
  345. 'update' => array
  346. (
  347. array
  348. (
  349. 'col' => 'name',
  350. 'name' => '文字内容',
  351. 'default' => '',
  352. 'desc' => '文字内容',
  353. 'match' => 'is_string',
  354. 'update' => 'textarea',
  355. ),
  356. array
  357. (
  358. 'col' => 'color',
  359. 'name' => '文字颜色',
  360. 'default' => '#000000',
  361. 'desc' => '文字颜色',
  362. 'match' => 'is_string',
  363. 'update' => 'color',
  364. ),
  365. array
  366. (
  367. 'col' => 'bgcolor_type',
  368. 'name' => '是否设置背景颜色',
  369. 'default' => '2',
  370. 'desc' => '是否设置背景颜色',
  371. 'match' => 'is_string',
  372. 'update' => 'radio',
  373. 'option' => $bgcolor_type,
  374. 'control' => 'bgcolor_type',
  375. ),
  376. array
  377. (
  378. 'col' => 'bgcolor',
  379. 'name' => '背景颜色',
  380. 'default' => '#000000',
  381. 'desc' => '背景颜色',
  382. 'match' => 'is_string',
  383. 'update' => 'color',
  384. 'show' => 'bgcolor_type=1'
  385. ),
  386. array
  387. (
  388. 'col' => 'size',
  389. 'name' => '文字大小-直接输入像素数字',
  390. 'default' => '16',
  391. 'desc' => '结果描述',
  392. 'match' => 'is_numeric',
  393. 'update' => 'text',
  394. ),
  395. ),
  396. ),
  397. 'reorder' => array
  398. (
  399. 'type' => 'int-11',
  400. 'name' => '页号',
  401. 'default' => '1',
  402. 'desc' => '请输入排序',
  403. 'match' => 'option',
  404. //'update' => 'text',
  405. 'search' => 'order',
  406. 'list' => true,
  407. 'order' => 'asc',
  408. 'edit' => true,
  409. ),
  410. 'state' => array
  411. (
  412. 'type' => 'tinyint-1',
  413. 'name' => '状态',
  414. 'default' => '1',
  415. 'desc' => '请选择状态',
  416. 'match' => 'is_numeric',
  417. ),
  418. 'cdate' => array
  419. (
  420. 'type' => 'int-11',
  421. 'name' => '创建时间',
  422. 'match' => array('is_numeric', time()),
  423. 'desc' => '',
  424. # 只有insert时才生效
  425. 'insert' => true,
  426. //'search' => 'date',
  427. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  428. ),
  429. ),
  430. 'manage' => array
  431. (
  432. 'insert' => false,
  433. 'edit' => false,
  434. //'delete' => false,
  435. 'num' => false,
  436. 'page_list_table' => 'journal',
  437. # 自定义快捷新增和编辑
  438. 'button' => array
  439. (
  440. '新增内页' => array('location', 'add'),
  441. '预览' => array('fast', 'main/preview.get?type=4&id=' . Dever::input('search_option_info_id')),
  442. ),
  443. ),
  444. # request 请求接口定义
  445. 'request' => array
  446. (
  447. 'getAll' => array
  448. (
  449. # 匹配的正则或函数 选填项
  450. 'option' => array
  451. (
  452. 'info_id' => 'yes',
  453. 'state' => 1,
  454. ),
  455. 'type' => 'all',
  456. 'order' => array('reorder' => 'asc', 'id' => 'desc'),
  457. 'page' => array(10, 'list'),
  458. 'col' => '*',
  459. ),
  460. 'getAllByReorder' => array
  461. (
  462. # 匹配的正则或函数 选填项
  463. 'option' => array
  464. (
  465. 'info_id' => 'yes',
  466. 'state' => 1,
  467. ),
  468. 'type' => 'one',
  469. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  470. 'col' => '*',
  471. ),
  472. )
  473. );