feat: swag.
This commit is contained in:
+31
-2
@@ -41,7 +41,15 @@ func NewTrainingController() *TrainingController {
|
||||
return &TrainingController{DB: config.DB}
|
||||
}
|
||||
|
||||
// 接收训练记录
|
||||
// @Summary 创建训练记录
|
||||
// @Description 接收并保存训练记录及心率数据,支持重复上传(按train_id去重更新)
|
||||
// @Tags 训练管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param record body SwagAPIResponse true "训练记录数据"
|
||||
// @Success 201 {object} SwagAPIResponse "保存成功"
|
||||
// @Failure 400 {object} SwagAPIResponse "请求参数错误"
|
||||
// @Router /train-records [post]
|
||||
func (tc *TrainingController) CreateTrainingRecord(c *gin.Context) {
|
||||
var record models.TrainRecord
|
||||
|
||||
@@ -121,6 +129,15 @@ type trainingSessionRequest struct {
|
||||
AppName string `json:"appName"`
|
||||
}
|
||||
|
||||
// @Summary 上传训练会话
|
||||
// @Description 上传训练开始/结束会话,用于MQTT训练会话追踪
|
||||
// @Tags 训练管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param session body trainingSessionRequest true "训练会话数据"
|
||||
// @Success 200 {object} SwagAPIResponse "操作成功"
|
||||
// @Failure 400 {object} SwagAPIResponse "请求参数错误"
|
||||
// @Router /train-records/session [post]
|
||||
func (tc *TrainingController) UploadTrainingSession(c *gin.Context) {
|
||||
var req trainingSessionRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
@@ -225,6 +242,12 @@ type cloudLessonPlanItem struct {
|
||||
UploaderName string `json:"uploaderName"`
|
||||
}
|
||||
|
||||
// @Summary 获取云端教案列表
|
||||
// @Description 获取所有云端教案文件列表
|
||||
// @Tags 训练管理
|
||||
// @Produce json
|
||||
// @Success 200 {object} SwagAPIResponse "查询成功"
|
||||
// @Router /train-records/cloud-files [get]
|
||||
func (tc *TrainingController) ListCloudLessonPlans(c *gin.Context) {
|
||||
var records []models.AppFile
|
||||
if err := tc.DB.Where("file_type = ?", models.AppFileTypeLessonPlan).Order("created_at DESC").Find(&records).Error; err != nil {
|
||||
@@ -266,7 +289,13 @@ type CurvePoint struct {
|
||||
Y float64 `json:"y"` // Y坐标
|
||||
}
|
||||
|
||||
// analysis_handler.go
|
||||
// @Summary 心率曲线分析
|
||||
// @Description 对历史心率数据进行统计分析和正态分布曲线拟合
|
||||
// @Tags 训练管理
|
||||
// @Produce json
|
||||
// @Success 200 {object} SwagAPIResponse "分析成功"
|
||||
// @Failure 400 {object} SwagAPIResponse "数据量不足"
|
||||
// @Router /train-records/analysis [get]
|
||||
func (tc *TrainingController) HandleCurveAnalysis(c *gin.Context) {
|
||||
// 获取数据库连接(根据实际项目配置调整)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user