# 课堂

# 创建课程

# 接口调用说明:

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

# 请求document

{
    "data": {
        "type": "clazz",
        "attributes": {
            "type": 1,
            "title": "开课主题",
            "description": "课程描述",
            "cover_img": "https://image-pub.lexiang-asset.com/common/assets/course/wecourse.png",
            "is_required": true,
            "is_reminded": true,
            "start_reminded_at": "2020-02-22",
            "end_reminded_at": "2020-02-29",
            "interval": 3,
            "privilege_type": 1
        },
        "relationships": {
            "course": {
                "data": {
                    "type": "course",
                    "id": "079a9bc64b4c11eab91e0a58ac130b26"
                }
            },
            "category": {
                "data": {
                    "type": "category",
                    "id": "3c945edcdda311e9baa352540013ef60"
                }
            },
            "chapters":{
                "data":[
					{
                    	 "name":"章节名称,下面是素材id",
                    	 "course_ids":["b1925c202a5f11eb9cfb0eefe380b22a"]
                    },
                    {
                   		 "name":"2",
                    	 "course_ids":["4a5765d21d8511ebac60e245278ab11f","4a8193341d8511eba587e245278ab11f"]
                    }
                ]
            },         
            "privilege": {
                "data": [
                    {
                        "type": "staff",
                        "id": "viky"
                    },
                    {
                        "type": "department",
                        "id": "1"
                    }
                ]
            }
        }
    }
}

# 参数说明:

参数 是否必须 默认值 说明
attributes.type 课程类型。0: 独立课程; 1: 章节课程。
attributes.title 开课主题。
attributes.description "" 课程介绍。章节课程可指定。
attributes.cover_img "" 课程封面。
attributes.is_required false 课程类型:是否必修课。
attributes.is_reminded false 催办方式:是否催办。
attributes.start_reminded_at 催办开始时间。
attributes.end_reminded_at 催办结束时间。
attributes.interval 催办重复频率。
attributes.privilege_type 0 学员范围。0: 所有人; 1: 部分人(在 privilege 关系中指定)。
relationships.course 默认使用第一个素材 独立课程的素材。
relationships.category 课程分类。
relationships.chapters 默认创建"第一章" 章节课程的课程内容(章节及素材)。
relationships.privileges 目标组织架构。

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);

$attributes = [
    'type' => 1,
    'title' => '开课主题',
];
$options = [
    'description' => '课程描述',
    'cover_img' => 'https://image-pub.lexiang-asset.com/common/assets/course/wecourse.png',
    'is_required' => true,
    'is_reminded' => true,
    'start_reminded_at' => '2020-02-22',
    'end_reminded_at' => '2020-02-29',
    'interval' => 3,
    'privilege_type' => 1,
    'course_id' => '079a9bc64b4c11eab91e0a58ac130b26',
//    'chapters' => [
//        [
//            'name' => '前言',
//            'course_ids' => [
//                '07e293184b4c11ea86e00a58ac130b26',
//            ],
//        ],
//    ],
    'category_id' => '3c945edcdda311e9baa352540013ef60',
    'privilege' => [
        [
            'type' => 'staff',
            'id' => 'viky',
        ],
        [
            'type' => 'department',
            'id' => '1',
        ]
    ],
];

// 创建课程
$response = $Lxapi->postClazz(StaffID, $attributes, $options);

# 响应document

# 201 Created 状态码
{
    "data": {
        "type": "clazz",
        "id": "9fdebb1a5a0611ea8b3b5254009b5a66",
        "attributes": {
            "title": "开课主题",
            "is_required": true,
            "type": 1,
            "updated_at": "2020-02-28 16:45:08",
            "created_at": "2020-02-28 16:45:08"
        },
        "links": {
            "platform": {
                "href": "https://lexiangla.com/classes/9fdebb1a5a0611ea8b3b5254009b5a66?type=1&company_from=d356beca33bb11e8a3de5254002b6735"
            },
            "manager": {
                "href": "https://lexiangla.com/classes/9fdebb1a5a0611ea8b3b5254009b5a66/settings?type=1&company_from=d356beca33bb11e8a3de5254002b6735"
            }
        }
    }
}

