diff --git a/domain/service/cp_s/cp_relation.go b/domain/service/cp_s/cp_relation.go index bc60eeed138ab291e196b86f8006423595e8c0c3..ac96772904c30ac71ff71e30f3a561985399419b 100644 --- a/domain/service/cp_s/cp_relation.go +++ b/domain/service/cp_s/cp_relation.go @@ -130,6 +130,15 @@ func CancelCpRelation(myCtx *mycontext.MyContext, myUserId uint64, externalId, l return err } + // 我和对方是否是cp,且cp关系存在 + cpRelation, err := cp_m.GetCpByIds(model, myUserId, userRec.ID) + if err != nil { + return err + } + if cpRelation.Id == 0 { + model.Log.Errorf("CancelCpRelation cp关系不存在 id1:%v, id2:%v", myUserId, userRec.ID) + return myerr.WrapErr(bizerr.InvalidParameter) + } // 自己没有cp了 myCp, err := cp_m.GetCp(model, myUserId) if err != nil { @@ -146,15 +155,6 @@ func CancelCpRelation(myCtx *mycontext.MyContext, myUserId uint64, externalId, l if inviCp.Id == 0 { return myerr.WrapErr(bizerr.InvalidParameter) } - // 我和对方是否是cp,且cp关系存在 - cpRelation, err := cp_m.GetCpByIds(model, myUserId, userRec.ID) - if err != nil { - return err - } - if cpRelation.Id == 0 { - model.Log.Errorf("CancelCpRelation cp关系不存在 id1:%v, id2:%v", myUserId, userRec.ID) - return myerr.WrapErr(bizerr.InvalidParameter) - } // 是否有关于我的cp解除申请,且还未被处理 myCancel, err := cp_m.GetCpCancelWithMe(model, user.ID, cp_e.CpCancel)