func YeskyBidHandler(w http.ResponseWriter, r *http.Request) { var commonRequest *common.BidRequest var commonResponse *common.BidResponse var isBid bool var thinkTime time.Duration //fmt.Println(t, "yesky request: ", *r) t := time.Now() bidResponse := new(MgxBidResponse) m := make(map[string]interface{}) bidRequest := NewBidRequest(r) if bidRequest == nil { goto giveup } //fmt.Printf("\nyesky bidrequest: %#v\n", *bidRequest) commonRequest = bidRequest.ParseToCommon() //fmt.Printf("\ncommon bidrequest: %#v\n", *commonRequest) commonResponse, isBid = bid.Bid(commonRequest) //fmt.Printf("\ncommon response: %#v\n", *commonResponse) if !isBid || len(commonResponse.Ads) == 0 { goto giveup } bidResponse.ParseFromCommon(commonResponse) bidResponse.Response(w) thinkTime = time.Since(t) //fmt.Println("thinking time: ", thinkTime) m["v"] = 1 m["time_stamp"] = logger.CurrentTimeString() m["exchange_user_id"] = strconv.Itoa(int(common.MEGAMEDIA)) m["think_time"] = strconv.Itoa(int(thinkTime) / 1000000) /* ms */ //bidlog: m["log_type"] = "30" m["uuid"] = logger.UUID() m["bid_id"] = commonResponse.BidId m["ad_id"] = commonResponse.Ads[0].AdId m["order_id"] = commonResponse.Ads[0].OrderId m["creative_price"] = commonResponse.Ads[0].Price logger.BidLog.JsonLog(logger.INFO, m) return giveup: m["log_type"] = "31" m["uuid"] = "" logger.GiveupLog.JsonLog(logger.INFO, m) }
func MangoBidHandler(w http.ResponseWriter, r *http.Request) { fmt.Println("\nbidrequest: \n", *r) bidRequest := NewBidRequest(r) if bidRequest == nil { return } fmt.Printf("\nmango bidrequest: %#v\n", *bidRequest) //fmt.Println("mango bid request:") //fmt.Printf("%+v\n", *bidRequest) //fmt.Println() //fmt.Printf("%#v\n", *bidRequest) commonRequest := bidRequest.ParseToCommon() fmt.Printf("\ncommon bidrequest: %#v\n", *commonRequest) commonResponse, _ := bid.Bid(commonRequest) fmt.Printf("\ncommon response: %#v\n", *commonResponse) bidResponse := new(BidResponse) bidResponse.ParseFromCommon(commonResponse) bidResponse.Response(w) }