diff --git a/consume/ad_original_data_application.go b/consume/ad_original_data_application.go index 33ccc17..df80ed2 100644 --- a/consume/ad_original_data_application.go +++ b/consume/ad_original_data_application.go @@ -12,6 +12,7 @@ import ( "code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule/one_circles" db "code.fnuoos.com/zhimeng/model.git/src" + implement2 "code.fnuoos.com/zhimeng/model.git/src/implement" "code.fnuoos.com/zhimeng/model.git/src/super/implement" "code.fnuoos.com/zhimeng/model.git/src/super/model" "encoding/json" @@ -75,6 +76,7 @@ func handleAdOriginalDataApplication(msgData []byte) error { if db.DBs[msg.Mid] == nil { return nil } + eg := db.DBs[msg.Mid] wxApiService, err := wechat.NewWxApiService(msg.Mid, msg.ComponentAppid, msg.ComponentAppsecret) if err != nil { return err @@ -91,14 +93,20 @@ func handleAdOriginalDataApplication(msgData []byte) error { if err != nil { return err } + NewAppletApplicationAdSpaceListDb := implement2.NewAppletApplicationAdSpaceListDb(eg) + for _, v := range args.List { count, _ := db.Db.Where("uuid=? and date=? and app_id=? and slot_id=?", msg.Mid, msg.Date, v.AppId, v.AdUnitId).Count(&model.OriginalWxAdData{}) if count > 0 { continue } + adData, _ := NewAppletApplicationAdSpaceListDb.GetAppletApplicationAdSpaceListByAdId(v.AdUnitId) + if adData == nil { + continue + } tmp := model.OriginalWxAdData{ Uuid: utils.StrToInt(msg.Mid), - MediumId: 0, + MediumId: adData.MediumId, AppId: v.AppId, SlotId: v.AdUnitId, AdSlot: v.StatItem.AdSlot,