# 修改课程

# 接口调用说明:

PUT https://lxapi.lexiangla.com/cgi-bin/v1/classes/{id}

# 请求document

参考(创建课程)[创建课程]。

# 参数说明:

参考(创建课程)[创建课程];只传需要修改的字段。

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);

$attributes = [
];
$options = [
    'type' => 1,
    'title' => '开课主题',
    'description' => '课程描述',
    'cover_img' => 'https://image-pub.lexiang-asset.com/common/assets/course/wecourse.png',
    'is_required' => true,
    'is_reminded' => true,
    'start_reminded_at' => '2020-02-22',
    'end_reminded_at' => '2020-02-29',
    'interval' => 3,
    'privilege_type' => 1,
    'course_id' => '079a9bc64b4c11eab91e0a58ac130b26',
//    'chapters' => [
//        [
//            'name' => '前言',
//            'course_ids' => [
//                '07e293184b4c11ea86e00a58ac130b26',
//            ],
//        ],
//    ],
    'category_id' => '3c945edcdda311e9baa352540013ef60',
    'privilege' => [
        [
            'type' => 'staff',
            'id' => 'viky',
        ],
        [
            'type' => 'department',
            'id' => '1',
        ]
    ],
];

// 编辑课程
$clazz_id = '9fdebb1a5a0611ea8b3b5254009b5a66';
$response = $Lxapi->putClazz(StaffID, $clazz_id, $attributes, $options);

# 响应document

# 200 OK

参考(创建课程)[创建课程]。

# 删除课程

# 接口调用说明:

DELETE https://lxapi.lexiangla.com/cgi-bin/v1/classes/{id}

# 请求document

# 参数说明:

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);

// 编辑课程
$clazz_id = '9fdebb1a5a0611ea8b3b5254009b5a66';
$response = $Lxapi->deleteClazz(StaffID, $clazz_id);

# 响应document

# 204 No Content

# 创建素材

# 接口调用说明:

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

# 请求document

{
    "data": {
        "type": "course",
        "attributes": {
            "title": "API创建素材",
            "content": "API创建素材;这是简介",
            "media_type": 0,
            "target_users": "正式员工"
        },
        "relationships": {
            "category": {
                "data": {
                    "type": "category",
                    "id": "dfa007209d0911e7bf2865f56d035977"
                }
            },
            "videos": {
                "data": [
                    {
                        "type": "video",
                        "id": "a7a90cd8f2bc47649f515ef46d25c312"
                    }
                ]
            }
        }
    }
}

文档类型素材

{
    "data": {
        "type": "course",
        "attributes": {
            "title": "API创建素材",
            "content": "API创建素材;这是简介",
            "media_type": 1,
            "target_users": "正式员工",
            "duration":100
        },
        "relationships": {
            "category": {
                "data": {
                    "type": "category",
                    "id": "dfa007209d0911e7bf2865f56d035977"
                }
            },
            "attachment": {
                "data":
                {
                    "type": "attachment",
                    "id": "feeb03900ac647159b9517487bc9f2c8"
                }
            }
        }
    }
}

# 参数说明:

参数 是否必须 默认值 说明
attributes.title 素材标题。
attributes.content "" 素材介绍
attributes.media_type "" 素材类型,为0表示视频素材;为1表示文档类型素材
attributes.target_users "" 适用人群
relationships.category 素材分类ID
relationships.videos 当前课程关联的视频ID,当media_type为0时,必填
relationships.attachment 当前课程关联的附件ID,当media_type为1时,必填
attributes.is_shared 0 0表示私密;1表示公开
attributes.duration 0 文档类型的素材学习完成条件,秒数

