From b1c863073a8aa4d5ca8a4c72dca3a84b8da3f38a Mon Sep 17 00:00:00 2001 From: chenweijian <820961417@qq.com> Date: Wed, 14 Jun 2023 14:54:09 +0800 Subject: [PATCH] im check --- domain/model/cp_m/cp_relation.go | 4 ++-- route/cp_r/cp_relation.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/domain/model/cp_m/cp_relation.go b/domain/model/cp_m/cp_relation.go index 50fed84..6f24c9c 100644 --- a/domain/model/cp_m/cp_relation.go +++ b/domain/model/cp_m/cp_relation.go @@ -209,9 +209,9 @@ func GetCpCancel(model *domain.Model, userIds []uint64, status cp_e.CpCancelStat return res, nil } -func GetCpCancelById(model *domain.Model, id uint64, status cp_e.CpCancelStatus) (*CpCancel, error) { +func GetCpCancelById(model *domain.Model, id, userId uint64) (*CpCancel, error) { res := new(CpCancel) - err := model.DB().Model(CpCancel{}).Where("status = ? and id = ?", status, id).First(&res).Error + err := model.DB().Model(CpCancel{}).Where("id = ? and (user_id = ? or rec_user_id = ?)", id, userId, userId).First(&res).Error if err != nil { if err == gorm.ErrRecordNotFound { return nil, nil diff --git a/route/cp_r/cp_relation.go b/route/cp_r/cp_relation.go index 8743b04..97461eb 100644 --- a/route/cp_r/cp_relation.go +++ b/route/cp_r/cp_relation.go @@ -502,7 +502,7 @@ func CheckCpImExpire(c *gin.Context) (*mycontext.MyContext, error) { resId = common.MSG_ID_ALREADY_EXPIRED } case 2: // 解除的消息im检查是否过期 - cpCancel, err := cp_m.GetCpCancelById(model, msgId, cp_e.CpCancel) + cpCancel, err := cp_m.GetCpCancelById(model, msgId, userId) if err != nil { model.Log.Errorf("CheckCpImExpire userId:%d, msgType:%d, msgId:%d, err:%v", userId, msgType, msgId, err) return myCtx, err -- 2.22.0