|
@@ -36,18 +36,18 @@ func (self *FreqControlConf) GetControlTime(hour int) (int, bool) {
|
36
|
36
|
}
|
37
|
37
|
|
38
|
38
|
// 获取渠道的标记
|
39
|
|
-func GetChannelFlag(reqSource string, business string) (*ChannelFlag, error) {
|
|
39
|
+func GetChannelFlag(reqSource string, business string) (ChannelFlag, error) {
|
40
|
40
|
conn := ads_redis.RedisConn.Get()
|
41
|
41
|
defer conn.Close()
|
42
|
42
|
|
43
|
43
|
redisKey := fmt.Sprintf("acfv2_%s_%s", reqSource, business)
|
44
|
44
|
rsp, err := conn.Do("GET", redisKey)
|
45
|
45
|
if err != nil {
|
46
|
|
- return nil, err
|
|
46
|
+ return ChannelFlag{}, err
|
47
|
47
|
}
|
48
|
48
|
|
49
|
49
|
if rsp == nil {
|
50
|
|
- return nil, nil
|
|
50
|
+ return ChannelFlag{}, nil
|
51
|
51
|
}
|
52
|
52
|
|
53
|
53
|
rspBytes, _ := redis.Bytes(rsp, err)
|
|
@@ -55,14 +55,14 @@ func GetChannelFlag(reqSource string, business string) (*ChannelFlag, error) {
|
55
|
55
|
channelFlag := ChannelFlag{}
|
56
|
56
|
err = json.Unmarshal(rspBytes, &channelFlag)
|
57
|
57
|
if err != nil {
|
58
|
|
- return nil, err
|
|
58
|
+ return ChannelFlag{}, err
|
59
|
59
|
}
|
60
|
60
|
|
61
|
|
- return &channelFlag, nil
|
|
61
|
+ return channelFlag, nil
|
62
|
62
|
}
|
63
|
63
|
|
64
|
64
|
// 获取渠道频率信息
|
65
|
|
-func GetFreqCrontolConf(reqSource string) (*FreqControlConf, error) {
|
|
65
|
+func GetFreqControlConf(reqSource string) (FreqControlConf, error) {
|
66
|
66
|
conn := ads_redis.RedisConn.Get()
|
67
|
67
|
defer conn.Close()
|
68
|
68
|
|
|
@@ -70,11 +70,11 @@ func GetFreqCrontolConf(reqSource string) (*FreqControlConf, error) {
|
70
|
70
|
|
71
|
71
|
rsp, err := conn.Do("GET", redisKey)
|
72
|
72
|
if err != nil {
|
73
|
|
- return nil, err
|
|
73
|
+ return FreqControlConf{}, err
|
74
|
74
|
}
|
75
|
75
|
|
76
|
76
|
if rsp == nil {
|
77
|
|
- return nil, nil
|
|
77
|
+ return FreqControlConf{}, nil
|
78
|
78
|
}
|
79
|
79
|
|
80
|
80
|
rspBytes, _ := redis.Bytes(rsp, err)
|
|
@@ -82,10 +82,10 @@ func GetFreqCrontolConf(reqSource string) (*FreqControlConf, error) {
|
82
|
82
|
f := FreqControlConf{}
|
83
|
83
|
err = json.Unmarshal(rspBytes, &f.confs)
|
84
|
84
|
if err != nil {
|
85
|
|
- return nil, err
|
|
85
|
+ return FreqControlConf{}, err
|
86
|
86
|
}
|
87
|
87
|
|
88
|
|
- return &f, nil
|
|
88
|
+ return f, nil
|
89
|
89
|
}
|
90
|
90
|
|
91
|
91
|
// 获取该广告的总请求次数
|