关于视频上传的说明 乐享开放接口提供了视频上传的接口,详细使用说明请参考视频上传部分

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->PostCourse('ThreeZhang', [
    'title' => 'API创建素材',
    'content' => 'API创建素材;这是简介'
], [
    'media_type' => 0,
    'target_users' => '正式员工',
    'category_id' => 'dfa007209d0911e7bf2865f56d035977',
    'videos' => [
        'a7a90cd8f2bc47649f515ef46d25c312'
    ]
]);

// 创建文档类型素材
$response = $Lxapi->PostCourse('ThreeZhang', [
    'title' => 'API创建素材',
    'content' => 'API创建素材;这是简介'
], [
    'media_type' => 1,
    'target_users' => '正式员工',
    'duration' => 100,
    'category_id' => 'dfa007209d0911e7bf2865f56d035977',
    'attachment_id' => 'feeb03900ac647159b9517487bc9f2c8',
]);

# 响应document

# 201 Created
{
    "data": {
        "type": "course",
        "id": "e3f159b3c807432082551c0fae08a8bb",
        "attributes": {
            "title": "API创建素材",
            "media_type": 0,
            "cover": null,
            "duration": 0,
            "complete_percent": 100,
            "target_users": "正式员工",
            "created_at": "2020-03-31 15:08:57"
        },
        "links": {
            "platform": "https://lexiangla.com/courses/e3f159b3c807432082551c0fae08a8bb"
        },
        "relationships": {
            "owner": {
                "data": {
                    "type": "staff",
                    "id": "ThreeZhang"
                }
            },
            "videos": {
                "data": [
                    {
                        "type": "video",
                        "id": "a7a90cd8f2bc47649f515ef46d25c312"
                    }
                ]
            },
            "category": {
                "data": {
                    "type": "category",
                    "id": "dfa007209d0911e7bf2865f56d035977"
                }
            }
        }
    },
    "included": [
        {
            "type": "staff",
            "id": "ThreeZhang",
            "attributes": {
                "name": "张三",
                "english_name": "ThreeZhang"
            }
        },
        {
            "type": "video",
            "id": "a7a90cd8f2bc47649f515ef46d25c312",
            "attributes": {
                "name": "345",
                "type": "mp3",
                "vod_file_id": "5285890800689954209"
            }
        },
        {
            "type": "category",
            "id": "dfa007209d0911e7bf2865f56d035977",
            "attributes": {
                "name": "职业发展"
            }
        }
    ],
    "links": {
        "self": "https://lxapi.lexiangla.com/cgi-bin/v1/courses/e3f159b3c807432082551c0fae08a8bb"
    }
}

# 更新素材

# 接口调用说明:

PATCH https://lxapi.lexiangla.com/cgi-bin/v1/courses/{id}

# 请求document

{
    "data": {
        "type": "course",
        "attributes": {
            "title": "API修改素材标题素材",
            "content": "API创建素材;这是简介",
            "media_type": 0,
            "target_users": "中国境内正式员工"
        },
        "relationships": {
            "category": {
                "data": {
                    "type": "category",
                    "id": "dfa007209d0911e7bf2865f56d035977"
                }
            },
            "videos": {
                "data": [
                    {
                        "type": "video",
                        "id": "a7a90cd8f2bc47649f515ef46d25c312"
                    }
                ]
            }
        }
    }
}

更新文档类型素材

{
    "data": {
        "type": "course",
        "attributes": {
            "title": "API创建素材",
            "content": "API创建素材;这是简介",
            "media_type": 1,
            "target_users": "正式员工",
            "duration":100
        },
        "relationships": {
            "category": {
                "data": {
                    "type": "category",
                    "id": "dfa007209d0911e7bf2865f56d035977"
                }
            },
            "attachment": {
                "data":
                {
                    "type": "attachment",
                    "id": "4a5be1248a424d6fbd6a36c705270a2b"
                }
            }
        }
    }
}

# 参数说明:

参数说明同创建素材

关于视频上传的说明 乐享开放接口提供了视频上传的接口,详细使用说明请参考视频上传部分

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->patchCourse('ThreeZhang', 'e3f159b3c807432082551c0fae08a8bb',[
    'title' => 'API修改素材标题素材',
    'content' => 'API创建素材;这是简介',
    'media_type' => 0,
    'target_users' => '正式员工',
    'category_id' => 'dfa007209d0911e7bf2865f56d035977',
    'videos' => [
        'a7a90cd8f2bc47649f515ef46d25c312'
    ]
]);

