|
@@ -436,3 +436,35 @@ func handleBroadcastItem(userId int, item *voice_broadcast.VoiceBroadcast, imgs
|
|
|
resp.Imgs = imgArr
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+func GetMyVoiceBroadcastListCount(authorId, sectionId int) (resp response.BroadcastListStatusCount, err error) {
|
|
|
+ condition := ` 1=1 `
|
|
|
+ var pars []interface{}
|
|
|
+
|
|
|
+ if authorId > 0 {
|
|
|
+ condition += ` AND author_id = ?`
|
|
|
+ pars = append(pars, authorId)
|
|
|
+ }
|
|
|
+
|
|
|
+ if sectionId > 0 {
|
|
|
+ condition += ` AND section_id = ?`
|
|
|
+ pars = append(pars, sectionId)
|
|
|
+ }
|
|
|
+ counts, e := voice_broadcast.GetVoiceBroadcastListStatusCount(condition, pars)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("获取语音播报列表计数失败, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range counts {
|
|
|
+ if v.State == 0 {
|
|
|
+ resp.Unpublished = v.Num
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if v.State == 1 {
|
|
|
+ resp.Published = v.Num
|
|
|
+ }
|
|
|
+ }
|
|
|
+ resp.All = resp.Unpublished + resp.Published
|
|
|
+ return
|
|
|
+}
|