vod.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  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,video_info';
  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. 'video_info' => array
  114. (
  115. 'type' => 'text-255',
  116. 'name' => '视频信息',
  117. 'default' => '',
  118. 'desc' => '视频信息',
  119. 'match' => 'is_string',
  120. ),
  121. 'cate_id' => array
  122. (
  123. 'type' => 'int-11',
  124. 'name' => '所属栏目',
  125. 'default' => '1',
  126. 'desc' => '所属栏目',
  127. 'match' => 'is_numeric',
  128. 'update' => 'select',
  129. 'option' => $cate,
  130. 'search' => 'select',
  131. ),
  132. 'author_id' => array
  133. (
  134. 'type' => 'int-11',
  135. 'name' => '作者',
  136. 'default' => '1',
  137. 'desc' => '作者',
  138. 'match' => 'is_numeric',
  139. 'update' => 'select',
  140. //'option' => $author,
  141. 'search' => 'select',
  142. 'update_search' => 'content/lib/author.search',
  143. ),
  144. 'tag' => array
  145. (
  146. 'type' => 'text-255',
  147. 'name' => '标签',
  148. 'default' => '',
  149. 'desc' => '标签',
  150. 'match' => 'is_numeric',
  151. 'update' => 'selects',
  152. //'search' => 'fulltext',
  153. 'update_search' => 'tag/lib/core.search',
  154. ),
  155. 'pic_cover' => array
  156. (
  157. 'type' => 'varchar-150',
  158. 'name' => '4:3封面图-图片尺寸750*564px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  159. 'default' => '',
  160. 'desc' => '封面图',
  161. 'match' => 'is_string',
  162. 'update' => 'image',
  163. 'key' => '1',
  164. 'place' => '150',
  165. //直接上传到云端
  166. //'upload' => 'qiniu',
  167. //上传大数据
  168. //'large' => true,
  169. ),
  170. 'pic_cover_169' => array
  171. (
  172. 'type' => 'varchar-150',
  173. 'name' => '16:9封面图-图片尺寸750*422px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  174. 'default' => '',
  175. 'desc' => '封面图',
  176. 'match' => 'is_string',
  177. 'update' => 'image',
  178. 'key' => '1',
  179. 'place' => '150',
  180. //直接上传到云端
  181. //'upload' => 'qiniu',
  182. //上传大数据
  183. //'large' => true,
  184. ),
  185. 'num_add_view' => array
  186. (
  187. 'type' => 'int-11',
  188. 'name' => '浏览量基数',
  189. 'default' => '0',
  190. 'desc' => '浏览量基数',
  191. 'match' => 'option',
  192. 'update' => 'text',
  193. ),
  194. 'num_view' => array
  195. (
  196. 'type' => 'int-11',
  197. 'name' => '浏览量pv',
  198. 'default' => '0',
  199. 'desc' => '请填写浏览量pv',
  200. 'match' => 'option',
  201. 'search' => 'order',
  202. //'list' => '{num_view}+{num_add_view}',
  203. ),
  204. 'num_add_up' => array
  205. (
  206. 'type' => 'int-11',
  207. 'name' => '喜欢基数',
  208. 'default' => '0',
  209. 'desc' => '喜欢基数',
  210. 'match' => 'option',
  211. 'update' => 'text',
  212. ),
  213. 'num_up' => array
  214. (
  215. 'type' => 'int-11',
  216. 'name' => '喜欢数',
  217. 'default' => '0',
  218. 'desc' => '请填写喜欢数',
  219. 'match' => 'option',
  220. //'search' => 'order',
  221. 'list' => '"喜欢数:{num_up}+{num_add_up}<br />浏览量:{num_view}+{num_add_view}<br />评论数:{num_comment}<br />"',
  222. 'list_name' => '统计数字',
  223. ),
  224. 'num_comment' => array
  225. (
  226. 'type' => 'int-11',
  227. 'name' => '评论数',
  228. 'default' => '0',
  229. 'desc' => '请填写评论数',
  230. 'search' => 'order',
  231. 'match' => 'option',
  232. //'list' => true,
  233. ),
  234. 'state' => array
  235. (
  236. 'type' => 'tinyint-1',
  237. 'name' => '状态',
  238. 'default' => '1',
  239. 'desc' => '请选择状态',
  240. 'match' => 'is_numeric',
  241. ),
  242. 'admin_founder' => array
  243. (
  244. 'type' => 'int-11',
  245. 'name' => '创建人',
  246. 'default' => '1',
  247. 'desc' => '创建人',
  248. 'match' => 'is_numeric',
  249. ),
  250. 'admin_editor' => array
  251. (
  252. 'type' => 'int-11',
  253. 'name' => '操作人',
  254. 'default' => '1',
  255. 'desc' => '操作人',
  256. 'match' => 'is_numeric',
  257. ),
  258. 'pdate' => array
  259. (
  260. 'type' => 'int-11',
  261. 'name' => '发布时间',
  262. 'match' => array('is_numeric', time()),
  263. 'default' => '',
  264. 'desc' => '',
  265. 'update' => 'date',
  266. 'callback' => 'maketime',
  267. 'insert' => true,
  268. //'list' => 'date("Y-m-d H:i:s", {pdate})',
  269. 'auth' => '"{pdate}" > 0',
  270. ),
  271. 'share' => array
  272. (
  273. 'type' => 'text-255',
  274. 'name' => '分享海报-选择海报库中的海报',
  275. 'default' => '',
  276. 'desc' => '分享海报',
  277. 'match' => 'option',
  278. //'update' => 'checkbox',
  279. 'option' => $share,
  280. ),
  281. 'reorder' => array
  282. (
  283. 'type' => 'int-11',
  284. 'name' => '排序(数值越大越靠前)',
  285. 'default' => '1',
  286. 'desc' => '请输入排序',
  287. 'match' => 'option',
  288. //'update' => 'text',
  289. 'search' => 'order',
  290. //'list' => true,
  291. 'order' => 'desc',
  292. //'edit' => true,
  293. ),
  294. 'udate' => array
  295. (
  296. 'type' => 'int-11',
  297. 'name' => '更新时间',
  298. 'match' => array('is_numeric', time()),
  299. 'desc' => '',
  300. ),
  301. 'function' => array
  302. (
  303. 'type' => 'varchar-100',
  304. 'name' => '功能选择',
  305. 'default' => '1,2,3',
  306. 'desc' => '功能选择',
  307. 'match' => 'option',
  308. 'update' => 'checkbox',
  309. 'option' => $function,
  310. ),
  311. 'share_yes' => array
  312. (
  313. 'type' => 'int-11',
  314. 'name' => '是否显示分享按钮',
  315. 'default' => '1',
  316. 'desc' => '是否显示分享按钮',
  317. 'match' => 'option',
  318. 'update' => 'radio',
  319. 'option' => $share,
  320. 'control' => 'share_yes',
  321. ),
  322. 'share_title' => array
  323. (
  324. 'type' => 'varchar-100',
  325. 'name' => '分享标题',
  326. 'default' => '',
  327. 'desc' => '分享标题',
  328. 'match' => 'option',
  329. 'update' => 'text',
  330. 'show' => 'share_yes=1',
  331. ),
  332. 'share_pic' => array
  333. (
  334. 'type' => 'varchar-150',
  335. 'name' => '分享图片-图片尺寸570*570px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  336. 'default' => '',
  337. 'desc' => '分享图片',
  338. 'match' => 'is_string',
  339. 'update' => 'image',
  340. 'key' => '1',
  341. 'place' => '150',
  342. 'show' => 'share_yes=1',
  343. //'upload' => 'qiniu',
  344. //'large' => true,
  345. ),
  346. 'share_content' => array
  347. (
  348. 'type' => 'varchar-200',
  349. 'name' => '分享内容',
  350. 'default' => '',
  351. 'desc' => '分享内容',
  352. 'match' => 'option',
  353. 'update' => 'textarea',
  354. 'show' => 'share_yes=1',
  355. ),
  356. 'content' => array
  357. (
  358. 'type' => 'text-255',
  359. 'name' => '内容',
  360. 'default' => '',
  361. 'desc' => '请输入内容',
  362. 'match' => 'is_string',
  363. 'update' => 'editor',
  364. 'key' => 1,
  365. ),
  366. 'audit' => array
  367. (
  368. 'type' => 'int-11',
  369. 'name' => '审核状态',
  370. 'default' => '1',
  371. 'desc' => '审核',
  372. 'match' => 'is_numeric',
  373. //'update' => 'select',
  374. 'option' => $audit,
  375. 'search' => 'select',
  376. 'list' => true,
  377. 'edit' => true,
  378. ),
  379. 'status' => array
  380. (
  381. 'type' => 'int-11',
  382. 'name' => '发布状态',
  383. 'default' => '1',
  384. 'desc' => '发布状态',
  385. 'match' => 'is_numeric',
  386. //'update' => 'select',
  387. 'option' => $status,
  388. 'search' => 'select',
  389. 'list' => true,
  390. 'edit' => true,
  391. ),
  392. 'cdate' => array
  393. (
  394. 'type' => 'int-11',
  395. 'name' => '录入时间',
  396. 'match' => array('is_numeric', time()),
  397. 'desc' => '',
  398. # 只有insert时才生效
  399. 'insert' => true,
  400. ),
  401. ),
  402. # 索引
  403. 'index' => array
  404. (
  405. 'version' => 1,
  406. 1 => array
  407. (
  408. 'i1' => 'uid,cate_id',
  409. )
  410. ),
  411. # 管理功能
  412. 'manage' => array
  413. (
  414. //'insert' => false,
  415. # 列表
  416. 'list_button' => array
  417. (
  418. 'edit' => array('预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=2'))),
  419. ),
  420. ),
  421. # request 请求接口定义
  422. 'request' => array
  423. (
  424. 'search' => array
  425. (
  426. # 匹配的正则或函数 选填项
  427. 'option' => array
  428. (
  429. 'ids' => array('yes-id', 'in'),
  430. 'cate_id' => 'yes',
  431. 'name' => array('yes', 'like'),
  432. 'id' => 'yes',
  433. 'state' => 1,
  434. ),
  435. 'type' => 'all',
  436. 'order' => array('reorder' => 'desc', 'pdate' => 'desc'),
  437. 'limit' => '0,1000',
  438. 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
  439. ),
  440. 'getAll' => array
  441. (
  442. # 匹配的正则或函数 选填项
  443. 'option' => array
  444. (
  445. 'cate_id' => 'yes',
  446. 'cate_ids' => array('yes-cate_id', 'in'),
  447. 'id' => 'yes',
  448. 'state' => 1,
  449. ),
  450. 'type' => 'all',
  451. 'order' => array('pdate' => 'desc'),
  452. 'page' => array($page, 'list'),
  453. 'col' => $col,
  454. ),
  455. 'getRelation' => array
  456. (
  457. # 匹配的正则或函数 选填项
  458. 'option' => array
  459. (
  460. 'cate_id' => 'yes',
  461. 'cate_ids' => array('yes-cate_id', 'in'),
  462. 'noid' => array('yes-id', '!='),
  463. 'audit' => 2,
  464. 'status' => 2,
  465. 'state' => 1,
  466. ),
  467. 'type' => 'all',
  468. 'order' => array('reorder' => 'desc','pdate' => 'desc'),
  469. 'limit' => '0,4',
  470. 'col' => $col,
  471. ),
  472. 'getOne' => array
  473. (
  474. # 匹配的正则或函数 选填项
  475. 'where' => array
  476. (
  477. 'id' => 'yes',
  478. ),
  479. 'type' => 'one',
  480. 'col' => $col,
  481. ),
  482. # 更新浏览量
  483. 'addView' => array
  484. (
  485. 'type' => 'update',
  486. 'where' => array
  487. (
  488. 'id' => 'yes',
  489. ),
  490. 'set' => array
  491. (
  492. 'num_view' => array('1', '+='),
  493. ),
  494. ),
  495. ),
  496. );