# 响应document

# 200 OK
{
    "data": {
        "type": "course",
        "id": "e3f159b3c807432082551c0fae08a8bb",
        "attributes": {
            "is_shared": 0,
            "media_type": 0,
            "title": "API修改素材标题素材",
            "cover": null,
            "duration": 0,
            "complete_percent": 100,
            "target_users": "中国境内正式员工",
            "created_at": "2020-03-31 15:08:57"
        },
        "links": {
            "platform": "https://lexiangla.com/courses/e3f159b3c807432082551c0fae08a8bb"
        },
        "relationships": {
            "owner": {
                "data": {
                    "type": "staff",
                    "id": "ThreeZhang"
                }
            },
            "videos": {
                "data": [
                    {
                        "type": "video",
                        "id": "a7a90cd8f2bc47649f515ef46d25c312"
                    }
                ]
            },
            "category": {
                "data": {
                    "type": "category",
                    "id": "dfa007209d0911e7bf2865f56d035977"
                }
            }
        }
    },
    "included": [
        {
            "type": "staff",
            "id": "ThreeZhang",
            "attributes": {
                "name": "张三",
                "english_name": "ThreeZhang"
            }
        },
        {
            "type": "video",
            "id": "a7a90cd8f2bc47649f515ef46d25c312",
            "attributes": {
                "name": "345",
                "type": "mp3",
                "vod_file_id": "5285890800689954209"
            }
        },
        {
            "type": "category",
            "id": "dfa007209d0911e7bf2865f56d035977",
            "attributes": {
                "name": "职业发展"
            }
        }
    ],
    "links": {
        "self": "https://lxapi.lexiangla.com/cgi-bin/v1/courses/e3f159b3c807432082551c0fae08a8bb"
    }
}

# 获取单个素材信息

# 接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/courses/{id}
参数 是否必须 默认值 说明
id 素材ID

# SDK封装方法使用示例:

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

# 响应document

# 200 OK 状态码
{
	"data": {
		"type": "course",
		"id": "b47dc96ce66f11eaa4f35254008ea09d",
		"attributes": {
			"is_shared": 0,
			"media_type": 0,
			"title": "测试",
			"cover": "",
			"duration": 257,
			"complete_percent": 100,
			"target_users": null,
			"created_at": "2020-08-25 09:10:03"
		},
		"links": {
			"platform": "https://lexiangla.com/courses/b47dc96ce66f11eaa4f35254008ea09d"
		},
		"relationships": {
			"owner": {
				"data": {
					"type": "staff",
					"id": "ThreeZhang"
				}
			},
			"videos": {
				"data": [{
					"type": "video",
					"id": "b4514a54e66f11eabfc25254008ea09d"
				}]
			},
			"category": {
				"data": {
					"type": "category",
					"id": "9c336b789de311e7aed15254002b6735"
				}
			}
		}
	},
	"included": [{
			"type": "staff",
			"id": "ThreeZhang",
			"attributes": {
				"name": "ThreeZhang",
				"english_name": null
			}
		},
		{
			"type": "video",
			"id": "b4514a54e66f11eabfc25254008ea09d",
			"attributes": {
				"name": "5285890806561391242",
				"type": "hls",
				"vod_file_id": "5285890806561391242"
			}
		},
		{
			"type": "category",
			"id": "9c336b789de311e7aed15254002b6735",
			"attributes": {
				"name": "其他"
			}
		}
	],
	"links": {
		"self": "https://lxapi.lexiangla.com/cgi-bin/v1/courses/b47dc96ce66f11eaa4f35254008ea09d"
	}
}

# 参数说明:

参数 说明
title 素材主题
media_type 素材类型(0视频、1文档)
content 素材内容
target_user 适用人群
relationships.catagory 素材分类
relationships.videos 当前素材关联的视频id
relationships.attachments 当前素材关联的文档id

