Commit 189b0d01 authored by mengcuiguang's avatar mengcuiguang

优化穿山甲,优量汇codeid逻辑

parent 03bde953
package com.wenshu.youyou.ad.code
import com.wenshu.youyou.manager.TtCsjAdManager
import com.wenshu.youyou.utils.LogUtil
/**
* 描述:穿山甲代码位策略
* 作者:孟崔广
* 时间:2021/4/1 14:02
*/
object CsjCode {
private val TAG = CsjCode::class.java.simpleName
var currentCodePosition = 0 //当前代码位位置
var codeSize = 0 // 代码位总数
private var listCode: MutableList<String>? = null
fun initListCode(listCode: MutableList<String>?) {
listCode?.let {
this.listCode = it
codeSize = it.size
}
}
/**
* 轮训获取列表中的代码位
*
* 一轮获取完成后,重新开始
*/
fun getCodeId(): String {
var codeId = TtCsjAdManager.TT_AD_VEDIO_MOREDIALOG//默认
if (codeSize > 0) {
listCode?.let {
// currentCodePosition == codeSize表示一轮获取完成,需重新开始
if (currentCodePosition == codeSize) {
currentCodePosition = 0
}
codeId = it[currentCodePosition]
LogUtil.d(TAG,"穿山甲激励视频-->总大小:${codeSize} 当前位置:${currentCodePosition} 当前位置codeId:${codeId}")
currentCodePosition++
}
}
return codeId
}
}
\ No newline at end of file
package com.wenshu.youyou.ad.code
import com.wenshu.youyou.manager.YlhAdManager
import com.wenshu.youyou.utils.LogUtil
/**
* 描述:优量汇代码位策略
* 作者:孟崔广
* 时间:2021/4/1 14:30
*/
object YlhCode {
private val TAG = YlhCode::class.java.simpleName
var currentCodePosition = 0 //当前代码位位置
var codeSize = 0 // 代码位总数
private var listCode: MutableList<String>? = null
fun initListCode(listCode: MutableList<String>?) {
listCode?.let {
this.listCode = it
codeSize = it.size
}
}
/**
* 轮训获取列表中的代码位
*
* 一轮获取完成后,重新开始
*/
fun getCodeId(): String {
var codeId = YlhAdManager.YLH_AD_VEDIO_MOREDIALOG//默认
if (codeSize > 0) {
listCode?.let {
// currentCodePosition == codeSize表示一轮获取完成,需重新开始
if (currentCodePosition == codeSize) {
currentCodePosition = 0
}
codeId = it[currentCodePosition]
LogUtil.d(TAG, "优量汇激励视频-->总大小:${codeSize} 当前位置:${currentCodePosition} 当前位置codeId:${codeId}")
currentCodePosition++
}
}
return codeId
}
}
\ No newline at end of file
......@@ -8,6 +8,8 @@ import com.bytedance.sdk.openadsdk.TTAdNative;
import com.bytedance.sdk.openadsdk.TTAppDownloadListener;
import com.bytedance.sdk.openadsdk.TTRewardVideoAd;
import com.wenshu.youyou.BuildConfig;
import com.wenshu.youyou.WenshuApplication;
import com.wenshu.youyou.ad.code.CsjCode;
import com.wenshu.youyou.ad.video.base.BaseVideoAd;
import com.wenshu.youyou.ad.video.base.VideoAdStatusListener;
import com.wenshu.youyou.common.AppConfig;
......@@ -19,6 +21,7 @@ import com.wenshu.youyou.manager.UserManager;
import com.wenshu.youyou.utils.LogUtil;
import com.wenshu.youyou.utils.MD5;
import com.wenshu.library.utils.json.JsonUtil;
import com.wenshu.youyou.utils.ToastUtil;
import net.grandcentrix.tray.AppPreferences;
......@@ -82,61 +85,11 @@ public class CsjVideoAdManager extends BaseVideoAd {
isClickScreen = true;
this.curCoin = curCoin;
this.extraId = extraId;
String codeId = TtCsjAdManager.TT_AD_VEDIO_MAIN_DEV;
if (!BuildConfig.DEBUG) {
switch (carrierType) {
case Constant.CARRIER_VERSUS_VIDEO:// 每日任务视频
codeId = TtCsjAdManager.TT_AD_VEDIO_MAIN;
break;
case Constant.CARRIER_OFFLINE_DOUBLE:// 离线收益翻倍
codeId = TtCsjAdManager.TT_AD_VEDIO_OFFINELINE;
break;
case Constant.CARRIER_SIGNIN_HOMEPAGE_CARD:// 签到翻倍
codeId = TtCsjAdManager.TT_AD_VEDIO_SIGN;
break;
case Constant.CARRIER_WALK_BUBBLE:// 汽泡
codeId = TtCsjAdManager.TT_AD_VEDIO_MOREDIALOG;
break;
case Constant.CARRIER_HOMEWATER:// 喝水
codeId = TtCsjAdManager.TT_AD_VEDIO_DRINK;
break;
case Constant.CARRIER_WALK:// 走路
codeId = TtCsjAdManager.TT_AD_VEDIO_WALK;
break;
case Constant.CARRIER_CHALLENGE_TURN:// 大转盘
codeId = TtCsjAdManager.TT_AD_VEDIO_TURNABLE;
break;
case Constant.CARRIER_DRAWCASH:// 提现
codeId = TtCsjAdManager.TT_AD_VEDIO_DRAWCASH;
break;
case Constant.CARRIER_CHALLENGE_CARD:// 刮刮乐
codeId = TtCsjAdManager.TT_AD_VEDIO_ERASE;
break;
case Constant.CARRIER_BLESSINGBAG_DOUBLE:// 福袋
codeId = TtCsjAdManager.TT_AD_VEDIO_BLESSINGBAG;
break;
case Constant.CARRIER_HOMEVEDIO_DOUBLE:// 首页视频翻倍
codeId = TtCsjAdManager.TT_AD_VEDIO_HOMEVEDIO;
break;
case Constant.CARRIER_SMALLHOMEVEDIO_DOUBLE:// 短视频翻倍
codeId = TtCsjAdManager.TT_AD_VEDIO_SMALLHOMEVEDIO;
break;
case Constant.CARRIER_KUYINYUE_VEDIO:// 来电秀
codeId = TtCsjAdManager.TT_AD_VEDIO_KYLVEDIO;
break;
case Constant.CARRIER_EATMEAL_SUBSIDY:// 饭补
codeId = TtCsjAdManager.TT_AD_VEDIO_EAT;
break;
case Constant.CARRIER_HIGH_ACTIVITY:// 超级翻倍/高额任务
codeId = TtCsjAdManager.TT_AD_VEDIO_MOST;
break;
default:
codeId = TtCsjAdManager.TT_AD_VEDIO_MOREDIALOG;
break;
}
}
// showToast("穿山甲激励视频代码位:" + codeId);
String codeId = getCodeId(carrierType);
ToastUtil.showLong(WenshuApplication.getContext(), "穿山甲激励视频代码位:" + codeId);
String userID = userManager.getUserID();
String tid = MD5.GetMD5Code(System.currentTimeMillis() + userID);
......@@ -277,6 +230,28 @@ public class CsjVideoAdManager extends BaseVideoAd {
}
}
/**
* 获取codeId
*
* @param carrierType
* @return
*/
private String getCodeId(String carrierType) {
String codeId = TtCsjAdManager.TT_AD_VEDIO_MAIN_DEV;
if (!BuildConfig.DEBUG) {
switch (carrierType) {
case Constant.CARRIER_BLESSINGBAG_DOUBLE:// 福袋
codeId = TtCsjAdManager.TT_AD_VEDIO_BLESSINGBAG;
break;
default:
codeId = CsjCode.INSTANCE.getCodeId();
break;
}
}
return codeId;
}
/**
* 封装广告数据,请求服务器
*
......
......@@ -3,6 +3,8 @@ package com.wenshu.youyou.ad.video;
import android.app.Activity;
import android.os.SystemClock;
import com.wenshu.youyou.WenshuApplication;
import com.wenshu.youyou.ad.code.YlhCode;
import com.wenshu.youyou.ad.video.base.BaseVideoAd;
import com.wenshu.youyou.ad.video.base.VideoAdStatusListener;
import com.wenshu.youyou.common.AppConfig;
......@@ -13,6 +15,7 @@ import com.wenshu.youyou.utils.LogUtil;
import com.qq.e.ads.rewardvideo.RewardVideoAD;
import com.qq.e.ads.rewardvideo.RewardVideoADListener;
import com.qq.e.comm.util.AdError;
import com.wenshu.youyou.utils.ToastUtil;
import java.util.Map;
......@@ -49,81 +52,9 @@ public class YlhVideoAdManager extends BaseVideoAd {
public void loadAd(Activity activity, int curCoin, String carrierType, String extraId) {
isClickScreen = true;
String ylhPostId;
// switch (carrierType) {
// case Constant.CARRIER_VERSUS_VIDEO:// 每日任务视频
// ylhPostId = YlhAdManager.YLH_AD_VEDIO_MAIN_POSTID;
// break;
// case Constant.CARRIER_OFFLINE_DOUBLE:// 离线收益翻倍
// case Constant.CARRIER_SIGNIN_HOMEPAGE_CARD:// 签到翻倍
// case Constant.CARRIER_WALK_BUBBLE:// 汽泡
// ylhPostId = YlhAdManager.YLH_AD_VEDIO_MOREDIALOG_POSTID;
// break;
// case Constant.CARRIER_HOMEWATER:// 喝水
// ylhPostId = YlhAdManager.YLH_AD_VEDIO_DRINK_POSTID;
// break;
// case Constant.CARRIER_CHALLENGE_TURN:// 大转盘
// case Constant.CARRIER_DRAWCASH:// 提现
// ylhPostId = YlhAdManager.YLH_AD_VEDIO_TURNABLE_POSTID;
// break;
// case Constant.CARRIER_CHALLENGE_CARD:// 刮刮乐
// ylhPostId = YlhAdManager.YLH_AD_VEDIO_ERASE_POSTID;
// break;
// default:// 在线收益翻倍
// ylhPostId = YlhAdManager.YLH_AD_VEDIO_MOREDIALOG_POSTID;
// break;
// }
switch (carrierType) {
case Constant.CARRIER_VERSUS_VIDEO:// 每日任务视频
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_MAIN();
break;
case Constant.CARRIER_OFFLINE_DOUBLE:// 离线收益翻倍
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_OFFINELINE();
break;
case Constant.CARRIER_SIGNIN_HOMEPAGE_CARD:// 签到翻倍
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_SIGN();
break;
case Constant.CARRIER_WALK_BUBBLE:// 汽泡
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_MOREDIALOG();
break;
case Constant.CARRIER_HOMEWATER:// 喝水
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_DRINK();
break;
case Constant.CARRIER_WALK:// 走路
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_WALK();
break;
case Constant.CARRIER_CHALLENGE_TURN:// 大转盘
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_TURNABLE();
break;
case Constant.CARRIER_DRAWCASH:// 提现
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_DRAWCASH();
break;
case Constant.CARRIER_CHALLENGE_CARD:// 刮刮乐
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_ERASE();
break;
case Constant.CARRIER_BLESSINGBAG_DOUBLE:// 福袋
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_BLESSINGBAG();
break;
case Constant.CARRIER_HOMEVEDIO_DOUBLE:// 首页视频翻倍
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_HOMEVEDIO();
break;
case Constant.CARRIER_SMALLHOMEVEDIO_DOUBLE:// 短视频翻倍
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_SMALLHOMEVEDIO();
break;
case Constant.CARRIER_KUYINYUE_VEDIO:// 来电秀
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_KYLVEDIO();
break;
case Constant.CARRIER_EATMEAL_SUBSIDY:// 饭补
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_EAT();
break;
case Constant.CARRIER_HIGH_ACTIVITY:// 超级翻倍/高额任务
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_MOST();
break;
default:
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_MOREDIALOG();
break;
}
// ToastUtil.show(WenshuApplication.getContext(), "ylh vedio:" + ylhPostId);
String ylhPostId = getCodeId(carrierType);
ToastUtil.showLong(WenshuApplication.getContext(), "优量汇激励视频代码位:" + ylhPostId);
if (rewardVideoAD != null) {
rewardVideoAD = null;
}
......@@ -229,6 +160,19 @@ public class YlhVideoAdManager extends BaseVideoAd {
rewardVideoAD.loadAD();
}
private String getCodeId(String carrierType) {
String ylhPostId;
switch (carrierType) {
case Constant.CARRIER_BLESSINGBAG_DOUBLE:// 福袋
ylhPostId = YlhAdManager.INSTANCE.getYLH_AD_VEDIO_BLESSINGBAG();
break;
default:
ylhPostId = YlhCode.INSTANCE.getCodeId();
break;
}
return ylhPostId;
}
public void setVideoAdStatusListener(VideoAdStatusListener videoAdStatusListener) {
this.videoAdStatusListener = videoAdStatusListener;
}
......
......@@ -14,10 +14,10 @@ object ChannelManager {
/**
* 按用户注册渠道 动态时时更新代码位
*/
fun updataCodeIdForRegisterChannel(idBean: AdcodeBean?) {
TtCsjAdManager.updataIdByChannel(idBean)
YlhAdManager.updataIdByChannel(idBean)
}
// fun updataCodeIdForRegisterChannel(idBean: AdcodeBean?) {
// TtCsjAdManager.updataIdByChannel(idBean)
// YlhAdManager.updataIdByChannel(idBean)
// }
/**
......
......@@ -39,7 +39,7 @@ public class TtCsjAdManager {
public static String TT_AD_VEDIO_OFFINELINE = "945968497";// 离线弹框
public static String TT_AD_VEDIO_DRAWCASH = "945968497";// 提现
public static String TT_AD_VEDIO_MOST = "945968497";// 超级翻倍/高额任务
public static String TT_AD_VEDIO_BLESSINGBAG = "945968497";// 福袋
public static String TT_AD_VEDIO_BLESSINGBAG = "945982071";// 福袋
public static String TT_AD_VEDIO_HOMEVEDIO = "945968497";// 首页视频翻倍
public static String TT_AD_VEDIO_SMALLHOMEVEDIO = "945968497";// 短视频翻倍
public static String TT_AD_VEDIO_KYLVEDIO = "945968497";// 来电秀视频
......@@ -114,21 +114,21 @@ public class TtCsjAdManager {
TT_AD_NATIVEEXPRESS_MORNINGCLOCK = idBean.getCsjv2();
TT_AD_NATIVEEXPRESS_EAT = idBean.getCsjv2();
// 激励视频
TT_AD_VEDIO_DRINK = idBean.getCsjv3();//喝水打卡
TT_AD_VEDIO_WALK = idBean.getCsjv3();//走路打卡
TT_AD_VEDIO_MAIN = idBean.getCsjv3();// 我的界面视频
TT_AD_VEDIO_ERASE = idBean.getCsjv3();// 刮刮乐
TT_AD_VEDIO_TURNABLE = idBean.getCsjv3();// 大转盘
TT_AD_VEDIO_MOREDIALOG = idBean.getCsjv3();// 气泡
TT_AD_VEDIO_SIGN = idBean.getCsjv3();// 签到
TT_AD_VEDIO_EAT = idBean.getCsjv3();// 饭补
TT_AD_VEDIO_OFFINELINE = idBean.getCsjv3();// 离线弹框
TT_AD_VEDIO_DRAWCASH = idBean.getCsjv3();// 提现
TT_AD_VEDIO_MOST = idBean.getCsjv3();// 超级翻倍/高额任务
TT_AD_VEDIO_BLESSINGBAG = idBean.getCsjv3();// 福袋
TT_AD_VEDIO_HOMEVEDIO = idBean.getCsjv3();// 首页视频翻倍
TT_AD_VEDIO_SMALLHOMEVEDIO = idBean.getCsjv3();// 短视频翻倍
TT_AD_VEDIO_KYLVEDIO = idBean.getCsjv3();// 来电秀视频
// TT_AD_VEDIO_DRINK = idBean.getCsjv3();//喝水打卡
// TT_AD_VEDIO_WALK = idBean.getCsjv3();//走路打卡
// TT_AD_VEDIO_MAIN = idBean.getCsjv3();// 我的界面视频
// TT_AD_VEDIO_ERASE = idBean.getCsjv3();// 刮刮乐
// TT_AD_VEDIO_TURNABLE = idBean.getCsjv3();// 大转盘
// TT_AD_VEDIO_MOREDIALOG = idBean.getCsjv3();// 气泡
// TT_AD_VEDIO_SIGN = idBean.getCsjv3();// 签到
// TT_AD_VEDIO_EAT = idBean.getCsjv3();// 饭补
// TT_AD_VEDIO_OFFINELINE = idBean.getCsjv3();// 离线弹框
// TT_AD_VEDIO_DRAWCASH = idBean.getCsjv3();// 提现
// TT_AD_VEDIO_MOST = idBean.getCsjv3();// 超级翻倍/高额任务
// TT_AD_VEDIO_BLESSINGBAG = idBean.getCsjv3();// 福袋
// TT_AD_VEDIO_HOMEVEDIO = idBean.getCsjv3();// 首页视频翻倍
// TT_AD_VEDIO_SMALLHOMEVEDIO = idBean.getCsjv3();// 短视频翻倍
// TT_AD_VEDIO_KYLVEDIO = idBean.getCsjv3();// 来电秀视频
// banner
TT_AD_BANNER_MY = idBean.getCsjv4();
}
......@@ -153,51 +153,51 @@ public class TtCsjAdManager {
TT_AD_NATIVEEXPRESS_EAT = adBean.getCsj().getExpress().getEXPRESS_COMMON();
}
// 激励视频
if (!TextUtils.isEmpty(idBean.getHOMEWATER())) {
TT_AD_VEDIO_DRINK = idBean.getHOMEWATER();//喝水打卡
}
if (!TextUtils.isEmpty(idBean.getWALK())) {
TT_AD_VEDIO_WALK = idBean.getWALK();//走路打卡
}
if (!TextUtils.isEmpty(idBean.getCHALLENGE_VEDIO())) {
TT_AD_VEDIO_MAIN = idBean.getCHALLENGE_VEDIO();// 我的界面视频
}
if (!TextUtils.isEmpty(idBean.getCHALLENGE_CARD())) {
TT_AD_VEDIO_ERASE = idBean.getCHALLENGE_CARD();// 刮刮乐
}
if (!TextUtils.isEmpty(idBean.getCHALLENGE_TURN())) {
TT_AD_VEDIO_TURNABLE = idBean.getCHALLENGE_TURN();// 大转盘
}
if (!TextUtils.isEmpty(idBean.getWALK_BUBBLE())) {
TT_AD_VEDIO_MOREDIALOG = idBean.getWALK_BUBBLE();// 气泡
}
if (!TextUtils.isEmpty(idBean.getSIGNIN_HOMEPAGE_CARD())) {
TT_AD_VEDIO_SIGN = idBean.getSIGNIN_HOMEPAGE_CARD();// 签到
}
if (!TextUtils.isEmpty(idBean.getEATMEAL_SUBSIDY())) {
TT_AD_VEDIO_EAT = idBean.getEATMEAL_SUBSIDY();// 饭补
}
if (!TextUtils.isEmpty(idBean.getOFFLINE_DOUBLE())) {
TT_AD_VEDIO_OFFINELINE = idBean.getOFFLINE_DOUBLE();// 离线弹框
}
if (!TextUtils.isEmpty(idBean.getDRAWCASH())) {
TT_AD_VEDIO_DRAWCASH = idBean.getDRAWCASH();// 提现
}
if (!TextUtils.isEmpty(idBean.getHIGH_ACTIVITY())) {
TT_AD_VEDIO_MOST = idBean.getHIGH_ACTIVITY();// 超级翻倍/高额任务
}
if (!TextUtils.isEmpty(idBean.getBLESSINGBAG())) {
TT_AD_VEDIO_BLESSINGBAG = idBean.getBLESSINGBAG();// 福袋
}
if (!TextUtils.isEmpty(idBean.getHOMEVEDIO_CHALLENGE())) {
TT_AD_VEDIO_HOMEVEDIO = idBean.getHOMEVEDIO_CHALLENGE();// 首页视频翻倍
}
if (!TextUtils.isEmpty(idBean.getSMALLHOMEVEDIO_DOUBLE())) {
TT_AD_VEDIO_SMALLHOMEVEDIO = idBean.getSMALLHOMEVEDIO_DOUBLE();// 短视频翻倍
}
if (!TextUtils.isEmpty(idBean.getKUYINYUE_VEDIO())) {
TT_AD_VEDIO_KYLVEDIO = idBean.getKUYINYUE_VEDIO();// 来电秀视频
}
// if (!TextUtils.isEmpty(idBean.getHOMEWATER())) {
// TT_AD_VEDIO_DRINK = idBean.getHOMEWATER();//喝水打卡
// }
// if (!TextUtils.isEmpty(idBean.getWALK())) {
// TT_AD_VEDIO_WALK = idBean.getWALK();//走路打卡
// }
// if (!TextUtils.isEmpty(idBean.getCHALLENGE_VEDIO())) {
// TT_AD_VEDIO_MAIN = idBean.getCHALLENGE_VEDIO();// 我的界面视频
// }
// if (!TextUtils.isEmpty(idBean.getCHALLENGE_CARD())) {
// TT_AD_VEDIO_ERASE = idBean.getCHALLENGE_CARD();// 刮刮乐
// }
// if (!TextUtils.isEmpty(idBean.getCHALLENGE_TURN())) {
// TT_AD_VEDIO_TURNABLE = idBean.getCHALLENGE_TURN();// 大转盘
// }
// if (!TextUtils.isEmpty(idBean.getWALK_BUBBLE())) {
// TT_AD_VEDIO_MOREDIALOG = idBean.getWALK_BUBBLE();// 气泡
// }
// if (!TextUtils.isEmpty(idBean.getSIGNIN_HOMEPAGE_CARD())) {
// TT_AD_VEDIO_SIGN = idBean.getSIGNIN_HOMEPAGE_CARD();// 签到
// }
// if (!TextUtils.isEmpty(idBean.getEATMEAL_SUBSIDY())) {
// TT_AD_VEDIO_EAT = idBean.getEATMEAL_SUBSIDY();// 饭补
// }
// if (!TextUtils.isEmpty(idBean.getOFFLINE_DOUBLE())) {
// TT_AD_VEDIO_OFFINELINE = idBean.getOFFLINE_DOUBLE();// 离线弹框
// }
// if (!TextUtils.isEmpty(idBean.getDRAWCASH())) {
// TT_AD_VEDIO_DRAWCASH = idBean.getDRAWCASH();// 提现
// }
// if (!TextUtils.isEmpty(idBean.getHIGH_ACTIVITY())) {
// TT_AD_VEDIO_MOST = idBean.getHIGH_ACTIVITY();// 超级翻倍/高额任务
// }
// if (!TextUtils.isEmpty(idBean.getBLESSINGBAG())) {
// TT_AD_VEDIO_BLESSINGBAG = idBean.getBLESSINGBAG();// 福袋
// }
// if (!TextUtils.isEmpty(idBean.getHOMEVEDIO_CHALLENGE())) {
// TT_AD_VEDIO_HOMEVEDIO = idBean.getHOMEVEDIO_CHALLENGE();// 首页视频翻倍
// }
// if (!TextUtils.isEmpty(idBean.getSMALLHOMEVEDIO_DOUBLE())) {
// TT_AD_VEDIO_SMALLHOMEVEDIO = idBean.getSMALLHOMEVEDIO_DOUBLE();// 短视频翻倍
// }
// if (!TextUtils.isEmpty(idBean.getKUYINYUE_VEDIO())) {
// TT_AD_VEDIO_KYLVEDIO = idBean.getKUYINYUE_VEDIO();// 来电秀视频
// }
// 全屏广告
if (!TextUtils.isEmpty(adBean.getCsj().getFullvedio().getFULLVEDIO_COMMON())) {
TT_AD_FULLVEDIO_ALL = adBean.getCsj().getFullvedio().getFULLVEDIO_COMMON();
......
......@@ -31,7 +31,7 @@ object YlhAdManager {
var YLH_AD_VEDIO_OFFINELINE = "4061975164654076" // 离线弹框
var YLH_AD_VEDIO_DRAWCASH = "4061975164654076" // 提现
var YLH_AD_VEDIO_MOST = "4061975164654076" // 超级翻倍/高额任务
var YLH_AD_VEDIO_BLESSINGBAG = "4061975164654076" // 福袋
var YLH_AD_VEDIO_BLESSINGBAG = "3051979206073642" // 福袋
var YLH_AD_VEDIO_HOMEVEDIO = "4061975164654076" // 首页视频翻倍
var YLH_AD_VEDIO_SMALLHOMEVEDIO = "4061975164654076" // 短视频翻倍
var YLH_AD_VEDIO_KYLVEDIO = "4061975164654076" // 来电秀视频
......@@ -56,21 +56,21 @@ object YlhAdManager {
// 开屏
YLH_AD_SPLASH_POSTID = idBean.ylhv1
// 激励视频
YLH_AD_VEDIO_DRINK = idBean.ylhv2 //喝水打卡
YLH_AD_VEDIO_WALK = idBean.ylhv2 //走路打卡
YLH_AD_VEDIO_MAIN = idBean.ylhv2 // 我的界面视频
YLH_AD_VEDIO_ERASE = idBean.ylhv2 // 刮刮乐
YLH_AD_VEDIO_TURNABLE = idBean.ylhv2 // 大转盘
YLH_AD_VEDIO_MOREDIALOG = idBean.ylhv2 // 气泡
YLH_AD_VEDIO_SIGN = idBean.ylhv2 // 签到
YLH_AD_VEDIO_EAT = idBean.ylhv2 // 饭补
YLH_AD_VEDIO_OFFINELINE = idBean.ylhv2 // 离线弹框
YLH_AD_VEDIO_DRAWCASH = idBean.ylhv2 // 提现
YLH_AD_VEDIO_MOST = idBean.ylhv2 // 超级翻倍/高额任务
YLH_AD_VEDIO_BLESSINGBAG = idBean.ylhv2 // 福袋
YLH_AD_VEDIO_HOMEVEDIO = idBean.ylhv2 // 首页视频翻倍
YLH_AD_VEDIO_SMALLHOMEVEDIO = idBean.ylhv2 // 短视频翻倍
YLH_AD_VEDIO_KYLVEDIO = idBean.ylhv2 // 来电秀视频
// YLH_AD_VEDIO_DRINK = idBean.ylhv2 //喝水打卡
// YLH_AD_VEDIO_WALK = idBean.ylhv2 //走路打卡
// YLH_AD_VEDIO_MAIN = idBean.ylhv2 // 我的界面视频
// YLH_AD_VEDIO_ERASE = idBean.ylhv2 // 刮刮乐
// YLH_AD_VEDIO_TURNABLE = idBean.ylhv2 // 大转盘
// YLH_AD_VEDIO_MOREDIALOG = idBean.ylhv2 // 气泡
// YLH_AD_VEDIO_SIGN = idBean.ylhv2 // 签到
// YLH_AD_VEDIO_EAT = idBean.ylhv2 // 饭补
// YLH_AD_VEDIO_OFFINELINE = idBean.ylhv2 // 离线弹框
// YLH_AD_VEDIO_DRAWCASH = idBean.ylhv2 // 提现
// YLH_AD_VEDIO_MOST = idBean.ylhv2 // 超级翻倍/高额任务
// YLH_AD_VEDIO_BLESSINGBAG = idBean.ylhv2 // 福袋
// YLH_AD_VEDIO_HOMEVEDIO = idBean.ylhv2 // 首页视频翻倍
// YLH_AD_VEDIO_SMALLHOMEVEDIO = idBean.ylhv2 // 短视频翻倍
// YLH_AD_VEDIO_KYLVEDIO = idBean.ylhv2 // 来电秀视频
}
}
......@@ -78,54 +78,54 @@ object YlhAdManager {
* 按包渠道更新代码位
*/
fun updataIdByPkg(adBean: ServerAdBean?) {
if (adBean != null && adBean.ylh != null && adBean.ylh.vedio != null) {
if (adBean != null && adBean.ylh != null) {
val idBean = adBean.ylh.vedio
// 激励视频
if(!TextUtils.isEmpty(idBean.homewater)){
YLH_AD_VEDIO_DRINK = idBean.homewater //喝水打卡
}
if(!TextUtils.isEmpty(idBean.walk)){
YLH_AD_VEDIO_WALK = idBean.walk //走路打卡
}
if(!TextUtils.isEmpty(idBean.challengE_VEDIO)){
YLH_AD_VEDIO_MAIN = idBean.challengE_VEDIO // 我的界面视频
}
if(!TextUtils.isEmpty(idBean.challengE_CARD)){
YLH_AD_VEDIO_ERASE = idBean.challengE_CARD // 刮刮乐
}
if(!TextUtils.isEmpty(idBean.challengE_TURN)){
YLH_AD_VEDIO_TURNABLE = idBean.challengE_TURN // 大转盘
}
if(!TextUtils.isEmpty(idBean.walK_BUBBLE)){
YLH_AD_VEDIO_MOREDIALOG = idBean.walK_BUBBLE // 气泡
}
if(!TextUtils.isEmpty(idBean.signiN_HOMEPAGE_CARD)){
YLH_AD_VEDIO_SIGN = idBean.signiN_HOMEPAGE_CARD // 签到
}
if(!TextUtils.isEmpty(idBean.eatmeaL_SUBSIDY)){
YLH_AD_VEDIO_EAT = idBean.eatmeaL_SUBSIDY // 饭补
}
if(!TextUtils.isEmpty(idBean.offlinE_DOUBLE)){
YLH_AD_VEDIO_OFFINELINE = idBean.offlinE_DOUBLE // 离线弹框
}
if(!TextUtils.isEmpty(idBean.drawcash)){
YLH_AD_VEDIO_DRAWCASH = idBean.drawcash // 提现
}
if(!TextUtils.isEmpty(idBean.higH_ACTIVITY)){
YLH_AD_VEDIO_MOST = idBean.higH_ACTIVITY // 超级翻倍/高额任务
}
if(!TextUtils.isEmpty(idBean.blessingbag)){
YLH_AD_VEDIO_BLESSINGBAG = idBean.blessingbag // 福袋
}
if(!TextUtils.isEmpty(idBean.homevediO_CHALLENGE)){
YLH_AD_VEDIO_HOMEVEDIO = idBean.homevediO_CHALLENGE // 首页视频翻倍
}
if(!TextUtils.isEmpty(idBean.smallhomevediO_DOUBLE)){
YLH_AD_VEDIO_SMALLHOMEVEDIO = idBean.smallhomevediO_DOUBLE // 短视频翻倍
}
if(!TextUtils.isEmpty(idBean.kuyinyuE_VEDIO)){
YLH_AD_VEDIO_KYLVEDIO = idBean.kuyinyuE_VEDIO // 来电秀视频
}
// if(!TextUtils.isEmpty(idBean.homewater)){
// YLH_AD_VEDIO_DRINK = idBean.homewater //喝水打卡
// }
// if(!TextUtils.isEmpty(idBean.walk)){
// YLH_AD_VEDIO_WALK = idBean.walk //走路打卡
// }
// if(!TextUtils.isEmpty(idBean.challengE_VEDIO)){
// YLH_AD_VEDIO_MAIN = idBean.challengE_VEDIO // 我的界面视频
// }
// if(!TextUtils.isEmpty(idBean.challengE_CARD)){
// YLH_AD_VEDIO_ERASE = idBean.challengE_CARD // 刮刮乐
// }
// if(!TextUtils.isEmpty(idBean.challengE_TURN)){
// YLH_AD_VEDIO_TURNABLE = idBean.challengE_TURN // 大转盘
// }
// if(!TextUtils.isEmpty(idBean.walK_BUBBLE)){
// YLH_AD_VEDIO_MOREDIALOG = idBean.walK_BUBBLE // 气泡
// }
// if(!TextUtils.isEmpty(idBean.signiN_HOMEPAGE_CARD)){
// YLH_AD_VEDIO_SIGN = idBean.signiN_HOMEPAGE_CARD // 签到
// }
// if(!TextUtils.isEmpty(idBean.eatmeaL_SUBSIDY)){
// YLH_AD_VEDIO_EAT = idBean.eatmeaL_SUBSIDY // 饭补
// }
// if(!TextUtils.isEmpty(idBean.offlinE_DOUBLE)){
// YLH_AD_VEDIO_OFFINELINE = idBean.offlinE_DOUBLE // 离线弹框
// }
// if(!TextUtils.isEmpty(idBean.drawcash)){
// YLH_AD_VEDIO_DRAWCASH = idBean.drawcash // 提现
// }
// if(!TextUtils.isEmpty(idBean.higH_ACTIVITY)){
// YLH_AD_VEDIO_MOST = idBean.higH_ACTIVITY // 超级翻倍/高额任务
// }
// if(!TextUtils.isEmpty(idBean.blessingbag)){
// YLH_AD_VEDIO_BLESSINGBAG = idBean.blessingbag // 福袋
// }
// if(!TextUtils.isEmpty(idBean.homevediO_CHALLENGE)){
// YLH_AD_VEDIO_HOMEVEDIO = idBean.homevediO_CHALLENGE // 首页视频翻倍
// }
// if(!TextUtils.isEmpty(idBean.smallhomevediO_DOUBLE)){
// YLH_AD_VEDIO_SMALLHOMEVEDIO = idBean.smallhomevediO_DOUBLE // 短视频翻倍
// }
// if(!TextUtils.isEmpty(idBean.kuyinyuE_VEDIO)){
// YLH_AD_VEDIO_KYLVEDIO = idBean.kuyinyuE_VEDIO // 来电秀视频
// }
if(!TextUtils.isEmpty(adBean.ylh.express.expresS_DIALOG)){
YLH_AD_NATIVEEXPRESS_AWARD = adBean.ylh.express.expresS_DIALOG
......
package com.wenshu.youyou.mvp.model
import java.io.Serializable
data class CodeBean(
val csjArr: MutableList<String>? = null,
val ylhArr: MutableList<String>? = null
) : Serializable
\ No newline at end of file
package com.wenshu.youyou.mvp.presenters
import android.text.TextUtils
import com.google.gson.JsonObject
import com.wenshu.youyou.WenshuApplication
import com.wenshu.youyou.common.Constant
import com.wenshu.youyou.common.DeviceInfo
import com.wenshu.youyou.manager.AppHttpManager
import com.wenshu.youyou.manager.ShumeiManager
import com.wenshu.youyou.manager.UserManager
import com.wenshu.youyou.mvp.model.BaseResponse
import com.wenshu.youyou.mvp.model.MainVideoMsgBean
import com.wenshu.youyou.mvp.model.UserBean
import com.wenshu.youyou.mvp.model.UserTaskMsgBean
import com.wenshu.youyou.mvp.views.HomeView
import com.wenshu.youyou.utils.DeviceUuidFactory
import com.wenshu.youyou.utils.IPUtil
......@@ -18,6 +15,9 @@ import com.wenshu.youyou.utils.LogUtil
import com.wenshu.youyou.utils.SPUtil
import com.wenshu.library.net.neterror.BaseSubscriber
import com.wenshu.library.net.neterror.Throwable
import com.wenshu.youyou.ad.code.CsjCode
import com.wenshu.youyou.ad.code.YlhCode
import com.wenshu.youyou.mvp.model.*
import net.grandcentrix.tray.AppPreferences
import java.util.*
......@@ -26,7 +26,7 @@ class HomePresenter : BasePresenter<HomeView>() {
/**
* 打开激活
*/
fun comSaveTerminalInfo(ps: AppPreferences) {
fun comSaveTerminalInfo() {
val vo = HashMap<String, Any>()
val deviceInfo: DeviceInfo = DeviceInfo.instance
val macAddress: String = deviceInfo.getMacAddress()
......@@ -65,6 +65,32 @@ class HomePresenter : BasePresenter<HomeView>() {
})
}
fun getAdcodesInOpenApp() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.getAdcodesInOpenApp(),
object : BaseSubscriber<BaseResponse<CodeBean>>() {
override fun onCompleted() {
if (isLinkView) return
}
override fun onError(e: Throwable) {
if (isLinkView) return
}
override fun onNext(baseResponse: BaseResponse<CodeBean>) {
if (isLinkView) return
val code = baseResponse.getStatus()
when (code) {
200 -> {
val codeBean = baseResponse.data
CsjCode.initListCode(codeBean.csjArr)
YlhCode.initListCode(codeBean.ylhArr)
}
}
}
})
}
fun getHallBaseMsg() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.getHallBaseMsg(),
......
......@@ -9,6 +9,7 @@ import com.wenshu.youyou.mvp.model.BannerBean;
import com.wenshu.youyou.mvp.model.BaseResponse;
import com.wenshu.youyou.mvp.model.CashoutChallengeBean;
import com.wenshu.youyou.mvp.model.ClickTurnBean;
import com.wenshu.youyou.mvp.model.CodeBean;
import com.wenshu.youyou.mvp.model.CommonParamBean;
import com.wenshu.youyou.mvp.model.CpdBean;
import com.wenshu.youyou.mvp.model.DrawcashBean;
......@@ -629,6 +630,15 @@ public interface LoanService {
@POST("api/turn/addTurnToOtherMsg")
Observable<BaseResponse<Object>> addTurnToOtherMsg(@Body Map<String, Object> vo);
/**
* 获取adcode List
*
* @return
*/
@POST("na/getAdcodesInOpenApp")
Observable<BaseResponse<CodeBean>> getAdcodesInOpenApp();
/**
* 默认http工厂
*/
......
......@@ -93,9 +93,6 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
// 奖励页预加载 信息流广告
PreLoadExpressManager.loadADFrameLayout()
// 刷新喜马拉雅信息流
TTPreLoadExpressXmlyManager.getInstance().loadTtFrameLayout()
// 首次显示权限弹窗
showPowerDialog()
......@@ -154,8 +151,10 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
private fun uploadDeviceInfo() {
// if (!ps.getBoolean(Constant.FIRST_DEVICE_FLAG, false)) {
homePresenter.comSaveTerminalInfo(ps)
homePresenter.comSaveTerminalInfo()
baseApplication.initUm(context)
homePresenter.getAdcodesInOpenApp()
// }
}
......@@ -234,7 +233,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
if (data.adcode != null) {
AppConfig.user_channel_ad = data.adcode.key
}
ChannelManager.updataCodeIdForRegisterChannel(data.adcode)
// ChannelManager.updataCodeIdForRegisterChannel(data.adcode)
// 新人福利 放到个人中心展示 防止首页红包转动异常
......
......@@ -319,7 +319,7 @@ class MyFragment : BaseFragment(),
if (data.adcode != null) {
AppConfig.user_channel_ad = data.adcode.key
}
ChannelManager.updataCodeIdForRegisterChannel(data.adcode)
// ChannelManager.updataCodeIdForRegisterChannel(data.adcode)
// 是否上报点击广告
AppConfig.needReportClickAdEvent = data.isNeedReportClickAdEvent
......
......@@ -36,14 +36,14 @@ public class ToastUtil {
}
public static void showLong(Context context, String msg) {
// showToast(context, msg, Toast.LENGTH_LONG, Gravity.CENTER);
try {
ToastUtils.show(msg);
} catch (Exception e) {
e.printStackTrace();
showToast(context, msg, Toast.LENGTH_LONG, Gravity.CENTER);
}
// try {
// ToastUtils.show(msg);
// } catch (Exception e) {
// e.printStackTrace();
// showToast(context, msg, Toast.LENGTH_LONG, Gravity.CENTER);
// }
}
public static void show(Context context, String msg, boolean isShowToast) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment