Exemplo n.º 1
0
func (ps *PersonalService) PostPersonActive() (bool, string) {
	tools.Info("post personal Active")
	actmodel := Person.NewPersonAct()
	actmodel.Personid = ps.Userid

	actmodel.Createtime = time.Now().Unix()
	actmodel.TargetGroupid = ps.Userid
	actmodel.TargetGroupName = "one"
	actmodel.TargetOrganizationId = ps.Userid
	actmodel.TargetOrganizationName = "one"
	actmodel.TargetPersonName = "one"
	actmodel.TargetProjectId = ps.Userid
	actmodel.TargetProjectName = "one"
	actmodel.ActionTargetType = Person.PERSONAL_ACTIVE_TARGET_SELF
	actmodel.ActionType = Person.PERSONAL_EMAOTION_ACTIVE
	actmodel.TopicContent = "coldplay"
	ok := actmodel.Insert()

	if ok == false {
		tools.Info("post personal Active failed")
		return false, "post active error"
	}
	ps.Container["active"] = new(Common.ModelContainerSlice)
	ps.Container["active"].(*Common.ModelContainerSlice).ContainerSlice = append(ps.Container["active"].(*Common.ModelContainerSlice).ContainerSlice, actmodel)
	return true, "post active ok"
}
Exemplo n.º 2
0
func (ps *PersonalService) GetPersonActive() (bool, string) {
	tools.Info("get personal Active")
	useract := Person.NewPersonAct()
	useract.Personid = ps.Userid
	ok := useract.Get()
	if ok == false {
		tools.Info("get personal Active failed")
		return false, ""
	}
	var pb = new([]*Person.PersonAct)
	useract.GetBatch(pb)
	ps.Container["active"] = new(Common.ModelContainerSlice)
	if pb != nil {
		for _, value := range *pb {
			ps.Container["active"].(*Common.ModelContainerSlice).ContainerSlice = append(ps.Container["active"].(*Common.ModelContainerSlice).ContainerSlice, value)
		}
		return true, "get active ok"
	} else {
		return false, "get active empty"
	}

	return true, "get active ok"
}