update short id

This commit is contained in:
aichy126 2023-03-17 10:54:54 +08:00
parent c4780fa3e5
commit d7d652040c
3 changed files with 5 additions and 2 deletions

View File

@ -22,6 +22,7 @@ import (
"github.com/answerdev/answer/internal/service/revision_common"
usercommon "github.com/answerdev/answer/internal/service/user_common"
"github.com/answerdev/answer/pkg/encryption"
"github.com/answerdev/answer/pkg/uid"
"github.com/segmentfault/pacman/errors"
"github.com/segmentfault/pacman/log"
)
@ -159,7 +160,7 @@ func (as *AnswerService) Insert(ctx context.Context, req *schema.AnswerAddReq) (
if err != nil {
log.Error("IncreaseAnswerCount error", err.Error())
}
err = as.questionCommon.UpdateLastAnswer(ctx, req.QuestionID, insertData.ID)
err = as.questionCommon.UpdateLastAnswer(ctx, req.QuestionID, uid.DeShortID(insertData.ID))
if err != nil {
log.Error("UpdateLastAnswer error", err.Error())
}

View File

@ -198,7 +198,7 @@ func (ns *NotificationCommon) SendNotificationToAllFollower(ctx context.Context,
}
condObjectID := msg.ObjectID
if len(questionID) > 0 {
condObjectID = questionID
condObjectID = uid.DeShortID(questionID)
}
userIDs, err := ns.followRepo.GetFollowUserIDs(ctx, condObjectID)
if err != nil {

View File

@ -15,6 +15,7 @@ import (
"github.com/answerdev/answer/internal/service/role"
usercommon "github.com/answerdev/answer/internal/service/user_common"
"github.com/answerdev/answer/pkg/htmltext"
"github.com/answerdev/answer/pkg/uid"
"github.com/segmentfault/pacman/errors"
"github.com/segmentfault/pacman/log"
"xorm.io/xorm"
@ -124,6 +125,7 @@ func (rs *RankService) CheckOperationPermissions(ctx context.Context, userID str
// CheckOperationObjectOwner check operation object owner
func (rs *RankService) CheckOperationObjectOwner(ctx context.Context, userID, objectID string) bool {
objectID = uid.DeShortID(objectID)
objectInfo, err := rs.objectInfoService.GetInfo(ctx, objectID)
if err != nil {
log.Error(err)