34 lines
666 B
Go
34 lines
666 B
Go
|
package obj
|
||
|
|
||
|
type VerifyData struct {
|
||
|
Users []*VerifyUser
|
||
|
}
|
||
|
|
||
|
type VerifyUser struct {
|
||
|
UserID int
|
||
|
GroupID int64
|
||
|
LeftTime int
|
||
|
MessageID int
|
||
|
}
|
||
|
|
||
|
func (vd *VerifyData) AddUser(user *VerifyUser) {
|
||
|
vd.Users = append(vd.Users, user)
|
||
|
}
|
||
|
|
||
|
func (vd VerifyData) ExistCountdownForUserInGroup(userID int, groupID int64) bool {
|
||
|
for _, user := range vd.Users {
|
||
|
if user.UserID == userID && user.GroupID == groupID {
|
||
|
return true
|
||
|
}
|
||
|
}
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
func (vd *VerifyData) RemoveUser(userID int, groupID int64) {
|
||
|
for i, user := range vd.Users {
|
||
|
if user.UserID == userID && user.GroupID == groupID {
|
||
|
vd.Users = append(vd.Users[:i], vd.Users[i+1:]...)
|
||
|
}
|
||
|
}
|
||
|
}
|