|
|
|
|
@ -118,9 +118,9 @@ func AttributionHugeAmount(ctx context.Context, req *game.ATHAReq) (res *game.AT
|
|
|
|
|
var adData []entity.AdvertisementOceanegine |
|
|
|
|
model := dao.AdvertisementOceanegine.Ctx(ctx).Order("last_touch_time desc") |
|
|
|
|
if req.Platform == "android" { |
|
|
|
|
//if req.AndroidId != "" {
|
|
|
|
|
_ = model.Where("adv_android_id=?", req.AndroidId).Page(1, 1).Scan(&adData) |
|
|
|
|
//}
|
|
|
|
|
if req.AndroidId != "" && req.AndroidId != "00000000-0000-0000-0000-000000000000" { |
|
|
|
|
_ = model.Where("adv_android_id=?", req.AndroidId).Page(1, 1).Scan(&adData) |
|
|
|
|
} |
|
|
|
|
if len(adData) == 0 { |
|
|
|
|
log.Printf("AttributionHugeAmount: adData is nil %s", gjson.MustEncodeString(req)) |
|
|
|
|
err = errors.New("account is nil") |
|
|
|
|
@ -128,9 +128,9 @@ func AttributionHugeAmount(ctx context.Context, req *game.ATHAReq) (res *game.AT
|
|
|
|
|
} |
|
|
|
|
data["android_id"] = req.AndroidId |
|
|
|
|
} else if req.Platform == "ios" { |
|
|
|
|
//if req.Idfa != "" {
|
|
|
|
|
_ = model.Where("idfa=?", req.Idfa).Page(1, 1).Scan(&adData) |
|
|
|
|
//}
|
|
|
|
|
if req.Idfa != "" && req.Idfa != "00000000-0000-0000-0000-000000000000" { |
|
|
|
|
_ = model.Where("idfa=?", req.Idfa).Page(1, 1).Scan(&adData) |
|
|
|
|
} |
|
|
|
|
if len(adData) == 0 { |
|
|
|
|
if req.Caid != "" { |
|
|
|
|
var list []map[string]string |
|
|
|
|
@ -229,9 +229,9 @@ func ConversionHugeAmount(ctx context.Context, req *game.CSHAReq) (res *game.CSH
|
|
|
|
|
} |
|
|
|
|
model := dao.AdvertisementOceanegine.Ctx(ctx).Order("last_touch_time desc") |
|
|
|
|
if req.Platform == "android" { |
|
|
|
|
//if req.Id != "" && req.Id != "00000000-0000-0000-0000-000000000000" {
|
|
|
|
|
_ = model.Where("adv_android_id=?", req.Id).Page(1, 1).Scan(&adData) |
|
|
|
|
//}
|
|
|
|
|
if req.Id != "" && req.Id != "00000000-0000-0000-0000-000000000000" { |
|
|
|
|
_ = model.Where("adv_android_id=?", req.Id).Page(1, 1).Scan(&adData) |
|
|
|
|
} |
|
|
|
|
if len(adData) == 0 { |
|
|
|
|
log.Printf("ConversionHugeAmount: adData is nil %s", gjson.MustEncodeString(req)) |
|
|
|
|
err = errors.New("account is nil") |
|
|
|
|
@ -239,9 +239,9 @@ func ConversionHugeAmount(ctx context.Context, req *game.CSHAReq) (res *game.CSH
|
|
|
|
|
} |
|
|
|
|
device["android_id"] = req.Id |
|
|
|
|
} else if req.Platform == "ios" { |
|
|
|
|
//if req.Idfa != "" && req.Idfa != "00000000-0000-0000-0000-000000000000" {
|
|
|
|
|
_ = model.Where("idfa=?", req.Idfa).Page(1, 1).Scan(&adData) |
|
|
|
|
//}
|
|
|
|
|
if req.Idfa != "" && req.Idfa != "00000000-0000-0000-0000-000000000000" { |
|
|
|
|
_ = model.Where("idfa=?", req.Idfa).Page(1, 1).Scan(&adData) |
|
|
|
|
} |
|
|
|
|
if len(adData) == 0 { |
|
|
|
|
if req.Caid != "" { |
|
|
|
|
var list []map[string]string |
|
|
|
|
@ -269,6 +269,14 @@ func ConversionHugeAmount(ctx context.Context, req *game.CSHAReq) (res *game.CSH
|
|
|
|
|
err = errors.New("callbackParam is nil") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if req.EventType == consts.EventType_Active && adData[0].Active == 1 { |
|
|
|
|
err = errors.New("already activated !") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if req.EventType == consts.EventType_Register && adData[0].Register == 1 { |
|
|
|
|
err = errors.New("already register!") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ad := map[string]interface{}{ |
|
|
|
|
"callback": adData[0].CallbackParam, |
|
|
|
|
@ -304,9 +312,16 @@ func ConversionHugeAmount(ctx context.Context, req *game.CSHAReq) (res *game.CSH
|
|
|
|
|
resJson, err := gjson.DecodeToJson(tmp) |
|
|
|
|
if resJson != nil && resJson.Get("code").Int() != 0 { |
|
|
|
|
err = errors.New(resJson.Get("message").String()) |
|
|
|
|
} /*else if resJson.Get("code").Int() == 0 { |
|
|
|
|
dao.AdvertisementOceanegine.Ctx(ctx).Where("id=?", adData[0].Id).Update(do.AdvertisementOceanegine{}) |
|
|
|
|
}*/ |
|
|
|
|
} else if resJson.Get("code").Int() == 0 { |
|
|
|
|
saveData := do.AdvertisementOceanegine{} |
|
|
|
|
if req.EventType == consts.EventType_Active { |
|
|
|
|
saveData.Active = 1 |
|
|
|
|
} |
|
|
|
|
if req.EventType == consts.EventType_Register { |
|
|
|
|
saveData.Register = 1 |
|
|
|
|
} |
|
|
|
|
dao.AdvertisementOceanegine.Ctx(ctx).WherePri(adData[0].Id).Update(saveData) |
|
|
|
|
} |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -331,9 +346,8 @@ func HugeAmount(ctx context.Context, req *game.AdvertiseHAReq) {
|
|
|
|
|
log.Printf("Decrypt err: %s", err.Error()) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
req.Caid = string(decryptedByte) |
|
|
|
|
req.Caid = decryptedByte |
|
|
|
|
} |
|
|
|
|
//log.Printf("HugeAmount caid: %s", gjson.MustEncodeString(req))
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
req2 := game.CSHAReq{ |
|
|
|
|
|