39 lines
1018 B
Go
39 lines
1018 B
Go
|
|
package friend
|
|||
|
|
|
|||
|
|
import (
|
|||
|
|
"context"
|
|||
|
|
"time"
|
|||
|
|
|
|||
|
|
"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"
|
|||
|
|
"git.apinb.com/bsm-social/relation/internal/impl"
|
|||
|
|
"git.apinb.com/bsm-social/relation/internal/models"
|
|||
|
|
pb "git.apinb.com/bsm-social/relation/pb"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// 好友申请Do:拒绝
|
|||
|
|
func ApplyDoReject(ctx context.Context, in *pb.IdentRequest) (reply *pb.StatusReply, err error) {
|
|||
|
|
auth, err := service.ParseMetaCtx(ctx, nil)
|
|||
|
|
if err != nil {
|
|||
|
|
return nil, err
|
|||
|
|
}
|
|||
|
|
if in.Identity == "" {
|
|||
|
|
return nil, errcode.ErrInvalidArgument
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
err = impl.DBService.Model(models.FriendApply{}).Where("to_identity=? and identity=?", auth.Identity, in.Identity).UpdateColumn("status", -1).Error
|
|||
|
|
if err != nil {
|
|||
|
|
printer.Error(err.Error())
|
|||
|
|
return nil, errcode.ErrDB
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//EventMQ:向mesh MQ中心发送报文,请求推送消息以及更新Cache.
|
|||
|
|
return &pb.StatusReply{
|
|||
|
|
Data: vars.OK,
|
|||
|
|
Timeseq: time.Now().UnixMilli(),
|
|||
|
|
}, nil
|
|||
|
|
|
|||
|
|
}
|