Browse Source

fix:Bug

token_replace
黄梓健 5 years ago
parent
commit
3a776e0063
  1. 2
      controllers/client/tug_war.go
  2. 16
      services/bahe/tug_war.go

2
controllers/client/tug_war.go

@ -138,7 +138,7 @@ func (t *TugOfWarCtl) JoinTeam() {
var team *bahe_service.JoinTeamResult
if teamId == 0 {
team, exist, err = bahe_service.GetJoinTeamByBaheId(bahe.Id, activity.RehearsalId)
team, exist, err = bahe_service.GetJoinTeamByBaheId(bahe.Id, activity.RehearsalId, activity.ArchId)
} else {
team, exist, err = bahe_service.GetJoinTeamByTeamId(teamId, activity.RehearsalId)
}

16
services/bahe/tug_war.go

@ -76,23 +76,23 @@ type JoinTeamResult struct {
TeamName string
}
func GetJoinTeamByTeamId(teamId, rehearsalId interface{}) (*JoinTeamResult, bool, error) {
func GetJoinTeamByTeamId(teamId, rehearsalId, archId interface{}) (*JoinTeamResult, bool, error) {
result := new(JoinTeamResult)
exist, err := core.GetXormAuto().Table(new(models.BaheTeam)).Alias("t").
Select("t.id as team_id, t.bahe_team_name as team_name, count(m.id) as number").
Join("LEFT", new(models.BaheTeamMember).Alias("m"),
"m.team_id=t.id and m.is_delete=0 and m.rehearsal_id=?", rehearsalId).
Where("t.is_delete=0 and t.id=?", teamId).GroupBy("t.id").Get(result)
Join("LEFT", new(models.BaheTeamMember).Alias("m"), "m.team_id=t.id").
Where("t.is_delete=0 and t.id=? and m.rehearsal_id=? and m.arch_id=?", teamId, archId).
GroupBy("t.id").Get(result)
return result, exist, err
}
func GetJoinTeamByBaheId(baheId, rehearsalId interface{}) (*JoinTeamResult, bool, error) {
func GetJoinTeamByBaheId(baheId, rehearsalId, archId interface{}) (*JoinTeamResult, bool, error) {
result := new(JoinTeamResult)
exist, err := core.GetXormAuto().Table(new(models.BaheTeam)).Alias("t").
Select("t.id as team_id, t.bahe_team_name as team_name, count(m.id) as number").
Join("LEFT", new(models.BaheTeamMember).Alias("m"),
"m.team_id=t.id and m.is_delete=0 and m.rehearsal_id=?", rehearsalId).
Where("t.is_delete=0 and t.bahe_activity_id=? ", baheId).
Join("LEFT", new(models.BaheTeamMember).Alias("m"), "m.team_id=t.id").
Where("t.is_delete=0 and t.bahe_activity_id=? and m.rehearsal_id=? and m.arch_id=? ",
baheId, rehearsalId, archId).
GroupBy("t.id").Asc("number").Get(result)
return result, exist, err
}

Loading…
Cancel
Save