Пример #1
0
func processUser(user *model.HGHUser) {

	myrepos, err := user.GetRepoBinds()
	if err != nil || len(myrepos) == 0 {
		return
	}

	commitscount := 0
	repocount := 0
	for _, repobind := range myrepos {
		if repobind.NewCommitsCount > 0 {
			commitscount += repobind.NewCommitsCount
			repocount++
		}
	}

	if commitscount > 0 {
		user.NotifyTime = time.Now().Unix()
		user.Save()

		notify.SendWithCommitsRepos(*user, repocount, commitscount)
	}
}
Пример #2
0
func AuthorizeUser(username string, token string, device string) bool {
	user := model.HGHUser{username, token, device, time.Now().Unix(), 0}
	user.Save()

	return true
}