Пример #1
0
func (ps *ProjectService) UpdataProjectInfo() (bool, string) {
	tools.Info("updata project")
	project := Project.NewProject()

	project.Projectid = ps.Projectid

	ok, result := project.Get()
	if ok == false {
		if result == 0 {
			tools.Error("this project have not exist")
			return false, "this project have not exist"
		} else {
			return false, "get project failed ,please try again later"
		}
	}
	project.Projectname = ps.Params["projectname"].(string)
	project.Star = 0
	project.Creator = ps.Params["creator"].(string)
	project.Watching = 1
	ok, result = project.Update()
	if ok == false {
		if result == 0 {
			tools.Error("this project have not exist")
			return false, "update project have not exist"
		} else {
			return false, "update project failed ,please try again later"
		}
	}
	return true, "ok"
}
Пример #2
0
func (ps *ProjectService) CreateProjectInfo() (bool, string) {
	tools.Info("create new project")
	project := Project.NewProject()
	project.Projectid = ps.Projectid
	project.Projectname = ps.Params["projectname"].(string)
	project.Star = 0
	project.Creator = ps.Params["creator"].(string)
	project.Watching = 1
	ok, _ := project.Get()

	if ok {
		return false, "Process error : this project has been created"
	}

	ok, result := project.Insert()
	if ok == false {
		if result == 0 {
			tools.Error("create project failed")
			return false, "create project failed"
		} else {
			return false, "create project failed ,please try again later"
		}
	}
	return true, "ok"
}
Пример #3
0
func (ps *ProjectService) GetProjectInfo() (bool, string) {
	tools.Info("get project info")
	project := Project.NewProject()
	project.Projectid = ps.Projectid
	ok, result := project.Get()
	if ok == false {
		if result == 0 {
			tools.Error("this project have not exist")
			return false, "this project have not exist"
		} else {
			return false, "get project failed ,please try again later"
		}
	}
	ps.Container["projectinfo"] = project
	return true, "ok"
}