# 直播

# 创建直播

# 接口调用说明:

POST https://lxapi.lexiangla.com/cgi-bin/v1/lives

# 请求document

{
    "data": {
        "type": "live",
        "attributes": {
            "title": "直播名称",
            "started_at": "2020-02-15 14:00",
            "intro": "简介",
            "content": "内容",
            "push_method": "pc",
            "vertical": 0,
            "privilege_type": 1,
            "enable_question": 0,
            "enable_comment": 0,
            "enable_gift": 1,
            "enable_record": 1,
            "enable_playback": 1,
            "auto_transfer_class": 0,
            "live_type": 0,
            "password": "9999"
        },
        "relationships": {
            "course_category": {
                "data": {
                    "type": "category",
                    "id": "df9ff2da9d0911e79c0d4dffcdXXXXX"
                }
            },
            "class_category": {
                "data": {
                    "type": "category",
                    "id": "63f00a24da8511e9ab8c0242ac1XXXXX"
                }
            },
            "category": {
                  "data": {
                      "type": "category",
                      "id": "687803b463e211ed9d5db2cce8fbxxxx"
                  }
              },
            "streamer": {
                "data": [{
                    "type": "staff",
                    "id": "xxx"
                }]
            },
            "managers": {
                "data": [{
                        "type": "staff",
                        "id": "xxx"
                    },
                    {
                        "type": "staff",
                        "id": "xxx"
                    }
                ]
            },
            "privilege": {
                "data": [{
                    "type": "staff",
                    "id": "xxx"
                }]
            }
        }
    }
}

# 参数说明:

参数 是否必须 默认值 说明
live.type 资源对象类型,为live,表示资源为直播
live.title 直播的标题
live.intro 直播的简介
live.content 直播详情
live.pic 直播的封面
live.push_method wechat work 直播类型(wechat work, pc)
live.started_at 直播的开始时间
live.privilege_type 0 0表示公开
1表示部分人可见,需要配合 privilege 参数使用
live.enable_question 1 直播提问功能,1表示开启;0表示关闭
live.enable_comment 1 直播评论功能,1表示开启;0表示关闭
live.enable_gift 1 直播礼物开关,1表示开启;0表示关闭
live.enable_record 1 直播录制开关,1表示开启;0表示关闭
live.live_type 0 0表示直播不对外可访问;1表示直播对外可访问
live.vertical 0 0表示横屏直播;1表示竖屏直播;pc推荐设置横屏直播
live.password 允许直播对外可访问时,可以选择设置密码,4位数字类字符串,如"0000"
live.enable_playback 直接观看录制视频 (开启后成员进入直播后可直接观看回放视频),当enable_record为1时有效,0表示未开启,1表示开启,且与live.auto_transfer_class不可同时开启
live.auto_transfer_class 通过自动生成回放课程观看 (开启后会自动将录制的直播视频生成回放课程),当enable_record为1时有效,0表示未开启,1表示开启,且与live.enable_playback不可同时开启
relationships.class_category_id auto_transfer_class1时,需要制定直播的直播所属的课程分类。
relationships.course_category_id auto_transfer_class为1时,需要制定直播的直播所属的课程素材分类。
relationships.category 其他 关联的直播分类信息
relationships.managers 直播主持人
relationships.streamer 直播讲师
relationships.privilege 部分人可见

# SDK封装方法使用示例:

$attributes = [
    'title' => '通过开放接口创建的直播',
    'started_at' => '2022-05-16 12:20',
    'streamer_ids' => ['STAFF_ID1'],

];
$options = [
    'intro' => '简介',
    'content' => '内容',
    'pic' => 'https://lexiangla.com',
    'push_method' => 'pc',
    'privilege_type' => 1,
    'enable_question' => 0,
    'enable_comment' => 0,
    'enable_gift'=>1,
    'enable_record'=>0,
    'live_type' => 1,
    'vertical' => 0,
    'password' => '0000',
    'auto_transfer_class' => true,
    'class_category_id' => '4545f44cbaf411eca3c78afdd6c3e2cd',
    'course_category_id' => 'e76d9452254e11eaaf8b0a58ac1300e7',
    'manager_ids' => ['STAFF_ID2','STAFF_ID3'],
    'privilege' => [
        ['type' => 'department', 'id' => '1'],
        ['type' => 'contact_tag', 'id' => '1'],
    ]
];
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->postLive(StaffID, $attributes, $options);

