activity_video.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package services
  2. import (
  3. "errors"
  4. "hongze/hongze_clpt/models"
  5. "hongze/hongze_clpt/utils"
  6. )
  7. // GetActivityPlayBackActivityIds 获取带有回放的所有的活动ID
  8. func GetActivityPlayBackActivityIds() (activityIds string, err error) {
  9. defer func() {
  10. if err != nil {
  11. go utils.SendAlarmMsg("GetActivityPlayBackActivityIds,获取带有回放的所有的活动ID失败"+err.Error(), 2)
  12. }
  13. }()
  14. //获取所有活动视频ID
  15. vidoeActivityIds, e := models.GetActivityVideoActivityIds()
  16. if e != nil {
  17. err = errors.New("GetActivityVideoActivityIds, Err: " + e.Error())
  18. return
  19. }
  20. //如果没有就赋值为0,避免空查询报错
  21. if vidoeActivityIds == "" {
  22. vidoeActivityIds = "0"
  23. }
  24. //获取所有活动视频ID
  25. voiceActivityIds, e := models.GetActivityVoiceActivityIds()
  26. if e != nil {
  27. err = errors.New("GetActivityVoiceActivityIds, Err: " + e.Error())
  28. return
  29. }
  30. if voiceActivityIds == "" {
  31. voiceActivityIds = "0"
  32. }
  33. activityIds = vidoeActivityIds + "," + voiceActivityIds
  34. return
  35. }
  36. // GetActivityVideoOrVoiceActivityIds 获取音频或者视频的活动ID
  37. func GetActivityVideoOrVoiceActivityIds(filter int) (activityIds string, err error) {
  38. defer func() {
  39. if err != nil {
  40. go utils.SendAlarmMsg("GetActivityPlayBackActivityIds,获取带有回放的所有的活动ID失败"+err.Error(), 2)
  41. }
  42. }()
  43. if filter == 1 {
  44. //获取所有活动视频ID
  45. vidoeActivityIds, e := models.GetActivityVideoActivityIds()
  46. if e != nil {
  47. err = errors.New("GetActivityVideoActivityIds, Err: " + e.Error())
  48. return
  49. }
  50. //如果没有就赋值为0,避免空查询报错
  51. if vidoeActivityIds == "" {
  52. vidoeActivityIds = "0"
  53. }
  54. activityIds = vidoeActivityIds
  55. } else {
  56. //获取所有活动视频ID
  57. voiceActivityIds, e := models.GetActivityVoiceActivityIds()
  58. if e != nil {
  59. err = errors.New("GetActivityVoiceActivityIds, Err: " + e.Error())
  60. return
  61. }
  62. if voiceActivityIds == "" {
  63. voiceActivityIds = "0"
  64. }
  65. activityIds = voiceActivityIds
  66. }
  67. return
  68. }