Browse Source

wip:调整

fuwencai 1 năm trước cách đây
mục cha
commit
e03afe74c0
1 tập tin đã thay đổi với 11 bổ sung3 xóa
  1. 11 3
      jyBXCore/rpc/service/participateStatistics.go

+ 11 - 3
jyBXCore/rpc/service/participateStatistics.go

@@ -72,7 +72,7 @@ var (
 // GetSourceItem 获取标讯项目来源筛选项
 func (in *ParticipateStatistics) GetSourceItem(entId, positionId int) (result []*bxcore.SourceItem) {
 	redisKey := "sourceItem%s_%d"
-	query := "select distinct substring_index(source,',',-1)  as `source` from participate_push_statistics where "
+	query := "select group_concat(distinct(source))  as `source` from participate_push_statistics where  "
 	// 个人用户
 	if entId == 0 {
 		// 查职位id
@@ -96,11 +96,19 @@ func (in *ParticipateStatistics) GetSourceItem(entId, positionId int) (result []
 		//emtpy := make([]*bxcore.SourceItem, 0)
 		return
 	}
-	for i := 0; i < len(*rs); i++ {
-		value := common.ObjToString((*rs)[i]["source"])
+	existMap := map[string]struct{}{}
+	source_ := common.InterfaceToStr((*rs)[0]["source"])
+	splitSource := strings.Split(source_, ",")
+	for i := 0; i < len(splitSource); i++ {
+		value := splitSource[i]
 		if value == "" {
 			continue
 		}
+		if _, ok := existMap[value]; ok {
+			continue
+		} else {
+			existMap[value] = struct{}{}
+		}
 		if name, ok := SourceMap[value]; ok {
 			value_, err := strconv.Atoi(value)
 			if err == nil {