|
@@ -30,7 +30,7 @@ type ChannelCategory struct {
|
|
|
}
|
|
|
|
|
|
// 渠道归因处理
|
|
|
-func GetChannel(assessment ResourceAssessment) ChannelCategory {
|
|
|
+func getChannel(assessment ResourceAssessment) ChannelCategory {
|
|
|
var channel int
|
|
|
var category int
|
|
|
|
|
@@ -62,7 +62,10 @@ func GetChannel(assessment ResourceAssessment) ChannelCategory {
|
|
|
end := assessment.CreatedAt.Format(layout)
|
|
|
sql := "select $url from events where distinct_id = '" + assessment.GrUserId + "'and event = '$pageview' and time between '" + start + "' and '" + end + "' order by time limit 1"
|
|
|
url := getSensorsData(sql)
|
|
|
- if url == "https://www.jjl.cn/" || url == "https://m.jjl.cn/" {
|
|
|
+ if strings.Contains(url, "utm") && strings.Contains(url, "link") {
|
|
|
+ channel, _ = strconv.Atoi(strings.Split(strings.Split(strings.Split(url, "link")[1], "form")[0], "_")[1])
|
|
|
+ category, _ = strconv.Atoi(strings.Split(strings.Split(strings.Split(url, "link")[1], "form")[0], "_")[2])
|
|
|
+ } else if url == "https://www.jjl.cn/" || url == "https://m.jjl.cn/" {
|
|
|
channel = 7
|
|
|
category = 126
|
|
|
} else {
|
|
@@ -105,7 +108,7 @@ func GetChannel(assessment ResourceAssessment) ChannelCategory {
|
|
|
channel = 5
|
|
|
}
|
|
|
if category == 0 {
|
|
|
- channel = 11
|
|
|
+ category = 11
|
|
|
}
|
|
|
var channelCategory ChannelCategory
|
|
|
channelCategory.Channel = channel
|