Skip to content

Commit

Permalink
update http args parser
Browse files Browse the repository at this point in the history
  • Loading branch information
wenweihu86 committed Oct 28, 2017
1 parent 2dff0d8 commit f7888d9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions adhandler/click_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (

func ClickHandler(ctx *fasthttp.RequestCtx) {
args := ctx.QueryArgs()
if len(args.Peek("i")) == 0 {
if !args.Has("i") {
ctx.SetBody([]byte("{\"status\": 1}"))
return
}
}
argsVlueBytes := args.Peek("i")
queryStringBytes, err := base64.StdEncoding.DecodeString(string(argsVlueBytes))
paramMap, err := url.ParseQuery(string(queryStringBytes))
Expand Down
4 changes: 2 additions & 2 deletions adhandler/conversion_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (
// 转化监控handler
func ConversionHandler(ctx *fasthttp.RequestCtx) {
args := ctx.QueryArgs()
if len(args.Peek("i")) == 0 {
if !args.Has("i") {
ctx.SetBody([]byte("{\"status\": 1}"))
return
}
}
argsValueBytes := args.Peek("i")
queryStringBytes, err := base64.StdEncoding.DecodeString(string(argsValueBytes))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion adhandler/impression_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
// 展现监控handler
func ImpressionHandler(ctx *fasthttp.RequestCtx) {
args := ctx.QueryArgs()
if len(args.Peek("i")) == 0 {
if !args.Has("i") {
ctx.SetBody([]byte("{\"status\": 1}"))
return
}
Expand Down
4 changes: 0 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#!/bin/bash

# 下面这2行是为了下载编译依赖,只有首次编译或者依赖更新时才需要执行。
# cp -f mirrors.yaml ~/.glide/
# glide install

go build -o ad_server main/main.go

0 comments on commit f7888d9

Please sign in to comment.