# 响应document

# 201 Created 状态码
{
    "data": {
        "type": "live",
        "id": "05e6dcb2a8bc11ebb9255280777ff052",
        "attributes": {
            "title": "通过开放接口创建的直播",
            "started_at": "2021-04-25 14:00:00",
            "status": "init",
            "push_url": "rtmp://livepush.lexiangla.com/live/xxxxxx?txSecret=xxxx&txTime=xx",
            "visit_count": 0,
            "push_method": "wechat work",
            "live_type": 0,
            "is_face_detect": 0,
            "vertical": 0,
            "enable_question": 0,
            "enable_comment": 0,
            "enable_gift":1,
            "video_duration": 0,
            "watch_duration": 0,
            "enable_playback":1,
            "enable_record":1,
            "wx_code": "",
            "wx_open_code": "",
            "created_at": "2021-04-29 15:25:07",
            "updated_at": "2021-04-29 15:25:07"
        },
        "links": {
            "platform": "https://lexiangla.com/lives/05e6dcb2a8bc11ebb9255280777ff052?company_from=xxx",
            "manager": "https://lexiangla.com/lives/05e6dcb2a8bc11ebb9255280777ff052/settings?company_from=xxx",
            "qrcodeurl": "https://lexiangla.com/livepush?room_id=05e6dcb2a8bc11ebb9255280777ff052&company_from=xxx",
            "open": ""
        }
    },
    "links": {
        "self": "https://lxapi.lexiangla.com/cgi-bin/v1/lives/05e6dcb2a8bc11ebb9255280777ff052"
    }
}

# 参数说明

