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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user