feat: Add callback and exchange features, refactor care plan task generation logic, and update wiki ordering to prioritize hot items.

This commit is contained in:
Blizzard
2026-02-26 08:57:13 +08:00
parent 9d4a5c6375
commit 3f05dccdce
23 changed files with 955 additions and 56 deletions
+9 -8
View File
@@ -161,7 +161,7 @@ func (s *MyPlantService) UpdatePlant(req plantReq.UpdateMyPlant) error {
if err != nil {
return err
}
//3.重新生成任务 CarePlans 结构体中使用钩子函数自动执行
//3.重新生成任务
//3.1 删除旧任务
err = tx.Where("plan_id = ?", plan.Id).Unscoped().Delete(&plant.CareTask{}).Error
if err != nil {
@@ -170,13 +170,14 @@ func (s *MyPlantService) UpdatePlant(req plantReq.UpdateMyPlant) error {
//3.2 创建新任务
dueDate := today.AddDate(0, 0, plan.Period)
task := plant.CareTask{
UserId: myPlant.UserId,
PlantId: myPlant.Id,
PlanId: plan.Id,
Name: plan.Name,
Icon: plan.Icon,
DueDate: dueDate,
Status: 1,
UserId: myPlant.UserId,
PlantId: myPlant.Id,
PlanId: plan.Id,
Name: plan.Name,
Icon: plan.Icon,
DueDate: dueDate,
Status: 1,
TargetAction: plan.TargetAction,
}
err = tx.Create(&task).Error
if err != nil {