Skip to content

Commit

Permalink
Merge branch 'release/v1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
bububa committed Apr 25, 2024
2 parents fd1db1c + 5113924 commit 002813d
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions api/ocpc/clickmonitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,32 @@ var defaultFields = map[string]string{
"bd_vid": "__BD_VID__",
}

func ClickMonitorUrl(baseUrl string, fields []string, version int) {
func ClickMonitorUrl(baseUrl string, fields []string, version int) string {
values := util.GetUrlValues()
defer util.PutUrlValues(values)
for _, f := range fields {
if version == 2 && f == "callback_ur" {
var mp map[string]struct{}
if l := len(fields); l > 0 {
mp = make(map[string]struct{}, l)
for _, f := range fields {
mp[f] = struct{}{}
}
}
for f, v := range defaultFields {
if version == 2 && f == "callback_url" {
continue
}
if v, ok := defaultFields[f]; ok {
values.Set(f, v)
if mp != nil {
if _, ok := mp[f]; !ok {
continue
}
}
values.Set(f, v)
}
if version == 2 {
values.Set("callType", "v2")
} else {
values.Set("callType", "v1")
}
values.Set("sign", "__SIGN__")
return util.StringsJoin(baseUrl, "?", values.Encode())
}

0 comments on commit 002813d

Please sign in to comment.