feat: 初次启动
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package myPlant
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/plant/api/internal/svc"
|
||||
"sundynix-micro-go/app/plant/api/internal/types"
|
||||
plantModel "sundynix-micro-go/app/plant/model"
|
||||
"sundynix-micro-go/app/plant/rpc/plant"
|
||||
)
|
||||
|
||||
type DeletePlantLogic struct {
|
||||
@@ -21,13 +19,6 @@ func NewDeletePlantLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delet
|
||||
}
|
||||
|
||||
func (l *DeletePlantLogic) DeletePlant(req *types.IdsReq) error {
|
||||
if err := l.svcCtx.DB.Where("id IN ?", req.Ids).Delete(&plantModel.SundynixMyPlant{}).Error; err != nil {
|
||||
return fmt.Errorf("删除植物失败")
|
||||
}
|
||||
// 清理关联数据
|
||||
l.svcCtx.DB.Where("plant_id IN ?", req.Ids).Delete(&plantModel.SundynixCarePlan{})
|
||||
l.svcCtx.DB.Where("plant_id IN ?", req.Ids).Delete(&plantModel.SundynixCareRecord{})
|
||||
l.svcCtx.DB.Where("plant_id IN ?", req.Ids).Delete(&plantModel.SundynixCareTask{})
|
||||
l.svcCtx.DB.Where("plant_id IN ?", req.Ids).Delete(&plantModel.SundynixGrowthRecord{})
|
||||
return nil
|
||||
_, err := l.svcCtx.PlantRpc.DeletePlant(l.ctx, &plant.IdsReq{Ids: req.Ids})
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user