|
@@ -4,7 +4,6 @@ import (
|
|
|
"eta/eta_mini_crm_ht/models"
|
|
|
"eta/eta_mini_crm_ht/utils"
|
|
|
"strings"
|
|
|
- "sync"
|
|
|
)
|
|
|
|
|
|
func GetUserSourceClickFlowListCountByUserId(userId int, condition string, pars []interface{}, permissionIds []int, product models.SourceType) (total int, conditionNew string, parsNew []interface{}, err error) {
|
|
@@ -84,23 +83,17 @@ func GetUserSourceClickFlowListByUserId(userId int, condition string, pars []int
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
- var wg sync.WaitGroup
|
|
|
- wg.Add(len(list))
|
|
|
for _, item := range list {
|
|
|
- go func(item *models.UserSourceClickFlow) {
|
|
|
- defer wg.Done()
|
|
|
- viewItem := item.ToView()
|
|
|
- switch item.SourceType {
|
|
|
- case models.ReportSourceType:
|
|
|
- viewItem.PermissionNames = getReportPermissionNames(item.SourceId)
|
|
|
- case models.AudioSourceType, models.VideoSourceType:
|
|
|
- mediaType := transMediaType(item.SourceType)
|
|
|
- viewItem.PermissionNames = getMediaPermissionNames(item.SourceId, mediaType)
|
|
|
- }
|
|
|
- items = append(items, viewItem)
|
|
|
- }(item)
|
|
|
+ viewItem := item.ToView()
|
|
|
+ switch item.SourceType {
|
|
|
+ case models.ReportSourceType:
|
|
|
+ viewItem.PermissionNames = getReportPermissionNames(item.SourceId)
|
|
|
+ case models.AudioSourceType, models.VideoSourceType:
|
|
|
+ mediaType := transMediaType(item.SourceType)
|
|
|
+ viewItem.PermissionNames = getMediaPermissionNames(item.SourceId, mediaType)
|
|
|
+ }
|
|
|
+ items = append(items, viewItem)
|
|
|
}
|
|
|
- wg.Wait()
|
|
|
return
|
|
|
}
|
|
|
func transMediaType(sourceType models.SourceType) models.MediaType {
|