更新计划时清零计数器

This commit is contained in:
2025-09-23 22:38:04 +08:00
parent 68b97a12a1
commit 6520f2e9d7

View File

@@ -296,6 +296,10 @@ func (c *Controller) UpdatePlan(ctx *gin.Context) {
}
// 5. 调用仓库方法更新计划
// 只要是更新任务,就重置执行计数器
planToUpdate.ExecuteCount = 0 // 重置计数器
c.logger.Infof("计划 #%d 被更新,执行计数器已重置为 0。", planToUpdate.ID)
if err := c.planRepo.UpdatePlan(planToUpdate); err != nil {
controller.SendErrorResponse(ctx, controller.CodeBadRequest, "更新计划失败: "+err.Error())
return