Merge remote-tracking branch 'origin/feat/1.2.0/img' into test

This commit is contained in:
LinkinStars 2023-10-13 17:05:53 +08:00
commit 359cb3201b
3 changed files with 8 additions and 4 deletions

View File

@ -75,7 +75,7 @@ func (uc *UserController) GetUserInfoByUserID(ctx *gin.Context) {
}
resp, err := uc.userService.GetUserInfoByUserID(ctx, token, userInfo.UserID)
uc.setVisitCookies(ctx, userInfo.VisitToken)
uc.setVisitCookies(ctx, userInfo.VisitToken, false)
handler.HandleResponse(ctx, err, resp)
}
@ -139,7 +139,7 @@ func (uc *UserController) UserEmailLogin(ctx *gin.Context) {
if !isAdmin {
uc.actionService.ActionRecordDel(ctx, entity.CaptchaActionPassword, ctx.ClientIP())
}
uc.setVisitCookies(ctx, resp.VisitToken)
uc.setVisitCookies(ctx, resp.VisitToken, true)
handler.HandleResponse(ctx, nil, resp)
}
@ -680,9 +680,9 @@ func (uc *UserController) SearchUserListByName(ctx *gin.Context) {
handler.HandleResponse(ctx, err, resp)
}
func (uc *UserController) setVisitCookies(ctx *gin.Context, visitToken string) {
func (uc *UserController) setVisitCookies(ctx *gin.Context, visitToken string, force bool) {
cookie, err := ctx.Cookie(constant.UserVisitCookiesCacheKey)
if err == nil && len(cookie) > 0 {
if err == nil && len(cookie) > 0 && !force {
return
}
general, err := uc.siteInfoCommonService.GetSiteGeneral(ctx)

View File

@ -502,6 +502,7 @@ func (as *AnswerService) AdminSetAnswerStatus(ctx context.Context, req *schema.A
//}
as.activityQueueService.Send(ctx, &schema.ActivityMsg{
UserID: req.UserID,
TriggerUserID: converter.StringToInt64(req.UserID),
ObjectID: answerInfo.ID,
OriginalObjectID: answerInfo.ID,
ActivityTypeKey: constant.ActAnswerDeleted,

View File

@ -1281,6 +1281,7 @@ func (qs *QuestionService) AdminSetQuestionStatus(ctx context.Context, req *sche
//}
qs.activityQueueService.Send(ctx, &schema.ActivityMsg{
UserID: questionInfo.UserID,
TriggerUserID: converter.StringToInt64(req.UserID),
ObjectID: questionInfo.ID,
OriginalObjectID: questionInfo.ID,
ActivityTypeKey: constant.ActQuestionDeleted,
@ -1290,6 +1291,7 @@ func (qs *QuestionService) AdminSetQuestionStatus(ctx context.Context, req *sche
if setStatus == entity.QuestionStatusAvailable && questionInfo.Status == entity.QuestionStatusClosed {
qs.activityQueueService.Send(ctx, &schema.ActivityMsg{
UserID: questionInfo.UserID,
TriggerUserID: converter.StringToInt64(req.UserID),
ObjectID: questionInfo.ID,
OriginalObjectID: questionInfo.ID,
ActivityTypeKey: constant.ActQuestionReopened,
@ -1298,6 +1300,7 @@ func (qs *QuestionService) AdminSetQuestionStatus(ctx context.Context, req *sche
if setStatus == entity.QuestionStatusClosed && questionInfo.Status != entity.QuestionStatusClosed {
qs.activityQueueService.Send(ctx, &schema.ActivityMsg{
UserID: questionInfo.UserID,
TriggerUserID: converter.StringToInt64(req.UserID),
ObjectID: questionInfo.ID,
OriginalObjectID: questionInfo.ID,
ActivityTypeKey: constant.ActQuestionClosed,