# 学分

# 获取学分明细

# 接口调用说明:

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

# 参数说明

参数 是否必须 默认值 说明
staff_id 员工帐号
started_at 开始日期,如 2021-10-16
ended_at 截止日期,如 2022-10-16
page 1 当前页数
per_page 20 每页返回的数量

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('credits',[
    'started_at'=>'2022-12-15',
    'ended_at'=>'2023-01-01'
]);

# 响应document

# 200 OK 状态码
{
    "data": [
        {
            "type": "credit",
            "id": "8214254",
            "attributes": {
                "credit": 100,
                "rule_name": "admin",
                "created_at": "2022-09-06 14:30:52",
                "source": "lisi",
                "reason": ""
            },
            "relationships": {
                "staff": {
                    "data": {
                        "type": "staff",
                        "id": "zhangsan"
                    }
                },
                "target": {
                    "data": {
                        "type": "staff",
                        "id": "lisi"
                    }
                }
            }
        },
        {
            "type": "credit",
            "id": "8214253",
            "attributes": {
                "credit": 100,
                "rule_name": "admin",
                "created_at": "2022-09-06 14:26:56",
                "source": "lisi",
                "reason": ""
            },
            "relationships": {
                "staff": {
                    "data": {
                        "type": "staff",
                        "id": "zhangsan"
                    }
                },
                "target": {
                    "data": {
                        "type": "staff",
                        "id": "lisi"
                    }
                }
            }
        },
        {
            "type": "credit",
            "id": "8214361",
            "attributes": {
                "credit": 100,
                "rule_name": "exam_event_finish",
                "created_at": "2022-10-14 14:42:12",
                "source": "考试",
                "reason": ""
            },
            "relationships": {
                "staff": {
                    "data": {
                        "type": "staff",
                        "id": "zhangsan"
                    }
                },
                "target": {
                    "data": {
                        "type": "exam",
                        "id": "5dd2a42a4ac211edb1a67ebdf95ba636"
                    }
                }
            }
        },
    ],
    "links": {
        "first": "https://lxapi.lexiangla.com/cgi-bin/v1/credits?started_at=2022-09-06&ended_at=2022-10-18&staff_id=libli&per_page=2&page=1",
        "last": "https://lxapi.lexiangla.com/cgi-bin/v1/credits?started_at=2022-09-06&ended_at=2022-10-18&staff_id=libli&per_page=2&page=4",
        "prev": null,
        "next": "https://lxapi.lexiangla.com/cgi-bin/v1/credits?started_at=2022-09-06&ended_at=2022-10-18&staff_id=libli&per_page=2&page=2"
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 4,
        "path": "https://lxapi.lexiangla.com/cgi-bin/v1/credits",
        "per_page": 2,
        "to": 2,
        "total": 7
    },
    "included": [
        {
            "type": "staff",
            "id": "zhangsan",
            "attributes": {
                "name": "zhangsan",
                "english_name": null,
                "organization": "2 "
            }
        },
        {
            "type": "staff",
            "id": "lisi",
            "attributes": {
                "name": "lisi",
                "english_name": null,
                "organization": "2 "
            }
        },
        {
            "type": "exam",
            "id": "555e626c49f911ed81b762c38c6a6404",
            "attributes": {
                "title": "考试--无倒计时",
                "content": "<p></p>",
                "staff_count": 133,
                "privilege_type": 0,
                "pass_score": 8,
                "duration": null,
                "finished_privilege": 2,
                "ended_privilege": 3,
                "exam_times_limit": 50,
                "limit_switch_count": 3,
                "enable_face_recognition": 0,
                "is_shuffled": 0,
                "started_at": "2022-10-12 14:42:00",
                "ended_at": "2022-10-15 14:42:00",
                "tips_when_start": 0,
                "tips_before_start": 0,
                "tips_before_end": 0,
                "created_at": "2022-10-12 14:44:34",
                "updated_at": "2022-10-12 15:44:05",
                "status": "end",
                "staffs_count": 133,
                "tags": [
                    "12212112"
                ]
            },
            "links": {
                "platform": "https://km.lexiangla.com/exams/555e626c49f911ed81b762c38c6a6404"
            }
        }
    ]
}

# 参数说明

参数 说明
data.id 学分事件id
attributes.credit 分值:增加,扣减:真实学分*100 或 -100
attributes.rule_name 学分规则:admin:管理员操作;class_pass:完成课程;exam_event_finish:完成考试; exam_event_pass:通过考试;roadmap_finish:完成项目
attributes.source 学分来源
attributes.created_at 时间
attributes.reason 备注
relationships.staff 该学分的所有者
relationships.target.data.type staff:操作增加、扣减学分的管理员;exam: 关联的考试信息;clazz:关联的课程信息;roadmap:关联的项目信息
included.attributes.tags 学分来源的关联标签