stream.php 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  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. 'edit' => true,
  83. ),
  84. 'name' => array
  85. (
  86. 'type' => 'varchar-300',
  87. 'name' => '流名称',
  88. 'default' => '',
  89. 'desc' => '名称',
  90. 'match' => 'option',
  91. 'update' => 'text',
  92. 'search' => 'fulltext',
  93. 'list_name' => '流信息',
  94. 'list' => 'Dever::load("live/lib/manage.liveData", {id})',
  95. ),
  96. 'key' => array
  97. (
  98. 'type' => 'varchar-300',
  99. 'name' => '流标识-流标识在直播空间中唯一,可包含 字母、数字、中划线、下划线;1 ~ 200 个字符长,对应云上的流名称。
  100. ',
  101. 'default' => '',
  102. 'desc' => '流标识',
  103. 'match' => 'option',
  104. 'search' => 'fulltext',
  105. 'update' => 'text',
  106. //'list' => true,
  107. ),
  108. 'times' => array
  109. (
  110. 'type' => 'varchar-30',
  111. 'name' => '直播时长-直接输入小时数,默认为100天',
  112. 'default' => '2400',
  113. 'desc' => '直播时长',
  114. 'match' => 'option',
  115. 'update' => 'text',
  116. //'list' => true,
  117. ),
  118. 'status' => array
  119. (
  120. 'type' => 'int-11',
  121. 'name' => '流状态',
  122. 'default' => '1',
  123. 'desc' => '流状态',
  124. 'match' => 'is_numeric',
  125. //'update' => 'select',
  126. 'option' => $status,
  127. 'search' => 'select',
  128. //'list' => true,
  129. ),
  130. 'live_date' => array
  131. (
  132. 'type' => 'int-11',
  133. 'name' => '上次获取推流地址的时间',
  134. 'match' => 'is_numeric',
  135. 'default' => '',
  136. 'desc' => '',
  137. ),
  138. 'live' => array
  139. (
  140. 'type' => 'varchar-800',
  141. 'name' => '推流地址',
  142. 'default' => '',
  143. 'desc' => '推流地址',
  144. 'match' => 'option',
  145. //'update' => 'text',
  146. 'list_name' => '直播地址',
  147. 'list' => 'Dever::load("live/lib/manage.live", {id})',
  148. ),
  149. 'url_rtmp' => array
  150. (
  151. 'type' => 'varchar-800',
  152. 'name' => '高清地址',
  153. 'default' => '',
  154. 'desc' => '直播地址',
  155. 'match' => 'option',
  156. //'update' => 'text',
  157. //'list' => true,
  158. ),
  159. 'url_hls' => array
  160. (
  161. 'type' => 'varchar-800',
  162. 'name' => '标清地址',
  163. 'default' => '',
  164. 'desc' => '标清地址',
  165. 'match' => 'option',
  166. //'update' => 'text',
  167. //'list' => true,
  168. ),
  169. 'url_hdl' => array
  170. (
  171. 'type' => 'varchar-800',
  172. 'name' => '普清地址',
  173. 'default' => '',
  174. 'desc' => '普清地址',
  175. 'match' => 'option',
  176. //'update' => 'text',
  177. //'list' => true,
  178. ),
  179. 'url_pic' => array
  180. (
  181. 'type' => 'varchar-800',
  182. 'name' => '直播截图地址',
  183. 'default' => '',
  184. 'desc' => '直播截图地址',
  185. 'match' => 'option',
  186. //'update' => 'text',
  187. //'list' => true,
  188. ),
  189. 'info' => array
  190. (
  191. 'type' => 'text-255',
  192. 'name' => '直播信息',
  193. 'default' => '',
  194. 'desc' => '直播信息',
  195. 'match' => 'option',
  196. //'update' => 'text',
  197. 'list' => 'Dever::load("live/lib/manage.liveInfo", {id})',
  198. ),
  199. 'disabled' => array
  200. (
  201. 'type' => 'int-11',
  202. 'name' => '禁播流',
  203. 'default' => '1',
  204. 'desc' => '禁播流',
  205. 'match' => 'is_numeric',
  206. //'update' => 'select',
  207. 'option' => $disabled,
  208. 'search' => 'select',
  209. 'list' => true,
  210. 'edit' => true,
  211. ),
  212. 'state' => array
  213. (
  214. 'type' => 'tinyint-1',
  215. 'name' => '状态',
  216. 'default' => '1',
  217. 'desc' => '请选择状态',
  218. 'match' => 'is_numeric',
  219. ),
  220. 'cdate' => array
  221. (
  222. 'type' => 'int-11',
  223. 'name' => '创建时间',
  224. 'match' => array('is_numeric', time()),
  225. 'desc' => '',
  226. # 只有insert时才生效
  227. 'insert' => true,
  228. //'search' => 'date',
  229. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  230. ),
  231. ),
  232. 'manage' => array
  233. (
  234. //'excel' => true,
  235. 'delete' => false,
  236. 'edit' => false,
  237. //'insert' => false,
  238. 'button' => array
  239. (
  240. '同步所有流' => 'live/lib/manage.getStream',
  241. ),
  242. 'list_button' => array
  243. (
  244. 'list' => array('云推流日志', '"stream_log&search_option_stream_id={id}&oper_parent=stream"'),
  245. 'br1' => array('<br />'),
  246. 'list1' => array('IOS推流日志', '"stream_ios_log&search_option_stream_id={id}&oper_parent=stream"'),
  247. ),
  248. ),
  249. # request 请求接口定义
  250. 'request' => array
  251. (
  252. 'getAll' => array
  253. (
  254. # 匹配的正则或函数 选填项
  255. 'option' => array
  256. (
  257. 'status' => 'yes',
  258. 'online' => 'yes',
  259. 'key' => 'yes',
  260. 'live_id' => 'yes',
  261. 'active_id' => 'yes',
  262. 'state' => 1,
  263. ),
  264. 'type' => 'all',
  265. 'order' => array('id' => 'desc'),
  266. 'col' => 'id,name,live,url_rtmp,url_hls,url_hdl,url_pic',
  267. ),
  268. )
  269. );