互动
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
773 B

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. package bahe_service
  2. import (
  3. "hudongzhuanjia/models"
  4. "github.com/ouxuanserver/osmanthuswine/src/core"
  5. )
  6. func GetScoreByTeamId(tid, rid int) (int64, error) {
  7. return core.GetXormAuto().Where("team_id=? and rehearsal_id=?", tid, rid).
  8. SumInt(&models.BaheTeamMember{}, "score")
  9. }
  10. func GetUsersByBaheActivityId(id int) []*models.BaheTeamMember {
  11. teams := make([]*models.BaheTeam, 0)
  12. err := core.GetXormAuto().Where("bahe_activity_id=? and is_delete=?", id, false).Find(&teams)
  13. if err != nil {
  14. return nil
  15. }
  16. teamIds := make([]int, 0)
  17. for i := range teams {
  18. teamIds = append(teamIds, teams[i].Id)
  19. }
  20. members := make([]*models.BaheTeamMember, 0)
  21. err = core.GetXormAuto().In("team_id", teamIds).Find(&members)
  22. if err != nil {
  23. return nil
  24. }
  25. return members
  26. }