fix version 1
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
package follow
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
pb "bsm/full/module/social/relation/pb"
|
||||
"git.apinb.com/bsm-sdk/core/errcode"
|
||||
"git.apinb.com/bsm-sdk/core/service"
|
||||
"git.apinb.com/bsm-sdk/core/vars"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 执行关注
|
||||
func Do(ctx context.Context, in *pb.IdentRequest) (reply *pb.DataStatusReply, err error) {
|
||||
// parse authorization meta.
|
||||
_, err = service.ParseMetaCtx(ctx, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// valildate request id,identity.
|
||||
if in.Id == 0 && in.Identity == "" {
|
||||
return nil, errcode.ErrInvalidArgument
|
||||
}
|
||||
|
||||
// TODO: add your logic code & delete this line.
|
||||
|
||||
return &pb.DataStatusReply{
|
||||
Data: vars.OK,
|
||||
Timeseq: time.Now().UnixMilli(),
|
||||
}, nil
|
||||
|
||||
}
|
||||
@@ -22,7 +22,7 @@ func Fetch(ctx context.Context, in *pb.FetchRequest) (reply *pb.FetchRelationIte
|
||||
var (
|
||||
total int64
|
||||
column string
|
||||
ids []uint
|
||||
ids []string
|
||||
model = impl.DBService.Model(&models.RelationFollow{})
|
||||
cards []*pb.RelationItem
|
||||
)
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
|
||||
// 撤销关注
|
||||
func Undo(ctx context.Context, in *pb.IdentRequest) (reply *pb.DataStatusReply, err error) {
|
||||
_, err = service.ParseMetaCtx(ctx, nil)
|
||||
auth, err := service.ParseMetaCtx(ctx, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -23,7 +23,8 @@ func Undo(ctx context.Context, in *pb.IdentRequest) (reply *pb.DataStatusReply,
|
||||
return nil, errcode.ErrInvalidArgument
|
||||
}
|
||||
|
||||
err = impl.DBService.Model(&models.RelationFollow{}).Delete("identity=?", in.Identity).Error
|
||||
// 只能撤销自己发起的关注:归属列是 from_identity
|
||||
err = impl.DBService.Model(&models.RelationFollow{}).Delete("identity=? and from_identity=?", in.Identity, auth.Identity).Error
|
||||
if err != nil {
|
||||
printer.Error(err.Error())
|
||||
return nil, errcode.ErrDB
|
||||
|
||||
Reference in New Issue
Block a user