stream.php 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <?php
  2. $live = function()
  3. {
  4. $array = array();
  5. $info = Dever::db('live/info')->state();
  6. if($info)
  7. {
  8. $array += $info;
  9. }
  10. return $array;
  11. };
  12. $active = function()
  13. {
  14. $array = array();
  15. $info = Dever::db('live/active')->state();
  16. if($info)
  17. {
  18. $array += $info;
  19. }
  20. return $array;
  21. };
  22. $status = array
  23. (
  24. 1 => '未开始',
  25. 2 => '直播中',
  26. 3 => '已结束',
  27. );
  28. $disabled = array
  29. (
  30. 1 => '启动',
  31. 2 => '禁播',
  32. );
  33. return array
  34. (
  35. # 表名
  36. 'name' => 'stream',
  37. # 显示给用户看的名称
  38. 'lang' => '直播流管理',
  39. 'order' => 2,
  40. 'end' => array
  41. (
  42. //'update' => 'live/lib/manage.createStream',
  43. 'insert' => 'live/lib/manage.createStream',
  44. 'update_disabled' => 'live/lib/manage.updateDisabled',
  45. ),
  46. # 数据结构
  47. 'struct' => array
  48. (
  49. 'id' => array
  50. (
  51. 'type' => 'int-11',
  52. 'name' => 'ID',
  53. 'default' => '',
  54. 'desc' => '',
  55. 'match' => 'is_numeric',
  56. 'search' => 'order',
  57. //'list' => true,
  58. ),
  59. 'live_id' => array
  60. (
  61. 'type' => 'int-11',
  62. 'name' => '所属直播云',
  63. 'default' => '1',
  64. 'desc' => '所属直播云',
  65. 'match' => 'is_numeric',
  66. 'update' => 'select',
  67. 'option' => $live,
  68. 'search' => 'select',
  69. //'list' => true,
  70. ),
  71. 'active_id' => array
  72. (
  73. 'type' => 'int-11',
  74. 'name' => '所属活动',
  75. 'default' => '1',
  76. 'desc' => '所属活动',
  77. 'match' => 'is_numeric',
  78. 'update' => 'select',
  79. 'option' => $active,
  80. 'search' => 'select',
  81. 'list' => true,
  82. ),
  83. 'name' => array
  84. (
  85. 'type' => 'varchar-300',
  86. 'name' => '流名称',
  87. 'default' => '',
  88. 'desc' => '名称',
  89. 'match' => 'option',
  90. 'update' => 'text',
  91. 'search' => 'fulltext',
  92. 'list_name' => '流信息',
  93. 'list' => 'Dever::load("live/lib/manage.liveData", {id})',
  94. ),
  95. 'key' => array
  96. (
  97. 'type' => 'varchar-300',
  98. 'name' => '流标识-流标识在直播空间中唯一,可包含 字母、数字、中划线、下划线;1 ~ 200 个字符长,对应云上的流名称。
  99. ',
  100. 'default' => '',
  101. 'desc' => '流标识',
  102. 'match' => 'option',
  103. 'search' => 'fulltext',
  104. 'update' => 'text',
  105. //'list' => true,
  106. ),
  107. 'times' => array
  108. (
  109. 'type' => 'varchar-30',
  110. 'name' => '直播时长-直接输入小时数,默认为5个小时',
  111. 'default' => '5',
  112. 'desc' => '直播时长',
  113. 'match' => 'option',
  114. 'update' => 'text',
  115. //'list' => true,
  116. ),
  117. 'status' => array
  118. (
  119. 'type' => 'int-11',
  120. 'name' => '流状态',
  121. 'default' => '1',
  122. 'desc' => '流状态',
  123. 'match' => 'is_numeric',
  124. //'update' => 'select',
  125. 'option' => $status,
  126. 'search' => 'select',
  127. //'list' => true,
  128. ),
  129. 'live' => array
  130. (
  131. 'type' => 'varchar-800',
  132. 'name' => '推流地址',
  133. 'default' => '',
  134. 'desc' => '推流地址',
  135. 'match' => 'option',
  136. //'update' => 'text',
  137. 'list_name' => '直播地址',
  138. 'list' => 'Dever::load("live/lib/manage.live", {id})',
  139. ),
  140. 'url_rtmp' => array
  141. (
  142. 'type' => 'varchar-800',
  143. 'name' => '高清地址',
  144. 'default' => '',
  145. 'desc' => '直播地址',
  146. 'match' => 'option',
  147. //'update' => 'text',
  148. //'list' => true,
  149. ),
  150. 'url_hls' => array
  151. (
  152. 'type' => 'varchar-800',
  153. 'name' => '标清地址',
  154. 'default' => '',
  155. 'desc' => '标清地址',
  156. 'match' => 'option',
  157. //'update' => 'text',
  158. //'list' => true,
  159. ),
  160. 'url_hdl' => array
  161. (
  162. 'type' => 'varchar-800',
  163. 'name' => '普清地址',
  164. 'default' => '',
  165. 'desc' => '普清地址',
  166. 'match' => 'option',
  167. //'update' => 'text',
  168. //'list' => true,
  169. ),
  170. 'url_pic' => array
  171. (
  172. 'type' => 'varchar-800',
  173. 'name' => '直播截图地址',
  174. 'default' => '',
  175. 'desc' => '直播截图地址',
  176. 'match' => 'option',
  177. //'update' => 'text',
  178. //'list' => true,
  179. ),
  180. 'info' => array
  181. (
  182. 'type' => 'text-255',
  183. 'name' => '直播信息',
  184. 'default' => '',
  185. 'desc' => '直播信息',
  186. 'match' => 'option',
  187. //'update' => 'text',
  188. 'list' => 'Dever::load("live/lib/manage.liveInfo", {id})',
  189. ),
  190. 'disabled' => array
  191. (
  192. 'type' => 'int-11',
  193. 'name' => '禁播流',
  194. 'default' => '1',
  195. 'desc' => '禁播流',
  196. 'match' => 'is_numeric',
  197. //'update' => 'select',
  198. 'option' => $disabled,
  199. 'search' => 'select',
  200. 'list' => true,
  201. 'edit' => true,
  202. ),
  203. 'state' => array
  204. (
  205. 'type' => 'tinyint-1',
  206. 'name' => '状态',
  207. 'default' => '1',
  208. 'desc' => '请选择状态',
  209. 'match' => 'is_numeric',
  210. ),
  211. 'cdate' => array
  212. (
  213. 'type' => 'int-11',
  214. 'name' => '创建时间',
  215. 'match' => array('is_numeric', time()),
  216. 'desc' => '',
  217. # 只有insert时才生效
  218. 'insert' => true,
  219. //'search' => 'date',
  220. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  221. ),
  222. ),
  223. 'manage' => array
  224. (
  225. //'excel' => true,
  226. 'delete' => false,
  227. 'edit' => false,
  228. //'insert' => false,
  229. 'button' => array
  230. (
  231. '同步所有流' => 'live/lib/manage.getStream',
  232. ),
  233. 'list_button' => array
  234. (
  235. 'list' => array('推流日志', '"stream_log&search_option_stream_id={id}&oper_parent=stream"'),
  236. ),
  237. ),
  238. # request 请求接口定义
  239. 'request' => array
  240. (
  241. 'getAll' => array
  242. (
  243. # 匹配的正则或函数 选填项
  244. 'option' => array
  245. (
  246. 'status' => 'yes',
  247. 'online' => 'yes',
  248. 'key' => 'yes',
  249. 'state' => 1,
  250. ),
  251. 'type' => 'all',
  252. 'order' => array('id' => 'desc'),
  253. 'col' => 'id,name,live,url_rtmp,url_hls,url_hdl,url_pic',
  254. ),
  255. )
  256. );