mirror of https://gitee.com/answerdev/answer.git
add revision userid
This commit is contained in:
parent
04a49d2316
commit
de429a4521
|
@ -25,7 +25,7 @@ type Revision struct {
|
|||
Content string `xorm:"not null TEXT content"`
|
||||
Log string `xorm:"VARCHAR(255) log"`
|
||||
Status int `xorm:"not null default 1 INT(11) status"`
|
||||
ReviewUserID int64 `xorm:"not null default 0 BIGINT(20) review_user_id"`
|
||||
ReviewUserID string `xorm:"not null default 0 BIGINT(20) review_user_id"`
|
||||
}
|
||||
|
||||
// TableName revision table name
|
||||
|
|
|
@ -81,14 +81,15 @@ func (rr *revisionRepo) UpdateObjectRevisionId(ctx context.Context, revision *en
|
|||
}
|
||||
|
||||
// UpdateStatus update revision status
|
||||
func (rr *revisionRepo) UpdateStatus(ctx context.Context, id string, status int) (err error) {
|
||||
func (rr *revisionRepo) UpdateStatus(ctx context.Context, id string, status int, reviewUserID string) (err error) {
|
||||
if id == "" {
|
||||
return nil
|
||||
}
|
||||
var data entity.Revision
|
||||
data.ID = id
|
||||
data.Status = status
|
||||
_, err = rr.data.DB.Where("id =?", id).Cols("status").Update(&data)
|
||||
data.ReviewUserID = reviewUserID
|
||||
_, err = rr.data.DB.Where("id =?", id).Cols("status", "review_user_id").Update(&data)
|
||||
if err != nil {
|
||||
return errors.InternalServer(reason.DatabaseError).WithError(err).WithStack()
|
||||
}
|
||||
|
|
|
@ -16,5 +16,5 @@ type RevisionRepo interface {
|
|||
UpdateObjectRevisionId(ctx context.Context, revision *entity.Revision, session *xorm.Session) (err error)
|
||||
ExistUnreviewedByObjectID(ctx context.Context, objectID string) (revision *entity.Revision, exist bool, err error)
|
||||
GetUnreviewedRevisionPage(ctx context.Context, page, pageSize int, objectTypes []int) ([]*entity.Revision, int64, error)
|
||||
UpdateStatus(ctx context.Context, id string, status int) (err error)
|
||||
UpdateStatus(ctx context.Context, id string, status int, reviewUserID string) (err error)
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ func (rs *RevisionService) RevisionAudit(ctx context.Context, req *schema.Revisi
|
|||
return
|
||||
}
|
||||
if req.Operation == schema.RevisionAuditReject {
|
||||
err = rs.revisionRepo.UpdateStatus(ctx, req.ID, entity.RevisionReviewRejectStatus)
|
||||
err = rs.revisionRepo.UpdateStatus(ctx, req.ID, entity.RevisionReviewRejectStatus, req.UserID)
|
||||
return
|
||||
}
|
||||
if req.Operation == schema.RevisionAuditApprove {
|
||||
|
@ -110,7 +110,7 @@ func (rs *RevisionService) RevisionAudit(ctx context.Context, req *schema.Revisi
|
|||
if saveErr != nil {
|
||||
return saveErr
|
||||
}
|
||||
err = rs.revisionRepo.UpdateStatus(ctx, req.ID, entity.RevisionReviewPassStatus)
|
||||
err = rs.revisionRepo.UpdateStatus(ctx, req.ID, entity.RevisionReviewPassStatus, req.UserID)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue