package services import ( "errors" "hongze/hongze_mfyx/models" "hongze/hongze_mfyx/utils" ) // GetActivityPlayBackActivityIds 获取带有回放的所有的活动ID func GetActivityPlayBackActivityIds() (activityIds string, err error) { defer func() { if err != nil { go utils.SendAlarmMsg("GetActivityPlayBackActivityIds,获取带有回放的所有的活动ID失败"+err.Error(), 2) } }() //获取所有活动视频ID vidoeActivityIds, e := models.GetActivityVideoActivityIds() if e != nil { err = errors.New("GetActivityVideoActivityIds, Err: " + e.Error()) return } //如果没有就赋值为0,避免空查询报错 if vidoeActivityIds == "" { vidoeActivityIds = "0" } //获取所有活动视频ID voiceActivityIds, e := models.GetActivityVoiceActivityIds() if e != nil { err = errors.New("GetActivityVoiceActivityIds, Err: " + e.Error()) return } if voiceActivityIds == "" { voiceActivityIds = "0" } activityIds = vidoeActivityIds + "," + voiceActivityIds return } // GetActivityVideoOrVoiceActivityIds 获取音频或者视频的活动ID func GetActivityVideoOrVoiceActivityIds(filter int) (activityIds string, err error) { defer func() { if err != nil { go utils.SendAlarmMsg("GetActivityPlayBackActivityIds,获取带有回放的所有的活动ID失败"+err.Error(), 2) } }() if filter == 1 { //获取所有活动视频ID vidoeActivityIds, e := models.GetActivityVideoActivityIds() if e != nil { err = errors.New("GetActivityVideoActivityIds, Err: " + e.Error()) return } //如果没有就赋值为0,避免空查询报错 if vidoeActivityIds == "" { vidoeActivityIds = "0" } activityIds = vidoeActivityIds } else { //获取所有活动视频ID voiceActivityIds, e := models.GetActivityVoiceActivityIds() if e != nil { err = errors.New("GetActivityVoiceActivityIds, Err: " + e.Error()) return } if voiceActivityIds == "" { voiceActivityIds = "0" } activityIds = voiceActivityIds } return }