互动
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
779 B

package bahe_service
import (
"hudongzhuanjia/models"
"github.com/ouxuanserver/osmanthuswine/src/core"
)
func GetScoreByTeamId(tid, rid int64) (int64, error) {
return core.GetXormAuto().Where("team_id=? and rehearsal_id=?", tid, rid).
SumInt(&models.BaheTeamMember{}, "score")
}
func GetUsersByBaheActivityId(id int64) []*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([]int64, 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
}