37 lines
868 B
Go
37 lines
868 B
Go
|
|
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
|
|||
|
|
}
|