feat: 删除植物和删除养护事项

This commit is contained in:
Blizzard
2026-02-07 14:40:22 +08:00
parent 87c31f119f
commit e4de80eecc
6 changed files with 174 additions and 21 deletions
+48
View File
@@ -158,3 +158,51 @@ func (a *MyPlantApi) CompleteTask(c *gin.Context) {
}
response.OkWithMsg("完成任务成功", c)
}
// DeletePlants
// @Tags 我的植物
// @Summary 删除植物
// @Security ApiKeyAuth
// @accept json
// @Produce application/json
// @Param data body request.IdsReq true "删除植物"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /plant/delete/ [post]
func (a *MyPlantApi) DeletePlants(c *gin.Context) {
var req request.IdsReq
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("请求参数错误", c)
return
}
err = plantService.DeletePlants(req)
if err != nil {
global.Logger.Error("删除植物失败", zap.Error(err))
response.FailWithMsg("删除植物失败", c)
}
response.OkWithMsg("删除植物成功", c)
}
// DeletePlans DeletePlants
// @Tags 我的植物
// @Summary 删除任务
// @Security ApiKeyAuth
// @accept json
// @Produce application/json
// @Param data body request.IdsReq true "删除植物"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /plant/deletePlant [post]
func (a *MyPlantApi) DeletePlans(c *gin.Context) {
var req request.IdsReq
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("请求参数错误", c)
return
}
err = plantService.DeletePlans(req)
if err != nil {
global.Logger.Error("删除任务失败", zap.Error(err))
response.FailWithMsg("删除任务失败", c)
}
response.OkWithMsg("删除任务成功", c)
}