vod.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. <?php
  2. $page = 15;
  3. $audit = Dever::config('base')->audit;
  4. $status = Dever::config('base')->status;
  5. $function = Dever::config('base')->function;
  6. $cate = function()
  7. {
  8. $array = array();
  9. $info = Dever::db('content/cate')->state();
  10. if($info)
  11. {
  12. $array += $info;
  13. }
  14. return $array;
  15. };
  16. $author = function()
  17. {
  18. $array = array();
  19. $info = Dever::db('content/author')->state();
  20. if($info)
  21. {
  22. $array += $info;
  23. }
  24. return $array;
  25. };
  26. $share = function()
  27. {
  28. $array = array();
  29. $info = Dever::db('poster/template')->state();
  30. if($info)
  31. {
  32. $array += $info;
  33. }
  34. return $array;
  35. };
  36. $share = array
  37. (
  38. 1 => '显示',
  39. 2 => '不显示',
  40. );
  41. $col = 'id,name,pic_cover,pic_cover_169,pdate,num_add_view+num_view as num_view,num_up+num_add_up as num_up,num_comment,share_yes,share_title,share_pic,share_content,function,content,cate_id,video,author_id';
  42. return array
  43. (
  44. # 表名
  45. 'name' => 'vod',
  46. # 显示给用户看的名称
  47. 'lang' => '点播视频管理',
  48. 'order' => 100,
  49. 'end' => array
  50. (
  51. 'insert' => 'tag/lib/core.data?source_table=video/vod',
  52. 'update' => 'tag/lib/core.data?source_table=video/vod',
  53. ),
  54. # 同步更新另外一个或多个表的数据
  55. 'syncone' => array
  56. (
  57. 'audit/data' => array
  58. (
  59. # 更新另外一个表的字段 => 本表的字段
  60. 'where' => array('data_id' => 'id', 'type' => 2),
  61. # 要更新的数据
  62. 'update' => array('data_id' => 'id', 'type' => 2, 'pdate' => 'pdate', 'reorder' => 'reorder', 'name' => 'name', 'audit' => 'audit', 'status' => 'status', 'cate_id' => 'cate_id', 'state' => 'state'),
  63. )
  64. ),
  65. # 数据结构
  66. 'struct' => array
  67. (
  68. 'id' => array
  69. (
  70. 'type' => 'int-11',
  71. 'name' => 'ID',
  72. 'default' => '',
  73. 'desc' => '',
  74. 'match' => 'is_numeric',
  75. 'list' => true,
  76. ),
  77. 'name' => array
  78. (
  79. 'type' => 'varchar-80',
  80. 'name' => '标题',
  81. 'default' => '',
  82. 'desc' => '标题',
  83. 'match' => 'is_string',
  84. 'update' => 'text',
  85. 'search' => 'fulltext',
  86. 'list' => true,
  87. ),
  88. 'link' => array
  89. (
  90. 'type' => 'varchar-800',
  91. 'name' => '点播地址',
  92. 'default' => '',
  93. 'desc' => '点播地址',
  94. 'match' => 'option',
  95. //'update' => 'text',
  96. //'list' => true,
  97. ),
  98. 'video' => array
  99. (
  100. 'type' => 'varchar-800',
  101. 'name' => '上传视频-视频格式mp4,mov,上传大小不能超过4G',
  102. 'default' => '',
  103. 'desc' => '上传点播视频',
  104. 'match' => 'is_string',
  105. 'update' => 'upload',
  106. 'key' => '3',
  107. 'place' => '150',
  108. 'upload' => 'qiniu',
  109. 'large' => true,
  110. //不覆盖原文件,生成新文件
  111. 'cover' => 2,
  112. ),
  113. 'cate_id' => array
  114. (
  115. 'type' => 'int-11',
  116. 'name' => '所属栏目',
  117. 'default' => '1',
  118. 'desc' => '所属栏目',
  119. 'match' => 'is_numeric',
  120. 'update' => 'select',
  121. 'option' => $cate,
  122. 'search' => 'select',
  123. ),
  124. 'author_id' => array
  125. (
  126. 'type' => 'int-11',
  127. 'name' => '作者',
  128. 'default' => '1',
  129. 'desc' => '作者',
  130. 'match' => 'is_numeric',
  131. 'update' => 'select',
  132. //'option' => $author,
  133. 'search' => 'select',
  134. 'update_search' => 'content/lib/author.search',
  135. ),
  136. 'tag' => array
  137. (
  138. 'type' => 'text-255',
  139. 'name' => '标签',
  140. 'default' => '',
  141. 'desc' => '标签',
  142. 'match' => 'is_numeric',
  143. 'update' => 'selects',
  144. //'search' => 'fulltext',
  145. 'update_search' => 'tag/lib/core.search',
  146. ),
  147. 'pic_cover' => array
  148. (
  149. 'type' => 'varchar-150',
  150. 'name' => '4:3封面图-图片尺寸750*564px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  151. 'default' => '',
  152. 'desc' => '封面图',
  153. 'match' => 'is_string',
  154. 'update' => 'image',
  155. 'key' => '1',
  156. 'place' => '150',
  157. //直接上传到云端
  158. //'upload' => 'qiniu',
  159. //上传大数据
  160. //'large' => true,
  161. ),
  162. 'pic_cover_169' => array
  163. (
  164. 'type' => 'varchar-150',
  165. 'name' => '16:9封面图-图片尺寸750*422px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  166. 'default' => '',
  167. 'desc' => '封面图',
  168. 'match' => 'is_string',
  169. 'update' => 'image',
  170. 'key' => '1',
  171. 'place' => '150',
  172. //直接上传到云端
  173. //'upload' => 'qiniu',
  174. //上传大数据
  175. //'large' => true,
  176. ),
  177. 'num_add_view' => array
  178. (
  179. 'type' => 'int-11',
  180. 'name' => '浏览量基数',
  181. 'default' => '0',
  182. 'desc' => '浏览量基数',
  183. 'match' => 'option',
  184. 'update' => 'text',
  185. ),
  186. 'num_view' => array
  187. (
  188. 'type' => 'int-11',
  189. 'name' => '浏览量pv',
  190. 'default' => '0',
  191. 'desc' => '请填写浏览量pv',
  192. 'match' => 'option',
  193. 'search' => 'order',
  194. //'list' => '{num_view}+{num_add_view}',
  195. ),
  196. 'num_add_up' => array
  197. (
  198. 'type' => 'int-11',
  199. 'name' => '喜欢基数',
  200. 'default' => '0',
  201. 'desc' => '喜欢基数',
  202. 'match' => 'option',
  203. 'update' => 'text',
  204. ),
  205. 'num_up' => array
  206. (
  207. 'type' => 'int-11',
  208. 'name' => '喜欢数',
  209. 'default' => '0',
  210. 'desc' => '请填写喜欢数',
  211. 'match' => 'option',
  212. //'search' => 'order',
  213. 'list' => '"喜欢数:{num_up}+{num_add_up}<br />浏览量:{num_view}+{num_add_view}<br />评论数:{num_comment}<br />"',
  214. 'list_name' => '统计数字',
  215. ),
  216. 'num_comment' => array
  217. (
  218. 'type' => 'int-11',
  219. 'name' => '评论数',
  220. 'default' => '0',
  221. 'desc' => '请填写评论数',
  222. 'search' => 'order',
  223. 'match' => 'option',
  224. //'list' => true,
  225. ),
  226. 'state' => array
  227. (
  228. 'type' => 'tinyint-1',
  229. 'name' => '状态',
  230. 'default' => '1',
  231. 'desc' => '请选择状态',
  232. 'match' => 'is_numeric',
  233. ),
  234. 'admin_founder' => array
  235. (
  236. 'type' => 'int-11',
  237. 'name' => '创建人',
  238. 'default' => '1',
  239. 'desc' => '创建人',
  240. 'match' => 'is_numeric',
  241. ),
  242. 'admin_editor' => array
  243. (
  244. 'type' => 'int-11',
  245. 'name' => '操作人',
  246. 'default' => '1',
  247. 'desc' => '操作人',
  248. 'match' => 'is_numeric',
  249. ),
  250. 'pdate' => array
  251. (
  252. 'type' => 'int-11',
  253. 'name' => '发布时间',
  254. 'match' => array('is_numeric', time()),
  255. 'default' => '',
  256. 'desc' => '',
  257. 'update' => 'date',
  258. 'callback' => 'maketime',
  259. 'insert' => true,
  260. //'list' => 'date("Y-m-d H:i:s", {pdate})',
  261. 'auth' => '"{pdate}" > 0',
  262. ),
  263. 'share' => array
  264. (
  265. 'type' => 'text-255',
  266. 'name' => '分享海报-选择海报库中的海报',
  267. 'default' => '',
  268. 'desc' => '分享海报',
  269. 'match' => 'option',
  270. //'update' => 'checkbox',
  271. 'option' => $share,
  272. ),
  273. 'reorder' => array
  274. (
  275. 'type' => 'int-11',
  276. 'name' => '排序(数值越大越靠前)',
  277. 'default' => '1',
  278. 'desc' => '请输入排序',
  279. 'match' => 'option',
  280. 'update' => 'text',
  281. 'search' => 'order',
  282. 'list' => true,
  283. 'order' => 'desc',
  284. 'edit' => true,
  285. ),
  286. 'udate' => array
  287. (
  288. 'type' => 'int-11',
  289. 'name' => '更新时间',
  290. 'match' => array('is_numeric', time()),
  291. 'desc' => '',
  292. ),
  293. 'function' => array
  294. (
  295. 'type' => 'varchar-100',
  296. 'name' => '功能选择',
  297. 'default' => '1,2,3',
  298. 'desc' => '功能选择',
  299. 'match' => 'option',
  300. 'update' => 'checkbox',
  301. 'option' => $function,
  302. ),
  303. 'share_yes' => array
  304. (
  305. 'type' => 'int-11',
  306. 'name' => '是否显示分享按钮',
  307. 'default' => '1',
  308. 'desc' => '是否显示分享按钮',
  309. 'match' => 'option',
  310. 'update' => 'radio',
  311. 'option' => $share,
  312. 'control' => 'share_yes',
  313. ),
  314. 'share_title' => array
  315. (
  316. 'type' => 'varchar-100',
  317. 'name' => '分享标题',
  318. 'default' => '',
  319. 'desc' => '分享标题',
  320. 'match' => 'option',
  321. 'update' => 'text',
  322. 'show' => 'share_yes=1',
  323. ),
  324. 'share_pic' => array
  325. (
  326. 'type' => 'varchar-150',
  327. 'name' => '分享图片-图片尺寸570*570px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  328. 'default' => '',
  329. 'desc' => '分享图片',
  330. 'match' => 'is_string',
  331. 'update' => 'image',
  332. 'key' => '1',
  333. 'place' => '150',
  334. 'show' => 'share_yes=1',
  335. //'upload' => 'qiniu',
  336. //'large' => true,
  337. ),
  338. 'share_content' => array
  339. (
  340. 'type' => 'varchar-200',
  341. 'name' => '分享内容',
  342. 'default' => '',
  343. 'desc' => '分享内容',
  344. 'match' => 'option',
  345. 'update' => 'textarea',
  346. 'show' => 'share_yes=1',
  347. ),
  348. 'content' => array
  349. (
  350. 'type' => 'text-255',
  351. 'name' => '内容',
  352. 'default' => '',
  353. 'desc' => '请输入内容',
  354. 'match' => 'is_string',
  355. 'update' => 'editor',
  356. 'key' => 1,
  357. ),
  358. 'audit' => array
  359. (
  360. 'type' => 'int-11',
  361. 'name' => '审核状态',
  362. 'default' => '1',
  363. 'desc' => '审核',
  364. 'match' => 'is_numeric',
  365. //'update' => 'select',
  366. 'option' => $audit,
  367. 'search' => 'select',
  368. 'list' => true,
  369. 'edit' => true,
  370. ),
  371. 'status' => array
  372. (
  373. 'type' => 'int-11',
  374. 'name' => '发布状态',
  375. 'default' => '1',
  376. 'desc' => '发布状态',
  377. 'match' => 'is_numeric',
  378. //'update' => 'select',
  379. 'option' => $status,
  380. 'search' => 'select',
  381. 'list' => true,
  382. 'edit' => true,
  383. ),
  384. 'cdate' => array
  385. (
  386. 'type' => 'int-11',
  387. 'name' => '录入时间',
  388. 'match' => array('is_numeric', time()),
  389. 'desc' => '',
  390. # 只有insert时才生效
  391. 'insert' => true,
  392. ),
  393. ),
  394. # 索引
  395. 'index' => array
  396. (
  397. 'version' => 1,
  398. 1 => array
  399. (
  400. 'i1' => 'uid,cate_id',
  401. )
  402. ),
  403. # 管理功能
  404. 'manage' => array
  405. (
  406. //'insert' => false,
  407. # 列表
  408. 'list_button' => array
  409. (
  410. 'edit' => array('预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=2'))),
  411. ),
  412. ),
  413. # request 请求接口定义
  414. 'request' => array
  415. (
  416. 'search' => array
  417. (
  418. # 匹配的正则或函数 选填项
  419. 'option' => array
  420. (
  421. 'ids' => array('yes-id', 'in'),
  422. 'cate_id' => 'yes',
  423. 'name' => array('yes', 'like'),
  424. 'id' => 'yes',
  425. 'state' => 1,
  426. ),
  427. 'type' => 'all',
  428. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  429. 'limit' => '0,1000',
  430. 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
  431. ),
  432. 'getAll' => array
  433. (
  434. # 匹配的正则或函数 选填项
  435. 'option' => array
  436. (
  437. 'cate_id' => 'yes',
  438. 'cate_ids' => array('yes-cate_id', 'in'),
  439. 'id' => 'yes',
  440. 'state' => 1,
  441. ),
  442. 'type' => 'all',
  443. 'order' => array('id' => 'desc'),
  444. 'page' => array($page, 'list'),
  445. 'col' => $col,
  446. ),
  447. 'getRelation' => array
  448. (
  449. # 匹配的正则或函数 选填项
  450. 'option' => array
  451. (
  452. 'cate_id' => 'yes',
  453. 'cate_ids' => array('yes-cate_id', 'in'),
  454. 'noid' => array('yes-id', '!='),
  455. 'audit' => 2,
  456. 'status' => 2,
  457. 'state' => 1,
  458. ),
  459. 'type' => 'all',
  460. 'order' => array('reorder' => 'desc','id' => 'desc'),
  461. 'limit' => '0,4',
  462. 'col' => $col,
  463. ),
  464. 'getOne' => array
  465. (
  466. # 匹配的正则或函数 选填项
  467. 'where' => array
  468. (
  469. 'id' => 'yes',
  470. ),
  471. 'type' => 'one',
  472. 'col' => $col,
  473. ),
  474. # 更新浏览量
  475. 'addView' => array
  476. (
  477. 'type' => 'update',
  478. 'where' => array
  479. (
  480. 'id' => 'yes',
  481. ),
  482. 'set' => array
  483. (
  484. 'num_view' => array('1', '+='),
  485. ),
  486. ),
  487. ),
  488. );