fix version 1
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
||||
|
||||
// 删除推文
|
||||
func Remove(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
|
||||
}
|
||||
@@ -22,11 +22,15 @@ func Remove(ctx context.Context, in *pb.IdentRequest) (reply *pb.DataStatusReply
|
||||
return nil, errcode.ErrInvalidArgument
|
||||
}
|
||||
|
||||
err = models.DeletePost(in.Identity)
|
||||
// 只能删除自己发布的动态
|
||||
affected, err := models.DeletePost(in.Identity, auth.Identity)
|
||||
if err != nil {
|
||||
printer.Error(err.Error())
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
if affected == 0 {
|
||||
return nil, errcode.ErrPermissionDenied
|
||||
}
|
||||
|
||||
return &pb.DataStatusReply{
|
||||
Data: vars.OK,
|
||||
|
||||
Reference in New Issue
Block a user