# 活动

# 获取活动列表

可以获取的活动列表展示在公司的OA主页,让乐享更好地服务公司

# 接口调用说明:

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

# 参数说明:

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

参数 是否必须 默认值 说明
sort -created_at 排序参数,支持按活动的created_at, ended_at排序
page 1 当前页数
per_page 20 每页返回的数量

# SDK封装方法使用示例:

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

# 响应document

{
    "data":[
        {
            "type":"event",
            "id":"3d36c2ba9c6511e8808b5254009b5a66",
            "attributes":{
                "title":"8000家庭电脑免费维修清理",
                "logo":"",
                "location":"腾讯大厦",
                "started_at":"2018-08-24 14:18:00",
                "ended_at":"2018-08-31 14:18:00",
                "created_at":"2018-08-10 14:18:46",
                "participant_count":0,
                "participant_count_limit":null
            },
            "links":{
                "platform":"https://lexiangla.com/teams/K10/events/3d36c2ba9c6511e8808b5254009b5a66"
            },
            "relationships":{
                "owner":{
                    "data":{
                        "type":"staff",
                        "id":"ThreeZhang"
                    }
                },
                "team":{
                    "data":{
                        "type":"team",
                        "id":"fc59bc42781711e797c25254002b6735"
                    }
                },
                "category":{
                    "data":{
                        "type":"category",
                        "id":"1766b8c644e011e6960a525400f26262"
                    }
                }
            }
        },
        {
            "type":"event",
            "id":"3126265e9bad11e8b9365254009b5a66",
            "attributes":{
                "title":"周末一起夜跑吧",
                "logo":"",
                "location":"腾讯大厦",
                "started_at":"2018-08-01 16:21:00",
                "ended_at":"2018-08-15 16:21:00",
                "created_at":"2018-08-09 16:21:19",
                "participant_count":1,
                "participant_count_limit":null
            },
            "links":{
                "platform":"https://lexiangla.com/teams/k100281/events/3126265e9bad11e8b9365254009b5a66"
            },
            "relationships":{
                "owner":{
                    "data":{
                        "type":"staff",
                        "id":"FourLee"
                    }
                },
                "team":{
                    "data":{
                        "type":"team",
                        "id":"06b09aee9bad11e896de5254009b5a66"
                    }
                },
                "category":{
                    "data":{
                        "type":"category",
                        "id":"1766b8c644e011e6960a525400f26262"
                    }
                }
            }
        },
        {
            "type":"event",
            "id":"8d5040ec994e11e8a9175254009b5a66",
            "attributes":{
                "title":"机器学习读书分享会",
                "logo":"https://xxx/assets/84ca31bc994e11e881775254009b5a66",
                "location":"腾讯大厦",
                "started_at":"2018-08-06 15:58:00",
                "ended_at":"2018-08-18 15:58:00",
                "created_at":"2018-08-06 15:58:49",
                "participant_count":0,
                "participant_count_limit":12
            },
            "links":{
                "platform":"https://lexiangla.com/teams/k100145/events/8d5040ec994e11e8a9175254009b5a66"
            },
            "relationships":{
                "owner":{
                    "data":{
                        "type":"staff",
                        "id":"TwoWang"
                    }
                },
                "team":{
                    "data":{
                        "type":"team",
                        "id":"c2d93650db2211e7b87d5254002b6735"
                    }
                },
                "category":{
                    "data":{
                        "type":"category",
                        "id":"1766b8c644e011e6960a525400f26262"
                    }
                }
            }
        }
    ],
    "links":{
        "first":"https://lxapi.lexiangla.com/cgi-bin/v1/events?filter=latest&per_page=3&page=1",
        "last":"https://lxapi.lexiangla.com/cgi-bin/v1/events?filter=latest&per_page=3&page=36",
        "prev":null,
        "next":"https://lxapi.lexiangla.com/cgi-bin/v1/events?filter=latest&per_page=3&page=2"
    },
    "meta":{
        "current_page":1,
        "from":1,
        "last_page":36,
        "path":"https://lxapi.lexiangla.com/cgi-bin/v1/events",
        "per_page":"3",
        "to":3,
        "total":108
    },
    "included":[
        {
            "type":"staff",
            "id":"ThreeZhang",
            "attributes":{
                "name":"张三",
                "english_name":"ThreeZhang",
                "organization":"运营组"
            }
        },
        {
            "type":"staff",
            "id":"FourLee",
            "attributes":{
                "name":"李四",
                "english_name":"FourLee",
                "organization":"产品组"
            }
        },
        {
            "type":"staff",
            "id":"TwoWang",
            "attributes":{
                "name":"王二",
                "english_name":"TwoWang",
                "organization":"开发组"
            }
        },
        {
            "type":"team",
            "id":"fc59bc42781711e797c25254002b6735",
            "attributes":{
                "name":"team1"
            }
        },
        {
            "type":"team",
            "id":"06b09aee9bad11e896de5254009b5a66",
            "attributes":{
                "name":"team2"
            }
        },
        {
            "type":"team",
            "id":"c2d93650db2211e7b87d5254002b6735",
            "attributes":{
                "name":"team3"
            }
        },
        {
            "type":"category",
            "id":"1766b8c644e011e6960a525400f26262",
            "attributes":{
                "name":"其他"
            }
        }
    ]
}

# 参数说明

参数 说明
event.type 资源对象类型,为event,表示资源为活动
event.id 活动实体ID
event.links.platform 投票查看页面,可以直接跳转到乐享活动详情页面
event.title 活动的标题
event.logo 活动的封面图片地址
event.location 活动地点
event.started_at 活动的开始时间
event.ended_at 活动的截止时间
event.created_at 活动的创建时间
event.participant_count 活动的参数人数
event.participant_count_limit 活动的人数限制,为null表示没有限制
owner.id 活动的创建人ID
team.id 活动所属的K吧ID
category.id 活动所属的分类ID

# 获取活动参与成员

获取单个活动的参与人员接口

# 接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/events/{id}/participants

# 参数说明:

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

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

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('events/id/participants');

# 响应document

{
    "data": {
        "eda44398963911e8930252540013ef60": {
            "type": "staff",
            "id": "ThreeZhang",
            "attributes": {
                "name": "张三",
                "english_name": "ThreeZhang",
                "organization": "开发组 ",
                "is_joined": "已报名",
                "joined_at": "2020-01-13 10:42:22",
                "is_attended": "是",
                "attended_at": "2020-01-13 10:43:14"
            }
        },
        "f044746a963911e8916852540013ef60": {
            "type": "staff",
            "id": "FourLee",
            "attributes": {
                "name": "李四",
                "english_name": "FourLee",
                "organization": "开发组 ",
                "is_joined": "未报名",
                "joined_at": null,
                "is_attended": "是",
                "attended_at": "2020-01-13 10:42:40"
            }
        }
    }
}

# 参数说明

参数 说明
staff.id 员工ID
staff.name 员工姓名
staff.english_name 员工英文姓名
staff.organization 员工组织
staff.is_joined 员工报名状态
staff.joined_at 员工报名时间
staff.is_attended 员工签到状态
staff.attended_at 员工签到时间