Merge branch 'feat/1.1.1/state' into test

This commit is contained in:
LinkinStars 2023-07-21 10:47:43 +08:00
commit eb3537cb91
1 changed files with 8 additions and 2 deletions

View File

@ -55,6 +55,7 @@ func (ar *AnswerActivityRepo) SaveAcceptAnswerActivity(ctx context.Context, op *
return nil
}
ar.data.DB.ShowSQL(true)
// save activity
_, err = ar.data.DB.Transaction(func(session *xorm.Session) (result any, err error) {
session = session.Context(ctx)
@ -183,8 +184,13 @@ func (ar *AnswerActivityRepo) saveActivitiesAvailable(session *xorm.Session, op
continue
}
if exist {
if _, err = session.Where("id = ?", existsActivity.ID).Cols("`cancelled`").
Update(&entity.Activity{Cancelled: entity.ActivityAvailable}); err != nil {
bean := &entity.Activity{
Cancelled: entity.ActivityAvailable,
Rank: act.Rank,
HasRank: act.HasRank(),
}
session.Where("id = ?", existsActivity.ID)
if _, err = session.Cols("`cancelled`", "`rank`", "`has_rank`").Update(bean); err != nil {
return err
}
} else {