# 删除素材

# 接口调用说明:

DELETE https://lxapi.lexiangla.com/cgi-bin/v1/courses/{id}

# 请求document

# 参数说明:

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->deleteCourse('ThreeZhang', 'e3f159b3c807432082551c0fae08a8bb');

# 已开课程列表

# 接口调用说明:

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

# 参数说明:

参数 是否必须 默认值 说明
category_id 开课分类ID。设置了此值,只返回该开课分类及其子分类下的课程。
sort id 排序参数,支持按课堂的created_at排序

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('classes');

# 响应document

# 200 OK 状态码
{
    "data": [
        {
            "type": "clazz",
            "id": "7f1bbe66beed11e7aade080027854b0f",
            "attributes": {
                "title": "乐享课堂1",
                "is_required": 0,
                "comment_count": 0,
                "participants_count": 2,
                "created_at": "2019-06-18 18:14:50",
                "updated_at": "2019-06-19 18:14:50"
            },
            "relationships": {
                "category": {
                    "data": {
                        "type": "category",
                        "id": "c165a4f49d1311e7bc4f080027854b0f"
                    }
                },
                "owner": {
                    "data": {
                        "type": "staff",
                        "id": "ThreeZhang"
                    }
                },
                "team": {
                    "data": {
                        "type": "team",
                        "id": "a450d7bc01ed11eab1855254009b5a66"
                    }
                }
            }
        },
        {
            "type": "clazz",
            "id": "366faef0992411e7ba59080027854b0f",
            "attributes": {
                "title": "乐享课堂2",
                "is_required": 0,
                "comment_count": 0,
                "participants_count": 1,
                "created_at": "2019-06-14 16:10:46",
                "updated_at": "2019-06-19 12:35:39"
            },
            "relationships": {
                 "category": {
                     "data": {
                         "type": "category",
                         "id": "c165a4f49d1311e7bc4f080027854b0f"
                     }
                 },
                 "owner": {
                     "data": {
                         "type": "staff",
                         "id": "FourLee"
                     }
                 }
            }
        }
    ],
    "links": {
        "first": "https://lxapi.lexiangla.com/cgi-bin/v1/classes?page=1",
        "last": "https://lxapi.lexiangla.com/cgi-bin/v1/classes?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://lxapi.lexiangla.com/cgi-bin/v1/classes",
        "per_page": 20,
        "to": 2,
        "total": 2
    },
    "included": [
        {
            "type": "category",
            "id": "c165a4f49d1311e7bc4f080027854b0f",
            "attributes": {
                "name": "其他"
            }
        },
        {
            "type": "staff",
            "id": "ThreeZhang",
            "attributes": {
                "name": "张三",
                "english_name": "ThreeZhang"
            }
        },
        {
            "type": "staff",
            "id": "FourLee",
            "attributes": {
                "name": "李四",
                "english_name": "FourLee"
            }
        }
    ]
}

# 参数说明:

参数 说明
title 开课主题
is_required 属性:是否为必修,1为必修
comment_count 评论数量
participants_count 已学人数
created_at 创建时间

# 获取单个课程信息

# 接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/classes/{id}
参数 是否必须 默认值 说明
id 课堂ID

# SDK封装方法使用示例:

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

# 响应document

