Exemplo n.º 1
0
func (this *ReqJesgooModule) convert_resp_ad(inad *context.AdInfo, bsad *ui2bs.Ad, adtype AdType) {
	inad.AdSrc = context.AdSrc_JESGOO
	switch bsad.Adtype {
	case ui2bs.AdType_TEXT:
		inad.AdType = context.TEXT
	case ui2bs.AdType_IMAGE:
		inad.AdType = context.IMAGE
	case ui2bs.AdType_HTML:
		inad.AdType = context.HTML
	case ui2bs.AdType_VIDEO:
		inad.AdType = context.VIDEO
	case ui2bs.AdType_TEXT_ICON:
		inad.AdType = context.TEXT_ICON
	}
	switch bsad.InteractionType {
	case ui2bs.Interaction_SURFING:
		inad.InteractionType = context.SURFING
	case ui2bs.Interaction_DOWNLOAD:
		inad.InteractionType = context.DOWNLOAD
	case ui2bs.Interaction_DIALING:
		inad.InteractionType = context.DIALING
	case ui2bs.Interaction_MESSAGE:
		inad.InteractionType = context.MESSAGE
	case ui2bs.Interaction_MAIL:
		inad.InteractionType = context.MAIL
	}

	switch adtype {
	case Banner:
		inad.AdSlotType = context.AdSlotType_BANNER
	case Initlization:
		inad.AdSlotType = context.AdSlotType_INITIALIZATION
	case Insert:
		inad.AdSlotType = context.AdSlotType_INSERT
	case OfferWall:
		inad.AdSlotType = context.AdSlotType_OFFERWALL
	case Recommed:
		inad.AdSlotType = context.AdSlotType_RECOMMEND
	default:
		inad.AdSlotType = context.AdSlotType_BANNER
	}

	inad.Adid = bsad.Adid
	inad.Groupid = bsad.Groupid
	inad.Planid = bsad.Planid
	inad.Userid = bsad.Userid
	inad.Bid = bsad.Bid
	inad.Price = 0
	inad.Ctr = 0
	inad.Cpm = 0

}
Exemplo n.º 2
0
func (this *ReqQiushiModule) convert_ad(inad *context.AdInfo, adtype AdType, bsad *mobads_api.Ad, bd_appsid string) (err error) {
	if bsad.AdId != nil {
		inad.Adid = int64(*bsad.AdId)
	}
	//	inad.Groupid = bsad.Groupid
	//	inad.Planid = bsad.Groupid
	//	inad.Userid = bsad.Userid
	admeta := bsad.MaterialMeta
	if admeta != nil {

		inad.AdSrc = context.AdSrc_BAIDU

		if admeta.CreativeType != nil {
			switch *admeta.CreativeType {
			case mobads_api.CreativeType_TEXT:
				inad.AdType = context.TEXT
			case mobads_api.CreativeType_IMAGE:
				inad.AdType = context.IMAGE
			case mobads_api.CreativeType_HTML:
				inad.AdType = context.HTML
			case mobads_api.CreativeType_VIDEO:
				inad.AdType = context.VIDEO
			case mobads_api.CreativeType_TEXT_ICON:
				inad.AdType = context.TEXT_ICON
			}
		}
		if admeta.InteractionType != nil {
			switch *admeta.InteractionType {
			case mobads_api.InteractionType_SURFING:
				inad.InteractionType = context.SURFING
			case mobads_api.InteractionType_DOWNLOAD:
				inad.InteractionType = context.DOWNLOAD
			case mobads_api.InteractionType_DIALING:
				inad.InteractionType = context.DIALING
			case mobads_api.InteractionType_MESSAGE:
				inad.InteractionType = context.MESSAGE
			case mobads_api.InteractionType_MAIL:
				inad.InteractionType = context.MAIL
			default:
				inad.InteractionType = context.NO_INTERACT

			}
		}

		switch adtype {
		case Banner:
			inad.AdSlotType = context.AdSlotType_BANNER
		case Insert:
			inad.AdSlotType = context.AdSlotType_INSERT
		case Initlization:
			inad.AdSlotType = context.AdSlotType_INITIALIZATION
		default:
			inad.AdSlotType = context.AdSlotType_BANNER
		}

		if admeta.Title != nil {
			inad.Title = *admeta.Title
		}
		if admeta.Description1 != nil {
			inad.Description1 = *admeta.Description1
		}
		if admeta.Description2 != nil {
			inad.Description2 = *admeta.Description2
		}
		if admeta.MediaUrl != nil {
			switch inad.AdType {
			case context.TEXT_ICON:
				inad.LogoUrl = *admeta.MediaUrl
			case context.IMAGE:
				inad.ImageUrl = *admeta.MediaUrl
			default:
				inad.ImageUrl = *admeta.MediaUrl
			}
		}
		for i := 0; i < len(admeta.WinNoticeUrl); i++ {
			inad.ImpressionUrl = append(inad.ImpressionUrl, admeta.WinNoticeUrl[i])
		}
		if admeta.ClickUrl != nil {
			inad.ClickUrl = *admeta.ClickUrl
		}
	}
	inad.DspMediaid = bd_appsid
	inad.DspChannelid = ""
	inad.Bid = 0
	inad.Price = 0
	inad.Ctr = 0
	inad.Cpm = 0
	//	inad.Wuliao_type = bsad.WuliaoType
	//	inad.LogoUrl = bsad.AppLogo
	return
}