Beispiel #1
0
func (l *CloudTasks) Signup(username string, password string) error {
	l.CloudGetUserConfigByFile()
	fmt.Println(l)
	if l.UserConfig.Usertoken != "" {
		return errors.New("user has login. please logout first")
	} else {
		l.UserConfig.Usertoken, _ = utils.GenUUID()
		l.UserConfig.Pushtime = "2006-01-02 15:04:05"
		l.UserConfig.Pushtoken, _ = utils.GenUUID()
		l.UserConfig.Username = username
		l.UserConfig.Password = password
		return l.CloudSaveUserConfigToFile()
	}
	return nil
}
Beispiel #2
0
func (l *CloudTasks) CloudAddTask(s string) error {
	create_time_str := time.Now().Format("2006-01-02 15:04:05")
	doing_time_str := "2006-01-02 15:04:05"
	done_time_str := "2006-01-02 15:04:05"
	status := "New"
	task_str := s
	token, _ := utils.GenUUID()
	task := CloudTask{
		Task:       task_str,
		Token:      token,
		Createtime: create_time_str,
		Doingtime:  doing_time_str,
		Donetime:   done_time_str,
		Status:     status,
		Updatetime: create_time_str,
	}
	l.CloudGetAllWorkTaskByFile()
	l.WorkTasks = append(l.WorkTasks, task)
	return l.CloudTaskToFile()
}