Commit 2abf2287 authored by mengcuiguang's avatar mengcuiguang

添加信息流权重bean

parent a12406bf
......@@ -7,6 +7,7 @@ import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.mvp.model.WeightBean
import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.ToastUtil
import com.qq.e.ads.nativ.NativeExpressADView
import java.util.*
......@@ -72,9 +73,7 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
* 根据权重获取广告类型
*/
private fun getRandomWeight(): String {
if (weightList != null) {
weightList.clear()
}
weightList.clear()
var weight = 0
// 若没有视频完成数,不加入权重计算范围内
if (csjWeight > 0) {
......@@ -94,13 +93,13 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
}
// 权重随机
if (weightList != null && weightList.size > 0 && weight > 0) {
if (weightList.size > 0 && weight > 0) {
LogUtil.d(TAG, "1、权重总值EXPRESS:$weight")
val r = Random()
var randomWeight = r.nextInt(weight) + 1
LogUtil.d(TAG, "2、权重随机值EXPRESS:$randomWeight")
// ToastUtil.show(MintsApplication.getContext(), "权重随机值:" + randomWeight);
ToastUtil.show(MintsApplication.getContext(), "权重随机值EXPRESS:" + randomWeight);
for (weightBean in weightList) {
randomWeight -= weightBean.weight
if (randomWeight <= 0) {
......
package com.mints.goodmoney.mvp.model;
import java.io.Serializable;
/**
* 用户渠道对应代码位
*/
public class FlowAdRulesBean implements Serializable {
private int YLH;
private int KS;
private int CSJ;
public int getYLH() {
return YLH;
}
public int getKS() {
return KS;
}
public int getCSJ() {
return CSJ;
}
}
......@@ -12,6 +12,7 @@ public class UserTaskMsgBean implements Serializable {
private BlessingBigMsgBean blessingBigMsg;
private UserRiskAppsBean userRiskApps;
private AdcodeBean adcode_v1 = null;
private FlowAdRulesBean flowAdRules;
private String ip;
private String channel;
......@@ -120,4 +121,8 @@ public class UserTaskMsgBean implements Serializable {
public String getChannel() {
return channel;
}
public FlowAdRulesBean getFlowAdRules() {
return flowAdRules;
}
}
......@@ -21,6 +21,7 @@ import com.mints.goodmoney.ad.video.VideoAdingManager
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.*
import com.mints.goodmoney.mvp.model.FlowAdRulesBean
import com.mints.goodmoney.mvp.model.MainVideoMsgBean
import com.mints.goodmoney.mvp.model.UserTaskMsgBean
import com.mints.goodmoney.mvp.presenters.HomePresenter
......@@ -233,6 +234,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
// 设置视频权重
initAdWeight(data)
initExpress(data.flowAdRules)
// 调用金币视频信息接口
homePresenter.getHomeVedioMsg()
......@@ -258,6 +260,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
}
}
override fun getHomeVedioMsgSuc(data: MainVideoMsgBean) {
if (activity == null || requireActivity().isFinishing) {
return
......@@ -601,6 +605,10 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
)
}
private fun initExpress(flowAdRules: FlowAdRulesBean) {
PreLoadExpressManager.init(flowAdRules.csj,flowAdRules.ylh,flowAdRules.ks)
}
/**
* 手机号登录未绑定微信 弹出界面不能关闭
*/
......
......@@ -18,6 +18,7 @@ import com.fly.scenemodule.SceneUtil
import com.mints.goodmoney.BuildConfig
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.banner.BannerManager
import com.mints.goodmoney.ad.express.PreLoadExpressManager
import com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
import com.mints.goodmoney.ad.express.TTPreLoadExpressXmlyManager
import com.mints.goodmoney.ad.video.VideoAdingManager
......@@ -258,6 +259,7 @@ class MyFragment : BaseFragment(),
// 更新权重
initAdWeight(data)
initExpress(data.flowAdRules)
AppConfig.app_black_name = data.userRiskApps.userRiskAppName
AppConfig.app_black_pkg = data.userRiskApps.userRiskAppPkg
AppConfig.flVideoFlag = data.vedioRules.isFlVideoFlag
......@@ -1154,6 +1156,10 @@ class MyFragment : BaseFragment(),
)
}
private fun initExpress(flowAdRules: FlowAdRulesBean) {
PreLoadExpressManager.init(flowAdRules.csj,flowAdRules.ylh,flowAdRules.ks)
}
/**
* 跳转QQ群弹框
*/
......
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