详见【成员-获取成员列表】文档。
POST https://lxapi.lexiangla.com/cgi-bin/v1/points
document
{
"data": {
"type": "point",
"attributes": {
"op_type": 1,
"point": 10,
"reason": "参加活动加分",
"is_notify": true
},
"relationships":{
"recipient":{
"data":{
"type":"staff",
"id":"ThreeZhang"
}
}
}
}
}
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
point.op_type | 是 | 1 | 积分操作类型;1:增加;2:扣减 |
point.point | 是 | 0 | 分值 |
point.reason | 是 | 无 | 备注说明 |
point.is_notify | 是 | false | 是否通过企业微信消息推送积分调整通知 |
point.recipient | 是 | 无 | 关联的资源对象,类型为staff ,表示被调整积分的员工 |
$attributes = [
"op_type" => 1,
"point" => 10,
"reason" => "参加活动加分",
"is_notify" => true,
"staff_id" => 'ThreeZhang',
];
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->postPoint(StaffID, $attributes);
document
{
"errors": [
{
"detail": "积分不足扣减"
}
]
}
{
"data": {
"type": "point",
"id": 1980,
"attributes": {
"rule_name": "admin",
"point": 10,
"op_type": 1,
"reason": "参加活动加分",
"created_at": "2019-12-25 15:19:27"
}
}
}
GET https://lxapi.lexiangla.com/cgi-bin/v1/points
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
staff_id | 否 | 无 | 员工的企业微信ID |
started_at | 是 | 无 | 起始日期,如 2019-12-12 |
ended_at | 是 | 无 | 截止日期,如 2019-12-24 |
page | 否 | 1 | 当前页数 |
per_page | 否 | 20 | 每页返回的数量 |
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('points',[
'staff_id' => 'ThreeZhang',
'started_at' => '2019-12-12',
'ended_at' => '2019-12-24',
'page' => 1,
'per_page' => 20
]);
document
{
"data": [
{
"type": "point",
"id": 1976,
"attributes": {
"rule_name": "create_question",
"point": 5,
"op_type": 1,
"reason": "",
"created_at": "2019-12-25 14:52:21"
},
"relationships": {
"staff": {
"data": {
"type": "staff",
"id": "ThreeZhang"
}
}
}
}
],
"links": {
"first": "https://lxapi.lexiangla.com/cgi-bin/v1/points?staff_id=ThreeZhang&started_at=2019-12-12&ended_at=2019-12-24&per_page=20&page=1",
"last": "https://lxapi.lexiangla.com/cgi-bin/v1/points?staff_id=ThreeZhang&started_at=2019-12-12&ended_at=2019-12-24&per_page=20&page=11",
"prev": null,
"next": "https://lxapi.lexiangla.com/cgi-bin/v1/points?staff_id=ThreeZhang&started_at=2019-12-12&ended_at=2019-12-24&per_page=20&page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 11,
"path": "https://lxapi.lexiangla.com/cgi-bin/v1/points",
"per_page": 20,
"to": 15,
"total": 164
},
"included": [
{
"type":"staff",
"id":"ThreeZhang",
"attributes":{
"name":"张三",
"english_name":null,
"organization":"开发组\乐享开发 "
}
}
]
}
当员工的企业微信ID不存在时,会返回400状态码,且响应体如下所示:
{
"errors": [
{
"detail": "该员工不存在"
}
]
}
当没有传递必须参数时,会返回400状态码,且响应体如下所示:
{
"errors":[
{
"detail":"{"started_at":["不能为空"],"ended_at":["不能为空"]}"
}
]
}