2026-08-09 10:43:45 +08:00
package match
import (
"context"
"time"
2026-08-10 11:42:45 +08:00
"bsm/full/module/social/relation/internal/impl"
"bsm/full/module/social/relation/internal/models"
pb "bsm/full/module/social/relation/pb"
2026-08-09 10:43:45 +08:00
"git.apinb.com/bsm-sdk/core/errcode"
"git.apinb.com/bsm-sdk/core/printer"
"git.apinb.com/bsm-sdk/core/service"
"git.apinb.com/bsm-sdk/core/vars"
)
2026-09-22 21:15:34 +08:00
// 执行忽略:标记匹配记录状态为已忽略
2026-08-09 20:14:57 +08:00
func DoIgnore ( ctx context . Context , in * pb . IdentRequest ) ( reply * pb . DataStatusReply , err error ) {
2026-08-09 10:43:45 +08:00
// parse authorization meta.
2026-09-22 21:15:34 +08:00
auth , err := service . ParseMetaCtx ( ctx , nil )
2026-08-09 10:43:45 +08:00
if err != nil {
return nil , err
}
if in . Identity == "" {
return nil , errcode . ErrInvalidArgument
}
2026-09-22 21:15:34 +08:00
// 操作匹配记录表并限定归属, status=-1 表示已忽略
result := impl . DBService . Model ( new ( models . RelationMatch ) ) . Where ( "relation_identity=? and recommend_identity=?" , auth . Identity , in . Identity ) . UpdateColumn ( "status" , - 1 )
if result . Error != nil {
printer . Error ( result . Error . Error ( ) )
2026-08-09 10:43:45 +08:00
return nil , errcode . ErrDB
}
2026-09-22 21:15:34 +08:00
if result . RowsAffected == 0 {
return nil , errcode . ErrPermissionDenied
}
2026-08-09 20:14:57 +08:00
return & pb . DataStatusReply {
2026-08-09 10:43:45 +08:00
Data : vars . OK ,
Timeseq : time . Now ( ) . UnixMilli ( ) ,
} , nil
}