Skip to content

Commit

Permalink
optimized code
Browse files Browse the repository at this point in the history
  • Loading branch information
junping.zhao committed May 8, 2020
1 parent 65e5db2 commit 59d226d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
6 changes: 1 addition & 5 deletions adapters/yeahmobi/yeahmobi.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package yeahmobi

import (
"encoding/json"
"errors"
"fmt"
"github.com/golang/glog"
"github.com/mxmCherry/openrtb"
Expand Down Expand Up @@ -107,17 +106,14 @@ func getYeahmobiExt(request *openrtb.BidRequest) (*openrtb_ext.ExtImpYeahmobi, [
errs = append(errs, err)
continue
}

break
}

return &extImpYeahmobi, errs

}

func (adapter *YeahmobiAdapter) getEndpoint(ext *openrtb_ext.ExtImpYeahmobi) (string, error) {
if ext.ZoneId == "" {
return "", errors.New("param of zoneId not config")
}
return macros.ResolveMacros(adapter.EndpointTemplate, macros.EndpointTemplateParams{Host: "gw-" + url.QueryEscape(ext.ZoneId) + "-bid.yeahtargeter.com"})
}

Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -744,10 +744,10 @@ func SetupViper(v *viper.Viper, filename string) {
v.SetDefault("adapters.verizonmedia.disabled", true)
v.SetDefault("adapters.visx.endpoint", "https://t.visx.net/s2s_bid?wrapperType=s2s_prebid_standard")
v.SetDefault("adapters.vrtcal.endpoint", "http://rtb.vrtcal.com/bidder_prebid.vap?ssp=1804")
v.SetDefault("adapters.yeahmobi.endpoint", "https://{{.Host}}/prebid/bid")
v.SetDefault("adapters.yieldmo.endpoint", "https://ads.yieldmo.com/exchange/prebid-server")
v.SetDefault("adapters.yieldone.endpoint", "https://y.one.impact-ad.jp/hbs_imp")
v.SetDefault("adapters.zeroclickfraud.endpoint", "http://{{.Host}}/openrtb2?sid={{.SourceId}}")
v.SetDefault("adapters.yeahmobi.endpoint", "https://{{.Host}}/prebid/bid")

v.SetDefault("max_request_size", 1024*256)
v.SetDefault("analytics.file.filename", "")
Expand Down
4 changes: 2 additions & 2 deletions exchange/adapter_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package exchange

import (
"fmt"
"github.com/prebid/prebid-server/adapters/yeahmobi"
"net/http"
"strings"

Expand Down Expand Up @@ -65,6 +64,7 @@ import (
"github.com/prebid/prebid-server/adapters/verizonmedia"
"github.com/prebid/prebid-server/adapters/visx"
"github.com/prebid/prebid-server/adapters/vrtcal"
"github.com/prebid/prebid-server/adapters/yeahmobi"
"github.com/prebid/prebid-server/adapters/yieldmo"
"github.com/prebid/prebid-server/adapters/yieldone"
"github.com/prebid/prebid-server/adapters/zeroclickfraud"
Expand Down Expand Up @@ -140,10 +140,10 @@ func newAdapterMap(client *http.Client, cfg *config.Configuration, infos adapter
openrtb_ext.BidderVerizonMedia: verizonmedia.NewVerizonMediaBidder(client, cfg.Adapters[string(openrtb_ext.BidderVerizonMedia)].Endpoint),
openrtb_ext.BidderVisx: visx.NewVisxBidder(cfg.Adapters[string(openrtb_ext.BidderVisx)].Endpoint),
openrtb_ext.BidderVrtcal: vrtcal.NewVrtcalBidder(cfg.Adapters[string(openrtb_ext.BidderVrtcal)].Endpoint),
openrtb_ext.BidderYeahmobi: yeahmobi.NewYeahmobiBidder(cfg.Adapters[string(openrtb_ext.BidderYeahmobi)].Endpoint),
openrtb_ext.BidderYieldmo: yieldmo.NewYieldmoBidder(cfg.Adapters[string(openrtb_ext.BidderYieldmo)].Endpoint),
openrtb_ext.BidderYieldone: yieldone.NewYieldoneBidder(cfg.Adapters[string(openrtb_ext.BidderYieldone)].Endpoint),
openrtb_ext.BidderZeroClickFraud: zeroclickfraud.NewZeroClickFraudBidder(cfg.Adapters[string(openrtb_ext.BidderZeroClickFraud)].Endpoint),
openrtb_ext.BidderYeahmobi: yeahmobi.NewYeahmobiBidder(cfg.Adapters[string(openrtb_ext.BidderYeahmobi)].Endpoint),
}

legacyBidders := map[openrtb_ext.BidderName]adapters.Adapter{
Expand Down
4 changes: 2 additions & 2 deletions openrtb_ext/bidders.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ const (
BidderVerizonMedia BidderName = "verizonmedia"
BidderVisx BidderName = "visx"
BidderVrtcal BidderName = "vrtcal"
BidderYeahmobi BidderName = "yeahmobi"
BidderYieldmo BidderName = "yieldmo"
BidderYieldone BidderName = "yieldone"
BidderZeroClickFraud BidderName = "zeroclickfraud"
BidderYeahmobi BidderName = "yeahmobi"
)

// BidderMap stores all the valid OpenRTB 2.x Bidders in the project. This map *must not* be mutated.
Expand Down Expand Up @@ -149,10 +149,10 @@ var BidderMap = map[string]BidderName{
"verizonmedia": BidderVerizonMedia,
"visx": BidderVisx,
"vrtcal": BidderVrtcal,
"yeahmobi": BidderYeahmobi,
"yieldmo": BidderYieldmo,
"yieldone": BidderYieldone,
"zeroclickfraud": BidderZeroClickFraud,
"yeahmobi": BidderYeahmobi,
}

// BidderList returns the values of the BidderMap
Expand Down

0 comments on commit 59d226d

Please sign in to comment.