fix: #22 #26 Fixed the error in the notification(achievement) source triggered by the adoption answer.

This commit is contained in:
LinkinStar 2022-10-26 14:16:04 +08:00
parent 3ddb66ae70
commit bfd2b9b87e
1 changed files with 4 additions and 1 deletions

View File

@ -12,6 +12,7 @@ import (
"github.com/answerdev/answer/internal/service/activity_common"
"github.com/answerdev/answer/internal/service/notice_queue"
"github.com/answerdev/answer/internal/service/rank"
"github.com/answerdev/answer/pkg/converter"
"github.com/segmentfault/pacman/errors"
"github.com/segmentfault/pacman/log"
"xorm.io/xorm"
@ -140,8 +141,10 @@ func (ar *AnswerActivityRepo) AcceptAnswer(ctx context.Context,
}
if action == acceptAction {
addActivity.UserID = questionUserID
addActivity.TriggerUserID = converter.StringToInt64(answerUserID)
} else {
addActivity.UserID = answerUserID
addActivity.TriggerUserID = converter.StringToInt64(answerUserID)
}
if isSelf {
addActivity.Rank = 0
@ -193,7 +196,7 @@ func (ar *AnswerActivityRepo) AcceptAnswer(ctx context.Context,
}
if act.UserID == questionUserID {
msg.TriggerUserID = answerUserID
msg.ObjectType = constant.QuestionObjectType
msg.ObjectType = constant.AnswerObjectType
} else {
msg.TriggerUserID = questionUserID
msg.ObjectType = constant.AnswerObjectType