# 200 OK 状态码
{
    "data": {
        "type": "clazz",
        "id": "9250201655b148a7b2770fafbab3154b",
        "attributes": {
            "type": 1,
            "course_count": 3,
            "title": "测试",
            "description": "",
            "cover_img": "",
            "category_id": "d474d3cace4f11e9911a52540013ef60",
            "is_required": 0,
            "comment_count": 0,
            "created_at": "2020-03-31 09:05:03",
            "updated_at": "2020-03-31 14:45:39",
            "participants_count": 0,
            "study_persons_count":10,
            "privilege": [
                {
                    "id": "072619964ecf11eab2ed5254008ea09d",
                    "nick": null,
                    "position": null,
                    "country_code": "",
                    "avatar": "https://wework.qpic.cn/bizmail/KhvIpAOlQoLzD15aX6C4VYwbVgBB6PCbHC7XL4SPc1wgY2F1mEibNlg/100",
                    "gender": 1,
                    "birthday_calendar": "solar",
                    "hometown": null,
                    "hobby": null,
                    "intro": null,
                    "organization": "测试中心",
                    "enabled": 1,
                    "point_total": 0,
                    "has_department": 1,
                    "main_depart": "1",
                    "updated_at": "2020-03-20 00:35:59",
                    "guided_at": null,
                    "resign_at": null,
                    "active_at": "2020-02-15 00:53:46",
                    "wx_unionid": "",
                    "type": "staff",
                    "model": "staff",
                    "display_name": "张三",
                    "is_vip": false,
                    "sub_department": null
                },
                {
                    "id": "2",
                    "name": "开发组",
                    "parent_id": "1",
                    "path": "/1/2",
                    "order": 2147484247,
                    "created_at": "2019-08-20 16:39:08",
                    "type": "department",
                    "model": "department"
                }
            ],
            "chapters": [{
				"id": 2279,
				"team_id": "",
				"name": "直播回放",
				"sequence": 1,
				"model": "clazzchapter",
				"courses": [{
						"id": "b4148abae66f11eaa00e5254008ea09d",
						"team_id": "",
						"is_shared": false,
						"media_type": 0,
						"attachment_id": "",
						"title": "直播回放1 | obs推流",
						"summary": "",
						"cover": "",
						"duration": 894,
						"complete_percent": 100,
						"video_link": null,
						"mall_course_id": "",
						"model": "course"
					}
                ]
        },
        "links": {
            "platform": "https://lexiangla.com/classes/9250201655b148a7b2770fafbab3154b?type=1",
            "manager": "https://lexiangla.com/classes/9250201655b148a7b2770fafbab3154b/settings?type=1"
        }
    }
}

# 参数说明:

参数 说明
title 开课主题
type 课程类型 (0独立课程,1章节课程)
chapters.courses type为1时返回课程包含素材
courses type为0时返回课程包含素材
cover_img 课程封面
description 课程介绍
category_id 开课分类id
is_required 属性:是否为必修,1为必修
course_count 子课程数
privilege 学员范围
comment_count 评论数
study_persons_count 应学人数
participants_count 已学人数
created_at 创建时间

# 课程学习记录

# 接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/classes/{id}/staffs

# 参数说明:

参数 是否必须 默认值 说明
id 要获取已学员工列表的课堂ID
learn_status 0:未学习,1:学习中,2:已完成状态
per_page 500 每页返回的数量,最大值2000

对于指定id参数,仅允许单个线程发起请求,请按分页信息逐页拉取。

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('classes/7f1bbe66beed11e7aade080027854b0f/staffs');

# 响应document

# 200 OK 状态码
{
    "data": [
        {
            "type": "staff",
            "id": "ThreeZhang",
            "attributes": {
                "name": "张三",
                "english_name": "ThreeZhang",
                "organization": "开发组",
                "learn_time": 100,
                "start_learn_at": "2019-06-19 10:54:31",
                "is_succeeded": true,
                "learn_status": 2
}
        },
        {
            "type": "staff",
            "id": "FourLee",
            "attributes": {
                "name": "李四",
                "english_name": "FourLee",
                "organization": "产品组",
                "learn_time": 0,
                "start_learn_at": "2019-06-19 17:57:34",
                "is_succeeded": false,
                "learn_status": 1
            }
        }
    ],
    "links": {
        "first": "https://lxapi.lexiangla.com/cgi-bin/v1/classes/7f1bbe66beed11e7aade080027854b0f/staffs?page=1",
        "last": null,
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "path": "https://lxapi.lexiangla.com/cgi-bin/v1/classes/7f1bbe66beed11e7aade080027854b0f/staffs",
        "per_page": 20,
        "to": 2
    }
}

分页信息meta中不会返回last_page(最后一页的页码)和total(总数),links.last也会固定为 null

需要拉取所有分页数据,可根据当前页返回data是否空集,或者判断links.next是否空,来决定是否继续拉取下一页数据

# 参数说明:

参数 说明
title 开课主题
is_required 属性:是否为必修,1为必修
start_learn_at 开始学习时间
learn_time 学习时长(单位:s)
is_succeeded 是否学完
learn_status 学习状态:0——未学习,1——学习中,2——已完成
# 429 Too Many Requests 状态码
{
    "errors": [
        {
            "detail": "请求并发数超过限制"
        }
    ]
}

# 成员学习记录

# 接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/staffs/{id}/classes?learn_status=0

# 参数说明:

参数 是否必须 默认值 说明
id 员工的企业微信ID
min_start_learn_at 开始学习时间的起始点(包含当天)
max_start_learn_at 开始学习时间的截止点(不包含当天)
min_succeeded_at 完成学习时间的起始点(包含当天)
max_succeeded_at 完成学习时间的截止点(不包含当天)
learn_status 学习状态:0——未学习,1——学习中,2——已完成

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('staffs/ThreeZhang/classes' [
    'min_start_learn_at' => '2020-02-02',
    'max_start_learn_at' => '2020-02-20',
    'min_succeeded_at' => '2020-02-02',
    'max_succeeded_at' => '2020-02-20',
    'learn_status' => '0',
]);

# 响应document

# 200 OK 状态码
{
    "data": [
        {
            "type": "clazz",
            "id": "15daacfe334b11e981af10e7c61c70fc",
            "attributes": {
                "title": "测试乐享课堂",
                "duration": 60,
                "is_required": 1,
                "comment_count": 0,
                "created_at": "2019-02-18 15:01:59",
                "updated_at": "2019-05-29 15:17:47",
                "learn_time": 100,
                "start_learn_at": "2019-09-18 15:13:34",
                "succeeded_at": "2019-09-19 15:13:34",
                "is_succeeded": true,
                "learn_status": 2
            }
        },
        {
            "type": "clazz",
            "id": "366faef0992411e7ba59080027854b0f",
            "attributes": {
                "title": "乐享课堂1",
                "duration": 60,
                "is_required": 0,
                "comment_count": 0,
                "created_at": "2019-06-18 18:14:50",
                "updated_at": "2019-06-19 18:14:50",
                "learn_time": 0,
                "valid_learn_time": 0,
                "start_learn_at": "2017-09-20 17:57:09",
                "succeeded_at": "2019-09-19 15:13:34",
                "is_succeeded": true,
                "learn_status": 2
            },
            "relationships": {
                "team": {
                    "data": {
                        "type": "team",
                        "id": "a450d7bc01ed11eab1855254009b5a66"
                    }
                }
            }
        },
        {
            "type": "clazz",
            "id": "7f1bbe66beed11e7aade080027854b0f",
            "attributes": {
                "title": "乐享课堂2",
                "duration": 60,
                "is_required": 0,
                "comment_count": 0,
                "created_at": "2019-06-18 18:14:50",
                "updated_at": "2019-06-19 18:14:50",
                "learn_time": 0,
                "valid_learn_time": 0,
                "start_learn_at": "2017-09-20 17:57:09",
                "succeeded_at": "2019-09-19 15:13:34",
                "is_succeeded": true,
                "learn_status": 2
            }
        }
    ],
    "links": {
        "first": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/ThreeZhang/classes?page=1",
        "last": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/ThreeZhang/classes?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/ThreeZhang/classes",
        "per_page": 20,
        "to": 3,
        "total": 3
    }
}

# 参数说明:

参数 说明
title 开课主题
duration 课程总时长
is_required 属性:是否为必修,1为必修
comment_count 评论数量
start_learn_at 开始学习时间
succeeded_at 完成学习时间
learn_time 学习时长(单位:s)
valid_learn_time 有效学习时长(单位:s)
is_succeeded 是否学完
learn_status 学习状态:0——未学习,1——学习中,2——已完成