Refactor code

pull/131/head
wenxu12345 3 years ago
parent 4336a1a13e
commit 7574d06718

@ -24,16 +24,15 @@ func UpdateGroupRequest(groupRequest GroupRequest) error {
if err != nil { if err != nil {
return err return err
} }
if groupRequest.HandledTime.Unix() < 0 { if groupRequest.HandledTime.Unix() < 0 {
groupRequest.HandledTime = utils.UnixSecondToTime(0) groupRequest.HandledTime = utils.UnixSecondToTime(0)
} }
t := dbConn.Table("group_request").Where("group_id=? and user_id=?", groupRequest.GroupID, groupRequest.UserID).Update(&groupRequest)
//RowsAffected //RowsAffected
if dbConn.Table("group_request").Where("group_id=? and user_id=?", groupRequest.GroupID, groupRequest.UserID).Update(&groupRequest).RowsAffected == 0 { if t.RowsAffected == 0 {
return InsertIntoGroupRequest(groupRequest) return InsertIntoGroupRequest(groupRequest)
} else { } else {
return nil return t.Error
} }
} }

Loading…
Cancel
Save