Exemplo n.º 1
0
func (ps *PersonalService) DeletePersonProject() (bool, string) {
	tools.Info("delete personal Project")
	var tr = new([]*Project.Project)
	ok, result := Project.GetProjectByCreator(ps.Userid, tr)
	if ok == false {
		if result == 0 {
			tools.Error("this user is not exist")
			return false, "this user have no project"
		} else {
			return false, "please try again later"
		}
	}
	ps.Container["project"] = new(Common.ModelContainerSlice)
	for _, value := range *tr {
		ps.Container["project"].(*Common.ModelContainerSlice).ContainerSlice = append(ps.Container["project"].(*Common.ModelContainerSlice).ContainerSlice, value)
	}
	return true, "ok"
}
Exemplo n.º 2
0
func (ps *ProjectService) GetAllProjectInfo() (bool, string) {
	tools.Info("get project info")
	var projectlist = new([]*Project.Project)
	ok, result := Project.GetProjectByCreator(ps.Userid, projectlist)
	if ok == false {
		if result == 0 {
			tools.Error("this project have not exist")
			return false, "get project not exist"
		} else {
			return false, "get project all info falied ,please try again later"
		}
	}
	if len(*projectlist) <= 0 {
		ps.Container["projectinfo"] = nil
	} else {
		ps.Container["projectinfo"] = projectlist
	}
	return true, "ok"
}
Exemplo n.º 3
0
func (ps *PersonalService) UpdataPersonWatchingProject() (bool, string) {
	tools.Info("updata personal WatchingProject")
	var tr = new([]*Project.Project)
	ok, result := Project.GetProjectByCreator(ps.Userid, tr)
	if ok == false {
		if result == 0 {
			tools.Error("this user have no Following")
			return false, "update error"
		} else {
			return false, "please try again later"
		}
	}
	ps.Container["follower"] = new(Common.ModelContainerSlice)
	for _, value := range *tr {
		ps.Container["follower"].(*Common.ModelContainerSlice).ContainerSlice = append(ps.Container["Watching"].(*Common.ModelContainerSlice).ContainerSlice, value)
	}
	body, _ := json.Marshal(tr)

	return true, string(body)
}