thread-master/apps/backend/internal/logic/radar/archive_watch_logic.go

37 lines
868 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package radar
import (
"context"
"apps/backend/internal/svc"
"apps/backend/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type ArchiveWatchLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewArchiveWatchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ArchiveWatchLogic {
return &ArchiveWatchLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
// ArchiveWatch 是軟刪不再排入每日巡但歷史商機與統計都保留spec §3.1)。
func (l *ArchiveWatchLogic) ArchiveWatch(req *types.WatchIdReq) (resp *types.OkData, err error) {
uid, err := ownerUID(l.ctx)
if err != nil {
return nil, err
}
if err := l.svcCtx.Radar.ArchiveWatch(l.ctx, uid, req.Id); err != nil {
return nil, err
}
return &types.OkData{Ok: true, Message: "watch archived"}, nil
}