package bahe_service import ( "hudongzhuanjia/models" "github.com/ouxuanserver/osmanthuswine/src/core" ) func GetScoreByTeamId(tid, rid int) (int64, error) { return core.GetXormAuto().Where("team_id=? and rehearsal_id=?", tid, rid). SumInt(&models.BaheTeamMember{}, "score") } func GetUsersByBaheActivityId(id int) []*models.BaheTeamMember { teams := make([]*models.BaheTeam, 0) err := core.GetXormAuto().Where("bahe_activity_id=? and is_delete=?", id, false).Find(&teams) if err != nil { return nil } teamIds := make([]int, 0) for i := range teams { teamIds = append(teamIds, teams[i].Id) } members := make([]*models.BaheTeamMember, 0) err = core.GetXormAuto().In("team_id", teamIds).Find(&members) if err != nil { return nil } return members }