feat: 快捷养护接口
This commit is contained in:
@@ -277,3 +277,28 @@ func (a *MyPlantApi) AddGrowthRecord(c *gin.Context) {
|
||||
}
|
||||
response.OkWithMsg("添加成长记录成功", c)
|
||||
}
|
||||
|
||||
// QuickCare 快捷养护记录
|
||||
// @Tags 我的植物
|
||||
// @Summary 快捷养护记录(无需预设任务)
|
||||
// @Security BearerAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body plantReq.QuickCare true "快捷养护"
|
||||
// @Router /plant/quickCare [post]
|
||||
func (a *MyPlantApi) QuickCare(c *gin.Context) {
|
||||
var req plantReq.QuickCare
|
||||
err := c.ShouldBindJSON(&req)
|
||||
if err != nil {
|
||||
response.FailWithMsg("请求参数错误", c)
|
||||
return
|
||||
}
|
||||
userId := auth.GetUserId(c)
|
||||
err = plantService.QuickCare(req, userId)
|
||||
if err != nil {
|
||||
global.Logger.Error("快捷养护记录失败", zap.Error(err))
|
||||
response.FailWithMsg(err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMsg("养护记录已保存", c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user