feat: 成长记录
This commit is contained in:
@@ -250,3 +250,29 @@ func (a *MyPlantApi) DeletePlan(c *gin.Context) {
|
||||
}
|
||||
response.OkWithMsg("删除任务成功", c)
|
||||
}
|
||||
|
||||
// AddGrowthRecord 添加成长记录
|
||||
// @Tags 我的植物
|
||||
// @Summary 添加成长记录
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @Produce application/json
|
||||
// @Param data body plantReq.CreateGrowthRecord true "添加成长记录"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"添加成功"}"
|
||||
// @Router /plant/growth/add [post]
|
||||
func (a *MyPlantApi) AddGrowthRecord(c *gin.Context) {
|
||||
var req plantReq.CreateGrowthRecord
|
||||
err := c.ShouldBindJSON(&req)
|
||||
if err != nil {
|
||||
response.FailWithMsg("请求参数错误", c)
|
||||
return
|
||||
}
|
||||
userId := auth.GetUserId(c)
|
||||
err = plantService.AddGrowthRecord(req, userId)
|
||||
if err != nil {
|
||||
global.Logger.Error("添加成长记录失败", zap.Error(err))
|
||||
response.FailWithMsg("添加成长记录失败", c)
|
||||
return
|
||||
}
|
||||
response.OkWithMsg("添加成长记录成功", c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user