参数 说明
live.type 资源对象类型,为live,表示资源为直播
live.id 直播实体id
title 直播的标题
status 直播的状态(init:初始化, waiting:等待, pushing:推流状态, finished:完成)
push_method 直播类型(wechat work, pc)
push_url pc推流地址
live_type 是否为公开直播;0表示直播不对外可访问;1表示直播对外可访问
enable_question 直播提问功能,1表示开启;0表示关闭
enable_comment 直播评论功能,1表示开启;0表示关闭
enable_gift 直播礼物开关,1表示开启;0表示关闭
vertical 0表示横屏直播;1表示竖屏直播;pc推荐设置横屏直播
wx_code 小程序码(需要等待一分钟左右通过获取单场直播信息获取到小程序码,乐享网站及小程序外无法直接使用此小程序码图片地址
wx_open_code 微信公开直播的手机端查看小程序码 (需要等待一分钟左右通过获取单场直播信息获取到小程序码,乐享网站及小程序外无法直接使用此小程序码图片地址)
started_at 直播的开始时间
created_at 直播的创建时间
updated_at 直播的更新时间
visit_count 直播总观看次数
video_duration 直播的时长
relationships.owner 直播的创建人
relationships.streamer 直播讲师
links.platform 当前直播的查看地址
links.manager 当前直播的管理地址

# 编辑直播

# 接口调用说明:

PATCH https://lxapi.lexiangla.com/cgi-bin/v1/lives/{live_id}

# 请求document

{
    "data":{
        "type":"live",
        "attributes":{
            "title":"通过开放接口创建的直播",
            "started_at":"2021-04-28 15:50",
            "intro":"简介",
            "content":"内容",
            "push_method":"wechat work",
			"status":"finished",
			"enable_question": 1,
            "enable_comment": 1,
            "enable_gift":0,
            "enable_record":0,
            "privilege_type":1
			
        },
        "relationships":{
            "category": {
                "data": {
                    "type": "category",
                    "id": "c5bde5b886e811ef9ff2227b612247be"
                }
            },
            "streamer":{
                "data":[
                    {
                        "type":"staff",
                        "id":"xxx"
                    }
                ]
            },
            "managers":{
                "data":[
                    {
                        "type":"staff",
                        "id":"xxx"
                    },
                    {
                        "type":"staff",
                        "id":"xxx"
                    }
                ]
            },
            "privilege":{
                "data":[
                    {
                        "type":"staff",
                        "id":"xxx"
                    }
                ]
            }
        }
    }
}

# 参数说明:(参数缺省时不会发生变化)

参数 是否必须 默认值 说明
live_id 资源对象类型为live的资源对象id,即直播id
live.title 直播的标题
live.intro 直播的简介
live.content 直播详情
live.pic 直播的封面
live.push_method 直播类型(wechat work, pc)
live.live_type 0 0表示直播不对外可访问;1表示直播对外可访问
live.vertical 0 0表示横屏直播;1表示竖屏直播;pc推荐设置横屏直播
live.started_at 直播的开始时间
live.enable_question 1 直播提问功能,1表示开启;0表示关闭
live.enable_comment 1 直播评论功能,1表示开启;0表示关闭
live.enable_gift 1 直播礼物开关,1表示开启;0表示关闭
live.enable_record 1 直播录制开关,1表示开启;0表示关闭(正在直播或已结束状态,不可更改直播录制字段)
live.privilege_type 0 0表示公开
1表示部分人可见,需要配合 privilege 参数使用
live.status status=finished为结束直播(此字段仅支持结束直播)
relationships.managers 直播主持人
relationships.category 其他 关联的直播分类信息
relationships.streamer 直播讲师
relationships.privilege 部分人可见

# SDK封装方法使用示例:

$options = [
    'title' => '通过开放接口编辑的直播',
    'started_at' => '2022-05-14 05:20',
    'streamer_ids' => ['STAFF_ID1'],
    'intro' => '简介',
    'content' => '内容',
    'pic' => 'https://lexiangla.com',
    'push_method' => 'pc',
    'live_type' => 1,
    'enable_question' => 0,
    'enable_comment' => 0,
    'enable_gift'=>1,
    'enable_record'=>0,
    'privilege_type' => 0,
    //'status'=>'finished',
    'manager_ids' => ['STAFF_ID2', 'STAFF_ID3'],
    'privilege' => [
        ['type' => 'department', 'id' => '2'],
        ['type' => 'contact_tag', 'id' => '1']
    ]
];
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->patchLive(StaffID, LiveID, $options);

# 响应document

# 200 OK 状态码
{
    "data": {
        "type": "live",
        "id": "6b3b67fca7f611ebb7306ee2eaa40214",
        "attributes": {
            "title": "通过开放接口创建的直播",
            "started_at": "2021-04-28 15:50:00",
            "status": "finished",
            "push_url": "rtmp://livepush.lexiangla.com/live/xxxxxx?txSecret=xxxx&txTime=xx",
            "visit_count": 3,
            "push_method": "wechat work",
            "live_type": 0,
            "is_face_detect": 0,
            "vertical": 0,
            "enable_question": 1,
            "enable_comment": 1,
            "enable_commit":0,
            "enable_gift":0,
            "video_duration": 0,
            "watch_duration": 0,
            "wx_code": "https://image-pub.lexiang-asset.com/company_xxx/assets/2021/4/6b3b67fca7f611ebb7306ee2eaa40214.png",
            "wx_open_code": "",
            "created_at": "2021-04-28 15:50:36",
            "updated_at": "2021-04-28 15:51:42"
        },
        "links": {
            "platform": "https://lexiangla.com/lives/6b3b67fca7f611ebb7306ee2eaa40214?company_from=xxx",
            "manager": "https://lexiangla.com/lives/6b3b67fca7f611ebb7306ee2eaa40214/settings?company_from=xxx",
            "qrcodeurl": "https://lexiangla.com/livepush?room_id=6b3b67fca7f611ebb7306ee2eaa40214&company_from=xxx",
            "open": ""
        }
    },
    "links": {
        "self": "https://lxapi.lexiangla.com/cgi-bin/v1/lives/6b3b67fca7f611ebb7306ee2eaa40214"
    }
}

# 参数说明

参数 说明
live.type 资源对象类型,为live,表示资源为直播
live.id 直播实体id
title 直播的标题
status 直播的状态(init:初始化, waiting:等待, pushing:推流状态, finished:完成)
push_method 直播类型(wechat work, pc)
push_url pc推流地址
live_type 是否为公开直播;0表示直播不对外可访问;1表示直播对外可访问
enable_question 直播提问功能,1表示开启;0表示关闭
enable_comment 直播评论功能,1表示开启;0表示关闭
enable_gift 直播礼物开关,1表示开启;0表示关闭
vertical 0表示横屏直播;1表示竖屏直播;pc推荐设置横屏直播
wx_code 小程序码(乐享网站及小程序外无法直接使用此小程序码图片地址
started_at 直播的开始时间
created_at 直播的创建时间
updated_at 直播的更新时间
visit_count 直播总观看次数
video_duration 直播的时长
relationships.owner 直播的创建人
relationships.streamer 直播讲师
links.platform 当前直播的查看地址
links.open 微信公开直播的pc端查看地址
links.manager 当前直播的管理地址

# 删除直播

# 接口调用说明:

DELETE https://lxapi.lexiangla.com/cgi-bin/v1/lives/{live_id}

# 参数说明:

参数 是否必须 默认值 说明
live_id 资源对象类型为 live 的资源对象id,即直播id

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->deleteLive(StaffID, live_id);

# 响应document

# 204 No Content 状态码

# 获取直播列表

# 接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/lives

# 参数说明:

支持分页参数和排序:(通用说明?

支持时间范围过滤

参数 是否必须 默认值 说明
page 1 当前页数
per_page 20 每页返回的数量
team_id K吧id
filter[started_at][since] 直播的开始时间:开始日期(包含)。格式:2023-03-08
filter[started_at][until] 直播的开始时间:结束日期(不包含)。格式:2023-03-08
status 直播的状态:init表示初始化; waiting表示等待; pushing表示推流状态; finished:表示完成

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('lives', [
    'page'=> 1,
    'per_page' => 3,
]);

# 响应document

# 200 OK 状态码
{
    "data": [{
            "type": "live",
            "id": "a2ba166005d211eebbeeca612ba1918d",
            "attributes": {
                "title": "直播1",
                "started_at": "2023-06-08 16:01:00",
                "visit_count": 25,
                "video_duration": 7159,
                "status": "waiting",
                "push_method": "pc",
                "push_url": "rtmp://livepush.lexiangla.com/live/a2ba166005d211eebbeeca612ba1xxx?txSecret=472075ceefd6dc3d10ee62247b6xxxx&txTime=648AC53C&vod_sub_app_id=14003110xx",
                "wx_code": "https://image-pub.lexiang-asset.com/company_85535ed0c66311e5a2f8bf5011933e87/assets/2023/06/a2ba166005d211eebbeeca612ba19xxx.png",
                "created_at": "2023-06-08 16:01:12",
                "updated_at": "2023-06-08 18:01:01",
                "online_max_count": 4,
                "subscribe_count": 0,
                "pic": ""
            },
            "links": {
                "platform": "https://abc.lexiangla.com/lives/a2ba166005d211eebbeeca612ba1xxx",
                "manager": "https://abc.lexiangla.com/lives/a2ba166005d211eebbeeca612ba1xxx/settings",
                "open": ""
            },
            "relationships": {
                "owner": {
                    "data": {
                        "type": "staff",
                        "id": "lisi"
                    }
                },
                "streamer": {
                    "data": {
                        "type": "staff",
                        "id": "lisi"
                    }
                },
                "category": {
                    "data": {
                        "type": "category",
                        "id": "c5bde5b886e811ef9ff2227b612247be"
                    }
                }
            }
        }
    },
    {
        "type": "live",
        "id": "53489355e86e4ecea59b31ee072d89a9",
        "attributes": {
            "title": "直播2",
            "started_at": "2023-06-08 16:56:00",
            "visit_count": 32,
            "video_duration": 739,
            "status": "waiting",
            "push_method": "wechat work",
            "push_url": "rtmp://livepush.lexiangla.com/live/53489355e86e4ecea59b31ee072dxxx?txSecret=f442a5bbd0ff488e0f2f92a8df712554&txTime=648AD220&vod_sub_app_id=1400311082",
            "wx_code": "https://image-pub.lexiang-asset.com/company_85535ed0c66311e5a2f8bf5011933e87/assets/2023/06/53489355e86e4ecea59b31ee072dxxx.png",
            "created_at": "2023-06-08 15:56:37",
            "updated_at": "2023-06-08 16:46:54",
            "online_max_count": 5,
            "subscribe_count": 0,
            "pic": ""
        },
        "links": {
            "platform": "https://km.lexiangla.com/lives/53489355e86e4ecea59b31ee072d8xxx",
            "manager": "https://km.lexiangla.com/lives/53489355e86e4ecea59b31ee072d8xxx/settings",
            "open": ""
        },
        "relationships": {
            "owner": {
                "data": {
                    "type": "staff",
                    "id": "zhangshan"
                }
            },
            "streamer": {
                "data": {
                    "type": "staff",
                    "id": "zhangshan"
                }
            },
            "category": {
                "data": {
                    "type": "category",
                    "id": "c5bde5b886e811ef9ff2227b612247be"
                }
            }
        }
    }
],
"links": {
    "first": "https://lxapi.lexiangla.com/cgi-bin/v1/lives?filter%5Bstarted_at%5D%5Bsince%5D=2023-03-08&filter%5Bstarted_at%5D%5Buntil%5D=2023-06-09&per_page=2&page=1",
    "last": "https://lxapi.lexiangla.com/cgi-bin/v1/lives?filter%5Bstarted_at%5D%5Bsince%5D=2023-03-08&filter%5Bstarted_at%5D%5Buntil%5D=2023-06-09&per_page=2&page=86",
    "prev": null,
    "next": "https://lxapi.lexiangla.com/cgi-bin/v1/lives?filter%5Bstarted_at%5D%5Bsince%5D=2023-03-08&filter%5Bstarted_at%5D%5Buntil%5D=2023-06-09&per_page=2&page=2"
},
"meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 86,
    "path": "https://lxapi.lexiangla.com/cgi-bin/v1/lives",
    "per_page": 2,
    "to": 2,
    "total": 172
},
"included": [{
        "type": "staff",
        "id": "lisi",
        "attributes": {
            "name": "lisi",
            "english_name": null,
            "organization": "140 "
        }
    },
    {
        "type": "staff",
        "id": "zhangshan",
        "attributes": {
            "name": "zhangshan",
            "english_name": null,
            "organization": "145 部门"
        }
    },
    {
        "type": "category",
        "id": "c5bde5b886e811ef9ff2227b612247be",
        "attributes": {
            "name": "其他",
            "weight": 0
        }
    }
]
}

# 参数说明

参数 说明
live.type 资源对象类型,为live,表示资源为直播
live.id 直播实体id
title 直播的标题
status 直播的状态(init:初始化, waiting:等待, pushing:推流状态, finished:完成)
push_method 直播类型(wechat work, pc)
push_url pc推流地址
wx_code 小程序码(乐享网站及小程序外无法直接使用此小程序码图片地址
pic 直播封面图
started_at 直播的开始时间
created_at 直播的创建时间
updated_at 直播的更新时间
visit_count 直播总观看次数
online_max_count 直播最高在线人数
video_duration 直播的时长
relationships.owner 直播的创建人
relationships.streamer 直播讲师
relationships.category 关联的直播分类信息

# 获取单场直播信息

# 接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/lives/{live_id}

# 参数说明:

支持分页参数和排序:(通用说明?

参数 是否必须 默认值 说明
live_id 直播id
with_count 1 with_count=1,才能获取到点赞、评论、提问、直播总观看人数等数据

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('lives/254ef3a690d911ea87a68a420c870857');

# 响应document

# 200 OK 状态码
{
    "data": {
        "type": "live",
        "id": "0518324e8f8211ef9102367387b7eda2",
        "attributes": {
            "title": "直播名称7777",
            "started_at": "2024-10-22 14:00:00",
            "visit_count": 1,
            "status": "init",
            "push_method": "pc",
            "push_url": "rtmp://livepush.lexiangla.com/live/0518324e8f8211ef9102367387b7eda2?txSecret=e5c163717a2bb9f9fa8a1bf5534b4381&txTime=672079E0&vod_sub_app_id=1400311082",
            "live_type": 0,
            "video_duration": 0,
            "wx_code": "https://image-pub.lexiang-asset.com/company_85535ed0c66311e5a2f8bf5011933e87/assets/2024/10/0518324e8f8211ef9102367387b7eda2.png",
            "wx_open_code": "",
            "created_at": "2024-10-21 15:56:46",
            "updated_at": "2024-10-21 16:00:53",
            "vertical": 0,
            "pic": "",
            "intro": "简介",
            "content": "<p>内容</p>",
            "subscribe_count": 0,
            "transfer_status": 0,
            "question_count": 0,
            "question_staff_count": 0,
            "chat_count": 0,
            "chat_staff_count": 0,
            "staff_count": 1,,
            "gift_count": 23,
            "gift_staff_count": 6,
            "like_count": 0
        },
        "links": {
            "platform": "https://km.lexiangla.com/lives/0518324e8f8211ef9102367387b7eda2",
            "manager": "https://km.lexiangla.com/lives/0518324e8f8211ef9102367387b7eda2/settings",
            "open": ""
        },
        "relationships": {
            "owner": {
                "data": {
                    "type": "staff",
                    "id": "zhangsan"
                }
            },
            "streamer": {
                "data": {
                    "type": "staff",
                    "id": "zhangsan"
                }
            },
            "managers": {
                "data": [
                    {
                        "type": "staff",
                        "id": "lisi"
                    },
                    {
                        "type": "staff",
                        "id": "wangwu"
                    }
                ]
            },
            "category": {
                "data": {
                    "type": "category",
                    "id": "c5bde5b886e811ef9ff2227b612247be"
                }
            }
        }
    },
    "included": [
        {
            "type": "staff",
            "id": "zhangsan",
            "attributes": {
                "name": "zhangsan",
                "english_name": null,
                "organization": "1\\2 "
            }
        },
        {
            "type": "staff",
            "id": "lisi",
            "attributes": {
                "name": "lisi",
                "english_name": null,
                "organization": "1\\2 "
            }
        },
        {
            "type": "staff",
            "id": "wangwu",
            "attributes": {
                "name": "wangwu",
                "english_name": null,
                "organization": "1\\140 开发"
            }
        },
        {
            "type": "category",
            "id": "c5bde5b886e811ef9ff2227b612247be",
            "attributes": {
                "name": "其他",
                "weight": 0
            }
        }
    ],
    "links": {
        "self": "https://lxapi.lexiangla.com/cgi-bin/v1/lives/0518324e8f8211ef9102367387b7eda2"
    }
}

# 参数说明:

参数 说明
live.type 资源对象类型,为lives,表示资源为直播
live.id 直播实体id
title 直播的标题
status 直播的状态(init:初始化, waiting:等待, pushing:推流状态, finished:完成)
push_method 直播类型(wechat work, pc)
push_url pc推流地址
live_type 是否为公开直播;0表示直播不对外可访问;1表示直播对外可访问
vertical 是否为竖屏直播;0表示直播为横屏直播;1表示直播为竖屏直播
wx_code 小程序码(乐享网站及小程序外无法直接使用此小程序码图片地址)
wx_open_code 微信公开直播的手机端查看小程序码(乐享网站及小程序外无法直接使用此小程序码图片地址)
pic 直播封面图
started_at 直播的开始时间
created_at 直播的创建时间
updated_at 直播的更新时间
intro 直播简介
content 直播详情
visit_count 直播总观看次数
video_duration 直播的时长
staff_count 直播总观看人数(去重),直播结束后30分钟可获取到数据
relationships.owner 直播的创建人
relationships.streamer 直播讲师
relationships.clazz 直播回放关联的课程信息
links.platform 当前直播的查看地址
links.open 微信公开直播的pc端查看地址
links.manager 当前直播的管理地址
question_staff_count 提问人数(去重)
question_count 提问总数量
chat_count 评论总数量
chat_staff_count 评论人数(去重)
like_count 点赞数
gift_count 送礼物次数
gift_staff_count 送礼物人数(去重)

# 获取员工观看直播记录

# 接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/staffs/{staff_id}/lives

# 参数说明:

支持分页参数和排序:(通用说明?

参数 是否必须 默认值 说明
sort -created_at 排序参数,支持按直播的created_at排序
page 1 当前页数
per_page 20 每页返回的数量
staff_id 员工帐号

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('/staffs/fewefwe/lives', [
    'page'=> 1,
    'per_page' => 3,
]);

# 响应document

# 200 OK 状态码
{
    "data": [
        {
            "type": "live",
            "id": "5ff26d50dead11e9a0b00a58ac130286",
            "attributes": {
                "title": "测试统计",
                "video_duration": 0,
                "online_duration": 586,
                "started_at": "2019-09-27 15:21:00",
                "created_at": "2019-09-27 15:21:26",
                "updated_at": "2019-10-06 11:05:00"
            }
        }
    ],
    "links": {
        "first": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/ruivenliu/lives?per_page=1&page=1",
        "last": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/ruivenliu/lives?per_page=1&page=24",
        "prev": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/ruivenliu/lives?per_page=1&page=1",
        "next": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/ruivenliu/lives?per_page=1&page=3"
    },
    "meta": {
        "current_page": 2,
        "from": 2,
        "last_page": 24,
        "path": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/fewefwe/lives",
        "per_page": 1,
        "to": 2,
        "total": 24
    }
}

# 参数说明

参数 说明
live.type 资源对象类型,为lives,表示资源为直播
live.id 直播实体id
live.title 直播的标题
live.video_duration 直播时长
live.started_at 直播开始时间
live.created_at 直播创建时间
live.updated_at 直播的更新时间
live.online_duration 直播观看时长

# 获取直播签到列表

# 接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/lives/{live_id}/checkins

# 参数说明:

支持分页参数和排序:(通用说明?

参数 是否必须 默认值 说明
page 1 当前页数
per_page 20 每页返回的数量
live_id 直播id

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('lives/6b096940e0f711e9ae480a58ac1302ce/checkins', [
    'page'=> 1,
    'per_page' => 3,
]);

# 响应document

# 200 OK 状态码
{
    "data": [
        {
            "type": "live_checkin",
            "id": "022164fd3400458bb4cc7837104f360a",
            "attributes": {
                "title": "第一次签到",
                "begin_at": "2020-05-06 10:42:00",
                "end_at": "2020-05-06 10:50:00",
                "participants_count": 46
            },
            "relationships": {
                "owner": {
                    "data": {
                        "type": "staff",
                        "id": "ThreeZhang"
                    }
                }
            }
        },
        {
            "type": "live_checkin",
            "id": "9c4586f50cb148419c9b6fa480d51742",
            "attributes": {
                "title": "第二次签到",
                "begin_at": "2020-05-06 10:52:07",
                "end_at": "2020-05-06 10:55:00",
                "participants_count": 23
            },
            "relationships": {
                "owner": {
                    "data": {
                        "type": "staff",
                        "id": "ThreeZhang"
                    }
                }
            }
        },
        {
            "type": "live_checkin",
            "id": "8a1b892b5a4946b8a0268494d13314db",
            "attributes": {
                "title": "第三次签到",
                "begin_at": "2020-05-06 11:00:42",
                "end_at": "2020-05-06 11:20:00",
                "participants_count": 9
            },
            "relationships": {
                "owner": {
                    "data": {
                        "type": "staff",
                        "id": "FourLee"
                    }
                }
            }
        }
    ],
    "links": {
        "first": "https://lxapi.lexiangla.com/cgi-bin/v1/lives/5a61411e8f4111eabc129eab142eb664/checkins?page=1",
        "last": "https://lxapi.lexiangla.com/cgi-bin/v1/lives/5a61411e8f4111eabc129eab142eb664/checkins?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://lxapi.lexiangla.com/cgi-bin/v1/lives/5a61411e8f4111eabc129eab142eb664/checkins",
        "per_page": 20,
        "to": 5,
        "total": 5
    },
    "included": [
        {
            "type": "staff",
            "id": "ThreeZhang",
            "attributes": {
                "name": "张三",
                "english_name": null,
                "organization": "开发组"
            }
        },
        {
            "type": "staff",
            "id": "FourLee",
            "attributes": {
                "name": "李四",
                "english_name": null,
                "organization": "测试组"
            }
        }
    ]
}

# 参数说明

参数 说明
live_checkin.title 签到标题
live_checkin.begin_at 签到开始时间
live_checkin.end_at 签到结束时间
live_checkin.participants_count 签到人数
live_checkin.created_at 签到创建时间
relationships.owner 签到创建者