fix version 1
This commit is contained in:
@@ -15,7 +15,7 @@ import (
|
||||
|
||||
// 修改推文
|
||||
func Change(ctx context.Context, in *pb.PostItem) (reply *pb.DataStatusReply, err error) {
|
||||
_, err = service.ParseMetaCtx(ctx, nil)
|
||||
auth, err := service.ParseMetaCtx(ctx, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -31,17 +31,22 @@ func Change(ctx context.Context, in *pb.PostItem) (reply *pb.DataStatusReply, er
|
||||
if len(in.GetAttachs()) != 0 {
|
||||
for _, val := range in.Attachs {
|
||||
postData.Attachs = append(postData.Attachs, models.FeedRelateAttach{
|
||||
Identity: utils.UUID(),
|
||||
AttachType: val.AttachType,
|
||||
Url: val.Url,
|
||||
PostIdentity: in.Identity,
|
||||
Identity: utils.UUID(),
|
||||
AttachType: val.AttachType,
|
||||
Url: val.Url,
|
||||
})
|
||||
}
|
||||
}
|
||||
err = models.ChargePost(&postData)
|
||||
// 只能修改自己发布的动态
|
||||
affected, err := models.ChargePost(&postData, auth.Identity)
|
||||
if err != nil {
|
||||
printer.Error(err.Error())
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
if affected == 0 {
|
||||
return nil, errcode.ErrPermissionDenied
|
||||
}
|
||||
return &pb.DataStatusReply{
|
||||
Data: postData.Identity,
|
||||
Timeseq: time.Now().UnixNano(),
|
||||
|
||||
Reference in New Issue
Block a user