live.php 12 KB

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