| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| period | String | 否 | 统计周期,可选值:month(月)、quarter(季度)、year(年),默认为month |
| year | Integer | 否 | 统计年份,如果不提供则使用当前年份 |
| access_token | String | 是 | 访问令牌 |
{
"year": 2024,
"period": "month",
"data": [
{
"月份": "1月",
"销售金额": 39000,
"消课金额": 36890
},
{
"月份": "2月",
"销售金额": 36800,
"消课金额": 25000
},
{
"月份": "3月",
"销售金额": 44700,
"消课金额": 30000
},
// ... 其他月份的数据
],
"chart_data": {
"labels": ["1月", "2月", "3月", ...],
"sales_amounts": [39000, 36800, 44700, ...],
"course_amounts": [36890, 25000, 30000, ...]
},
"trainer": {
"name": "刘尚武",
"image_1920": "base64编码的图片数据",
"total_members": 28
}
}
{
"error": "User not found",
"error_descrip": "未找到用户信息"
}
{
"error": "Trainer not found",
"error_descrip": "未找到教练信息"
}
{
"error": "No students found",
"error_descrip": "未找到学员信息"
}
{
"error": "Invalid year",
"error_descrip": "年份格式无效"
}
{
"error": "Invalid period",
"error_descrip": "无效的统计周期"
}
销售金额基于课程登记记录(course.registration)计算:
registration_date)归类到对应的月份total_price)消课金额基于会员训练记录(member.workout.detail)计算:
date_from)归类到对应的月份member_checkout=True)的记录price_per_hour)按月统计(默认):
GET /gym/trainer/my_data?access_token=abc123
按季度统计:
GET /gym/trainer/my_data?period=quarter&access_token=abc123
按年统计:
GET /gym/trainer/my_data?period=year&access_token=abc123
指定年份统计:
GET /gym/trainer/my_data?year=2023&access_token=abc123
该API返回的数据可用于生成类似以下的展示效果: