| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283 | <?php$live = function(){    $array = array();    $info = Dever::db('live/info')->state();    if($info)    {        $array += $info;    }    return $array;};$active = function(){    $array = array();    $info = Dever::db('live/active')->state();    if($info)    {        $array += $info;    }    return $array;};$status = array(    1 => '未开始',    2 => '直播中',    3 => '已结束',);$disabled = array(    1 => '启动',    2 => '禁播',);return array(    # 表名    'name' => 'stream',    # 显示给用户看的名称    'lang' => '直播流管理',    'order' => 2,    'end' => array    (        //'update' => 'live/lib/manage.createStream',        'insert' => 'live/lib/manage.createStream',        'update_disabled' => 'live/lib/manage.updateDisabled',    ),    # 数据结构    'struct' => array    (            'id'        => array        (            'type'      => 'int-11',            'name'      => 'ID',            'default'   => '',            'desc'      => '',            'match'     => 'is_numeric',            'search'    => 'order',            //'list'        => true,        ),        'live_id'       => array        (            'type'      => 'int-11',            'name'      => '所属直播云',            'default'   => '1',            'desc'      => '所属直播云',            'match'     => 'is_numeric',            'update'    => 'select',            'option'    => $live,            'search'    => 'select',            //'list'      => true,        ),        'active_id'       => array        (            'type'      => 'int-11',            'name'      => '所属活动',            'default'   => '1',            'desc'      => '所属活动',            'match'     => 'is_numeric',            'update'    => 'select',            'option'    => $active,            'search'    => 'select',            'list'      => true,        ),        'name'      => array        (            'type'      => 'varchar-300',            'name'      => '流名称',            'default'   => '',            'desc'      => '名称',            'match'     => 'option',            'update'    => 'text',            'search'    => 'fulltext',            'list_name' => '流信息',            'list'      => 'Dever::load("live/lib/manage.liveData", {id})',        ),        'key'      => array        (            'type'      => 'varchar-300',            'name'      => '流标识-流标识在直播空间中唯一,可包含 字母、数字、中划线、下划线;1 ~ 200 个字符长,对应云上的流名称。',            'default'   => '',            'desc'      => '流标识',            'match'     => 'option',            'search'    => 'fulltext',            'update'    => 'text',            //'list'      => true,        ),        'times'      => array        (            'type'      => 'varchar-30',            'name'      => '直播时长-直接输入小时数,默认为5个小时',            'default'   => '5',            'desc'      => '直播时长',            'match'     => 'option',            'update'    => 'text',            //'list'      => true,        ),        'status'       => array        (            'type'      => 'int-11',            'name'      => '流状态',            'default'   => '1',            'desc'      => '流状态',            'match'     => 'is_numeric',            //'update'    => 'select',            'option'    => $status,            'search'    => 'select',            //'list'      => true,        ),        'live'      => array        (            'type'      => 'varchar-800',            'name'      => '推流地址',            'default'   => '',            'desc'      => '推流地址',            'match'     => 'option',            //'update'    => 'text',            'list_name'      => '直播地址',            'list'      => 'Dever::load("live/lib/manage.live", {id})',        ),        'url_rtmp'      => array        (            'type'      => 'varchar-800',            'name'      => '高清地址',            'default'   => '',            'desc'      => '直播地址',            'match'     => 'option',            //'update'    => 'text',            //'list'      => true,        ),        'url_hls'      => array        (            'type'      => 'varchar-800',            'name'      => '标清地址',            'default'   => '',            'desc'      => '标清地址',            'match'     => 'option',            //'update'    => 'text',            //'list'      => true,        ),        'url_hdl'      => array        (            'type'      => 'varchar-800',            'name'      => '普清地址',            'default'   => '',            'desc'      => '普清地址',            'match'     => 'option',            //'update'    => 'text',            //'list'      => true,        ),        'url_pic'      => array        (            'type'      => 'varchar-800',            'name'      => '直播截图地址',            'default'   => '',            'desc'      => '直播截图地址',            'match'     => 'option',            //'update'    => 'text',            //'list'      => true,        ),        'info'      => array        (            'type'      => 'text-255',            'name'      => '直播信息',            'default'   => '',            'desc'      => '直播信息',            'match'     => 'option',            //'update'    => 'text',            'list'      => 'Dever::load("live/lib/manage.liveInfo", {id})',        ),        'disabled'       => array        (            'type'      => 'int-11',            'name'      => '禁播流',            'default'   => '1',            'desc'      => '禁播流',            'match'     => 'is_numeric',            //'update'    => 'select',            'option'    => $disabled,            'search'    => 'select',            'list'      => true,            'edit'      => true,        ),        'state'     => array        (            'type'      => 'tinyint-1',            'name'      => '状态',            'default'   => '1',            'desc'      => '请选择状态',            'match'     => 'is_numeric',        ),                'cdate'     => array        (            'type'      => 'int-11',            'name'      => '创建时间',            'match'     => array('is_numeric', time()),            'desc'      => '',            # 只有insert时才生效            'insert'    => true,            //'search'  => 'date',            //'list'      => 'date("Y-m-d H:i:s", {cdate})',        ),    ),    'manage' => array    (        //'excel'   => true,        'delete' => false,        'edit' => false,        //'insert' => false,        'button' => array        (            '同步所有流' => 'live/lib/manage.getStream',        ),        'list_button' => array        (            'list' => array('推流日志', '"stream_log&search_option_stream_id={id}&oper_parent=stream"'),        ),    ),    # request 请求接口定义    'request' => array    (        'getAll' => array        (            # 匹配的正则或函数 选填项            'option' => array            (                'status' => 'yes',                'online' => 'yes',                'key' => 'yes',                'state' => 1,            ),            'type' => 'all',            'order' => array('id' => 'desc'),            'col' => 'id,name,live,url_rtmp,url_hls,url_hdl,url_pic',        ),    ));
 |