func (ps *PersonalService) DeletePersonFollowing() (bool, string) { tools.Info("get personal Following") sqlquery := "delete * from `test`.`People_Reletion_Ship` where up_personid = '%v' and down_personid = '%v';" sqlquery = fmt.Sprintf(sqlquery, ps.Params["up_personid"], ps.Params["down_personid"]) ok, result := Person.QueryPesonByReletionShipWithPerson(sqlquery, nil) if ok == false { if result == 0 { tools.Error("this user have no Following") return false, "update error" } else { return false, "please try again later" } } return ps.GetPersonFollowing() }
func (ps *PersonalService) GetPersonFollowing() (bool, string) { tools.Info("get personal Following") var tr = new([]*Person.Person) sqlquery := "select * from `test`.`person` where personid in (select up_personid from `test`.`person` a INNER JOIN `test`.`People_Reletion_Ship` b on a.personid = b.down_personid WHERE personid = '%v');" sqlquery = fmt.Sprintf(sqlquery, ps.Userid) ok, result := Person.QueryPesonByReletionShipWithPerson(sqlquery, tr) if ok == false { if result == 0 { tools.Error("this user have no Following") return false, "this user have no Following" } else { return false, "please try again later" } } ps.Container["following"] = new(Common.ModelContainerSlice) for _, value := range *tr { ps.Container["following"].(*Common.ModelContainerSlice).ContainerSlice = append(ps.Container["following"].(*Common.ModelContainerSlice).ContainerSlice, value) } return true, "ok" }